feat(import): preserve supported HTTP contracts
This commit is contained in:
1 parent
083974c27f
commit
f8ee7c9bfe
87 files changed
+7496
-534
No files matched your search
@@ -262,8 +262,14 @@ async fn resolve_existing(
|
||||
}
|
||||
|
||||
pub fn policy(operation: &RuntimeOperation) -> Option<&IdempotencyPolicy> {
|
||||
let is_mutating_rest =
|
||||
matches!(&operation.target, Target::Rest(target) if target.method != HttpMethod::Get);
|
||||
let is_mutating_rest = matches!(
|
||||
&operation.target,
|
||||
Target::Rest(target)
|
||||
if matches!(
|
||||
target.method,
|
||||
HttpMethod::Post | HttpMethod::Put | HttpMethod::Patch | HttpMethod::Delete
|
||||
)
|
||||
);
|
||||
if !is_mutating_rest {
|
||||
return None;
|
||||
}
|
||||
@@ -398,9 +404,13 @@ mod tests {
|
||||
method: HttpMethod::Post,
|
||||
path_template: "/orders".to_owned(),
|
||||
static_headers: BTreeMap::new(),
|
||||
request_contract: None,
|
||||
response_contract: Vec::new(),
|
||||
multipart_field_mime_types: BTreeMap::new(),
|
||||
}),
|
||||
input_schema: Schema {
|
||||
kind: SchemaKind::Object,
|
||||
format: None,
|
||||
description: None,
|
||||
required: true,
|
||||
nullable: false,
|
||||
@@ -412,6 +422,7 @@ mod tests {
|
||||
},
|
||||
output_schema: Schema {
|
||||
kind: SchemaKind::Object,
|
||||
format: None,
|
||||
description: None,
|
||||
required: true,
|
||||
nullable: false,
|
||||
|
||||
Reference in new issue
Block a user