diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/api.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/api.mustache index c04ae5d469f..5fce1060d5a 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/api.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/api.mustache @@ -274,7 +274,7 @@ public interface {{classname}} { } // Override this method - {{#jdk8-default-interface}}default {{/jdk8-default-interface}} {{>responseType}} {{operationId}}({{#allParams}}{{^isFile}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}Mono<{{{dataType}}}>{{/isArray}}{{#isArray}}Flux<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}{{/isFile}}{{#isFile}}{{#reactive}}Flux{{/reactive}}{{^reactive}}MultipartFile{{/reactive}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#reactive}}{{#hasParams}}, {{/hasParams}}{{#springFoxDocumentationProvider}}@ApiIgnore{{/springFoxDocumentationProvider}} final ServerWebExchange exchange{{/reactive}}{{#vendorExtensions.x-spring-paginated}}{{#hasParams}}, {{/hasParams}}{{^hasParams}}{{#reactive}}, {{/reactive}}{{/hasParams}}{{#springFoxDocumentationProvider}}@ApiIgnore{{/springFoxDocumentationProvider}}final Pageable pageable{{/vendorExtensions.x-spring-paginated}}){{#unhandledException}} throws Exception{{/unhandledException}} { + {{#jdk8-default-interface}}default {{/jdk8-default-interface}} {{>responseType}} {{operationId}}({{#allParams}}{{^isFile}}{{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isArray}}Mono<{{{dataType}}}>{{/isArray}}{{#isArray}}Flux<{{{baseType}}}>{{/isArray}}{{/reactive}}{{/isBodyParam}}{{/isFile}}{{#isFile}}{{#reactive}}Flux{{/reactive}}{{^reactive}}{{#isArray}}List{{/isArray}}{{^isArray}}MultipartFile{{/isArray}}{{/reactive}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#reactive}}{{#hasParams}}, {{/hasParams}}{{#springFoxDocumentationProvider}}@ApiIgnore{{/springFoxDocumentationProvider}} final ServerWebExchange exchange{{/reactive}}{{#vendorExtensions.x-spring-paginated}}{{#hasParams}}, {{/hasParams}}{{^hasParams}}{{#reactive}}, {{/reactive}}{{/hasParams}}{{#springFoxDocumentationProvider}}@ApiIgnore{{/springFoxDocumentationProvider}}final Pageable pageable{{/vendorExtensions.x-spring-paginated}}){{#unhandledException}} throws Exception{{/unhandledException}} { {{/delegate-method}} {{^isDelegate}} {{>methodBody}}{{! prevent indent}} diff --git a/samples/server/petstore/rust-server-deprecated/output/multipart-v3/examples/server/server.rs b/samples/server/petstore/rust-server-deprecated/output/multipart-v3/examples/server/server.rs index 5b2d8a75d03..af2ee7a3683 100644 --- a/samples/server/petstore/rust-server-deprecated/output/multipart-v3/examples/server/server.rs +++ b/samples/server/petstore/rust-server-deprecated/output/multipart-v3/examples/server/server.rs @@ -123,7 +123,6 @@ impl Api for Server where C: Has + Send + Sync info!("multipart_related_request_post({:?}, {:?}, {:?}) - X-Span-ID: {:?}", required_binary_field, object_field, optional_binary_field, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn multipart_request_post( &self, string_field: String, @@ -135,7 +134,6 @@ impl Api for Server where C: Has + Send + Sync info!("multipart_request_post(\"{}\", {:?}, {:?}, {:?}) - X-Span-ID: {:?}", string_field, binary_field, optional_string_field, object_field, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn multiple_identical_mime_types_post( &self, binary1: Option, @@ -145,5 +143,4 @@ impl Api for Server where C: Has + Send + Sync info!("multiple_identical_mime_types_post({:?}, {:?}) - X-Span-ID: {:?}", binary1, binary2, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - } diff --git a/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/client/mod.rs b/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/client/mod.rs index 8ccd2f068dd..0053b2b8d5b 100644 --- a/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/client/mod.rs @@ -444,7 +444,6 @@ impl Api for Client where }); body_parts.push(part); } - if let Some(optional_binary_field) = param_optional_binary_field { let part = Node::Part(Part { headers: { @@ -457,7 +456,6 @@ impl Api for Client where }); body_parts.push(part); } - { let part = Node::Part(Part { headers: { @@ -479,7 +477,6 @@ impl Api for Client where write_multipart(&mut body, &boundary, &body_parts) .expect("Failed to write multipart body"); - let header = "multipart/related"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_bytes( @@ -491,7 +488,6 @@ impl Api for Client where // Add the message body to the request object. *request.body_mut() = Body::from(body); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -524,7 +520,6 @@ impl Api for Client where } } } - async fn multipart_request_post( &self, param_string_field: String, @@ -643,8 +638,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {multipart_header} - {e}"))) }); - - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -677,7 +670,6 @@ impl Api for Client where } } } - async fn multiple_identical_mime_types_post( &self, param_binary1: Option, @@ -730,7 +722,6 @@ impl Api for Client where }); body_parts.push(part); } - if let Some(binary2) = param_binary2 { let part = Node::Part(Part { headers: { @@ -752,7 +743,6 @@ impl Api for Client where write_multipart(&mut body, &boundary, &body_parts) .expect("Failed to write multipart body"); - let header = "multipart/related"; request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_bytes( @@ -764,7 +754,6 @@ impl Api for Client where // Add the message body to the request object. *request.body_mut() = Body::from(body); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -797,5 +786,4 @@ impl Api for Client where } } } - } diff --git a/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/lib.rs b/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/lib.rs index 8c41db6313c..e8deab51d1f 100644 --- a/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/lib.rs +++ b/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/lib.rs @@ -25,19 +25,16 @@ pub enum MultipartRelatedRequestPostResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum MultipartRequestPostResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum MultipleIdenticalMimeTypesPostResponse { /// OK OK } - /// API #[async_trait] #[allow(clippy::too_many_arguments, clippy::ptr_arg)] diff --git a/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/server/mod.rs b/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/server/mod.rs index 27481467e75..2cce5a4427b 100644 --- a/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/server/mod.rs @@ -52,7 +52,6 @@ mod paths { pub(crate) static ID_MULTIPLE_IDENTICAL_MIME_TYPES: usize = 2; } - pub struct MakeService where T: Api + Clone + Send + 'static, C: Has + Send + Sync + 'static @@ -104,7 +103,6 @@ impl hyper::service::Service for MakeService where future::ok(service) } } - fn method_not_allowed() -> Result, crate::ServiceError> { Ok( Response::builder().status(StatusCode::METHOD_NOT_ALLOWED) @@ -185,7 +183,6 @@ impl hyper::service::Service<(Request, C)> for Service where let path = paths::GLOBAL_REGEX_SET.matches(uri.path()); match method { - // MultipartRelatedRequestPost - POST /multipart_related_request hyper::Method::POST if path.matched(paths::ID_MULTIPART_RELATED_REQUEST) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -272,8 +269,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required multipart/related parameter required_binary_field".to_string())) .expect("Unable to create Bad Request response for missing multipart/related parameter required_binary_field due to schema")) }; - - let result = api_impl.multipart_related_request_post( param_required_binary_field, param_object_field, @@ -297,7 +292,6 @@ impl hyper::service::Service<(Request, C)> for Service where MultipartRelatedRequestPostResponse::OK => { *response.status_mut() = StatusCode::from_u16(201).expect("Unable to turn 201 into a StatusCode"); - }, }, Err(_) => { @@ -316,7 +310,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // MultipartRequestPost - POST /multipart_request hyper::Method::POST if path.matched(paths::ID_MULTIPART_REQUEST) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -465,8 +458,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request due to missing required form parameter binary_field")) } }; - - let result = api_impl.multipart_request_post( param_string_field, param_binary_field, @@ -485,7 +476,6 @@ impl hyper::service::Service<(Request, C)> for Service where MultipartRequestPostResponse::OK => { *response.status_mut() = StatusCode::from_u16(201).expect("Unable to turn 201 into a StatusCode"); - }, }, Err(_) => { @@ -504,7 +494,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // MultipleIdenticalMimeTypesPost - POST /multiple-identical-mime-types hyper::Method::POST if path.matched(paths::ID_MULTIPLE_IDENTICAL_MIME_TYPES) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -567,8 +556,6 @@ impl hyper::service::Service<(Request, C)> for Service where } // Check that the required multipart chunks are present. - - let result = api_impl.multiple_identical_mime_types_post( param_binary1, param_binary2, @@ -591,7 +578,6 @@ impl hyper::service::Service<(Request, C)> for Service where MultipleIdenticalMimeTypesPostResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -610,7 +596,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - _ if path.matched(paths::ID_MULTIPART_RELATED_REQUEST) => method_not_allowed(), _ if path.matched(paths::ID_MULTIPART_REQUEST) => method_not_allowed(), _ if path.matched(paths::ID_MULTIPLE_IDENTICAL_MIME_TYPES) => method_not_allowed(), @@ -626,7 +611,6 @@ impl hyper::service::Service<(Request, C)> for Service where )) } } - /// Request parser for `Api`. pub struct ApiRequestParser; impl RequestParser for ApiRequestParser { diff --git a/samples/server/petstore/rust-server-deprecated/output/no-example-v3/examples/server/server.rs b/samples/server/petstore/rust-server-deprecated/output/no-example-v3/examples/server/server.rs index c4e6006fb34..d3addbcfcb9 100644 --- a/samples/server/petstore/rust-server-deprecated/output/no-example-v3/examples/server/server.rs +++ b/samples/server/petstore/rust-server-deprecated/output/no-example-v3/examples/server/server.rs @@ -119,5 +119,4 @@ impl Api for Server where C: Has + Send + Sync info!("op_get({:?}) - X-Span-ID: {:?}", op_get_request, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - } diff --git a/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/client/mod.rs b/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/client/mod.rs index 9cd608f8c3c..a11785695a1 100644 --- a/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/client/mod.rs @@ -427,7 +427,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -460,5 +459,4 @@ impl Api for Client where } } } - } diff --git a/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/lib.rs b/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/lib.rs index 009a3183735..446a8223f29 100644 --- a/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/lib.rs +++ b/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/lib.rs @@ -25,7 +25,6 @@ pub enum OpGetResponse { /// OK OK } - /// API #[async_trait] #[allow(clippy::too_many_arguments, clippy::ptr_arg)] diff --git a/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/server/mod.rs b/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/server/mod.rs index a5727157637..22f916db036 100644 --- a/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/server/mod.rs @@ -41,7 +41,6 @@ mod paths { pub(crate) static ID_OP: usize = 0; } - pub struct MakeService where T: Api + Clone + Send + 'static, C: Has + Send + Sync + 'static @@ -80,7 +79,6 @@ impl hyper::service::Service for MakeService where future::ok(service) } } - fn method_not_allowed() -> Result, crate::ServiceError> { Ok( Response::builder().status(StatusCode::METHOD_NOT_ALLOWED) @@ -147,7 +145,6 @@ impl hyper::service::Service<(Request, C)> for Service where let path = paths::GLOBAL_REGEX_SET.matches(uri.path()); match method { - // OpGet - GET /op hyper::Method::GET if path.matched(paths::ID_OP) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -179,8 +176,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter OpGetRequest")) .expect("Unable to create Bad Request response for missing body parameter OpGetRequest")), }; - - let result = api_impl.op_get( param_op_get_request, &context @@ -202,7 +197,6 @@ impl hyper::service::Service<(Request, C)> for Service where OpGetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -221,7 +215,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - _ if path.matched(paths::ID_OP) => method_not_allowed(), _ => Ok(Response::builder().status(StatusCode::NOT_FOUND) .body(Body::empty()) @@ -234,7 +227,6 @@ impl hyper::service::Service<(Request, C)> for Service where )) } } - /// Request parser for `Api`. pub struct ApiRequestParser; impl RequestParser for ApiRequestParser { diff --git a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/examples/client/server.rs b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/examples/client/server.rs index fc466245a56..cfbb1a20679 100644 --- a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/examples/client/server.rs +++ b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/examples/client/server.rs @@ -112,7 +112,6 @@ impl CallbackApi for Server where C: Has + Send + Sync info!("callback_callback_with_header_post({:?}) - X-Span-ID: {:?}", information, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn callback_callback_post( &self, callback_request_query_url: String, @@ -121,5 +120,4 @@ impl CallbackApi for Server where C: Has + Send + Sync info!("callback_callback_post() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - } diff --git a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/examples/server/server.rs b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/examples/server/server.rs index 2849321515c..43b3f95fb02 100644 --- a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/examples/server/server.rs +++ b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/examples/server/server.rs @@ -149,7 +149,6 @@ impl Api for Server where C: Has + Send + Sync info!("any_of_get({:?}) - X-Span-ID: {:?}", any_of, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn callback_with_header_post( &self, url: String, @@ -158,7 +157,6 @@ impl Api for Server where C: Has + Send + Sync info!("callback_with_header_post(\"{}\") - X-Span-ID: {:?}", url, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn complex_query_param_get( &self, list_of_strings: Option<&Vec>, @@ -167,7 +165,6 @@ impl Api for Server where C: Has + Send + Sync info!("complex_query_param_get({:?}) - X-Span-ID: {:?}", list_of_strings, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Test examples async fn examples_test( &self, @@ -177,7 +174,6 @@ impl Api for Server where C: Has + Send + Sync info!("examples_test({:?}) - X-Span-ID: {:?}", ids, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Test a Form Post async fn form_test( &self, @@ -187,7 +183,6 @@ impl Api for Server where C: Has + Send + Sync info!("form_test({:?}) - X-Span-ID: {:?}", required_array, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn get_with_boolean_parameter( &self, iambool: bool, @@ -196,7 +191,6 @@ impl Api for Server where C: Has + Send + Sync info!("get_with_boolean_parameter({}) - X-Span-ID: {:?}", iambool, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn json_complex_query_param_get( &self, list_of_strings: Option<&Vec>, @@ -205,7 +199,6 @@ impl Api for Server where C: Has + Send + Sync info!("json_complex_query_param_get({:?}) - X-Span-ID: {:?}", list_of_strings, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn mandatory_request_header_get( &self, x_header: String, @@ -214,7 +207,6 @@ impl Api for Server where C: Has + Send + Sync info!("mandatory_request_header_get(\"{}\") - X-Span-ID: {:?}", x_header, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn merge_patch_json_get( &self, context: &C) -> Result @@ -222,7 +214,6 @@ impl Api for Server where C: Has + Send + Sync info!("merge_patch_json_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Get some stuff. async fn multiget_get( &self, @@ -231,7 +222,6 @@ impl Api for Server where C: Has + Send + Sync info!("multiget_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn multiple_auth_scheme_get( &self, context: &C) -> Result @@ -239,7 +229,6 @@ impl Api for Server where C: Has + Send + Sync info!("multiple_auth_scheme_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn one_of_get( &self, context: &C) -> Result @@ -247,7 +236,6 @@ impl Api for Server where C: Has + Send + Sync info!("one_of_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn override_server_get( &self, context: &C) -> Result @@ -255,7 +243,6 @@ impl Api for Server where C: Has + Send + Sync info!("override_server_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Get some stuff with parameters. async fn paramget_get( &self, @@ -267,7 +254,6 @@ impl Api for Server where C: Has + Send + Sync info!("paramget_get({:?}, {:?}, {:?}) - X-Span-ID: {:?}", uuid, some_object, some_list, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn readonly_auth_scheme_get( &self, context: &C) -> Result @@ -275,7 +261,6 @@ impl Api for Server where C: Has + Send + Sync info!("readonly_auth_scheme_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn register_callback_post( &self, url: String, @@ -284,7 +269,6 @@ impl Api for Server where C: Has + Send + Sync info!("register_callback_post(\"{}\") - X-Span-ID: {:?}", url, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn required_octet_stream_put( &self, body: swagger::ByteArray, @@ -293,7 +277,6 @@ impl Api for Server where C: Has + Send + Sync info!("required_octet_stream_put({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn responses_with_headers_get( &self, context: &C) -> Result @@ -301,7 +284,6 @@ impl Api for Server where C: Has + Send + Sync info!("responses_with_headers_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn rfc7807_get( &self, context: &C) -> Result @@ -309,7 +291,6 @@ impl Api for Server where C: Has + Send + Sync info!("rfc7807_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn two_first_letter_headers( &self, x_header_one: Option, @@ -319,7 +300,6 @@ impl Api for Server where C: Has + Send + Sync info!("two_first_letter_headers({:?}, {:?}) - X-Span-ID: {:?}", x_header_one, x_header_two, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn untyped_property_get( &self, object_untyped_props: Option, @@ -328,7 +308,6 @@ impl Api for Server where C: Has + Send + Sync info!("untyped_property_get({:?}) - X-Span-ID: {:?}", object_untyped_props, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn uuid_get( &self, context: &C) -> Result @@ -336,7 +315,6 @@ impl Api for Server where C: Has + Send + Sync info!("uuid_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn xml_extra_post( &self, duplicate_xml_object: Option, @@ -345,7 +323,6 @@ impl Api for Server where C: Has + Send + Sync info!("xml_extra_post({:?}) - X-Span-ID: {:?}", duplicate_xml_object, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn xml_other_post( &self, another_xml_object: Option, @@ -354,7 +331,6 @@ impl Api for Server where C: Has + Send + Sync info!("xml_other_post({:?}) - X-Span-ID: {:?}", another_xml_object, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn xml_other_put( &self, another_xml_array: Option, @@ -363,7 +339,6 @@ impl Api for Server where C: Has + Send + Sync info!("xml_other_put({:?}) - X-Span-ID: {:?}", another_xml_array, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Post an array. It's important we test apostrophes, so include one here. async fn xml_post( &self, @@ -373,7 +348,6 @@ impl Api for Server where C: Has + Send + Sync info!("xml_post({:?}) - X-Span-ID: {:?}", xml_array, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn xml_put( &self, xml_object: Option, @@ -382,7 +356,6 @@ impl Api for Server where C: Has + Send + Sync info!("xml_put({:?}) - X-Span-ID: {:?}", xml_object, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn enum_in_path_path_param_get( &self, path_param: models::StringEnum, @@ -391,7 +364,6 @@ impl Api for Server where C: Has + Send + Sync info!("enum_in_path_path_param_get({:?}) - X-Span-ID: {:?}", path_param, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn multiple_path_params_with_very_long_path_to_test_formatting_path_param_a_path_param_b_get( &self, path_param_a: String, @@ -401,7 +373,6 @@ impl Api for Server where C: Has + Send + Sync info!("multiple_path_params_with_very_long_path_to_test_formatting_path_param_a_path_param_b_get(\"{}\", \"{}\") - X-Span-ID: {:?}", path_param_a, path_param_b, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn create_repo( &self, object_param: models::ObjectParam, @@ -410,7 +381,6 @@ impl Api for Server where C: Has + Send + Sync info!("create_repo({:?}) - X-Span-ID: {:?}", object_param, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn get_repo_info( &self, repo_id: String, @@ -419,5 +389,4 @@ impl Api for Server where C: Has + Send + Sync info!("get_repo_info(\"{}\") - X-Span-ID: {:?}", repo_id, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - } diff --git a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/client/callbacks.rs b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/client/callbacks.rs index 508c7ac0565..40d70e82e8a 100644 --- a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/client/callbacks.rs +++ b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/client/callbacks.rs @@ -54,7 +54,6 @@ mod paths { } - pub struct MakeService where T: Api + Clone + Send + 'static, C: Has + Has> + Send + Sync + 'static @@ -94,7 +93,6 @@ impl hyper::service::Service for MakeService where } } - fn method_not_allowed() -> Result, crate::ServiceError> { Ok( Response::builder().status(StatusCode::METHOD_NOT_ALLOWED) @@ -161,7 +159,6 @@ impl hyper::service::Service<(Request, C)> for Service where let path = paths::GLOBAL_REGEX_SET.matches(uri.path()); match method { - // CallbackCallbackWithHeaderPost - POST /{$request.query.url}/callback-with-header hyper::Method::POST if path.matched(paths::ID_REQUEST_QUERY_URL_CALLBACK_WITH_HEADER) => { // Path parameters @@ -210,7 +207,6 @@ impl hyper::service::Service<(Request, C)> for Service where CallbackCallbackWithHeaderPostResponse::OK => { *response.status_mut() = StatusCode::from_u16(204).expect("Unable to turn 204 into a StatusCode"); - }, }, Err(_) => { @@ -223,7 +219,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // CallbackCallbackPost - POST /{$request.query.url}/callback hyper::Method::POST if path.matched(paths::ID_REQUEST_QUERY_URL_CALLBACK) => { // Path parameters @@ -251,7 +246,6 @@ impl hyper::service::Service<(Request, C)> for Service where CallbackCallbackPostResponse::OK => { *response.status_mut() = StatusCode::from_u16(204).expect("Unable to turn 204 into a StatusCode"); - }, }, Err(_) => { @@ -264,7 +258,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - _ if path.matched(paths::ID_REQUEST_QUERY_URL_CALLBACK) => method_not_allowed(), _ if path.matched(paths::ID_REQUEST_QUERY_URL_CALLBACK_WITH_HEADER) => method_not_allowed(), _ => Ok(Response::builder().status(StatusCode::NOT_FOUND) @@ -278,7 +271,6 @@ impl hyper::service::Service<(Request, C)> for Service where )) } } - /// Request parser for `Api`. pub struct ApiRequestParser; impl RequestParser for ApiRequestParser { diff --git a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/client/mod.rs b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/client/mod.rs index 05167aaef68..d01a806ff50 100644 --- a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/client/mod.rs @@ -452,7 +452,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -474,7 +473,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(AnyOfGetResponse::Success (body) ) @@ -490,7 +488,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(AnyOfGetResponse::AlternateSuccess (body) ) @@ -506,7 +503,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(AnyOfGetResponse::AnyOfSuccess (body) ) @@ -528,7 +524,6 @@ impl Api for Client where } } } - async fn callback_with_header_post( &self, param_url: String, @@ -565,7 +560,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -598,7 +592,6 @@ impl Api for Client where } } } - async fn complex_query_param_get( &self, param_list_of_strings: Option<&Vec>, @@ -637,7 +630,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -670,7 +662,6 @@ impl Api for Client where } } } - async fn examples_test( &self, param_ids: Option<&Vec>, @@ -709,7 +700,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -731,7 +721,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(ExamplesTestResponse::OK (body) ) @@ -753,7 +742,6 @@ impl Api for Client where } } } - async fn form_test( &self, param_required_array: Option<&Vec>, @@ -810,7 +798,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -843,7 +830,6 @@ impl Api for Client where } } } - async fn get_with_boolean_parameter( &self, param_iambool: bool, @@ -880,7 +866,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -913,7 +898,6 @@ impl Api for Client where } } } - async fn json_complex_query_param_get( &self, param_list_of_strings: Option<&Vec>, @@ -955,7 +939,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -988,7 +971,6 @@ impl Api for Client where } } } - async fn mandatory_request_header_get( &self, param_x_header: String, @@ -1023,7 +1005,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1068,7 +1049,6 @@ impl Api for Client where } } } - async fn merge_patch_json_get( &self, context: &C) -> Result @@ -1102,7 +1082,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1124,7 +1103,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(MergePatchJsonGetResponse::Merge (body) ) @@ -1146,7 +1124,6 @@ impl Api for Client where } } } - async fn multiget_get( &self, context: &C) -> Result @@ -1180,7 +1157,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1202,7 +1178,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(MultigetGetResponse::JSONRsp (body) ) @@ -1220,7 +1195,6 @@ impl Api for Client where let body = serde_xml_rs::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(MultigetGetResponse::XMLRsp (body) ) @@ -1233,7 +1207,6 @@ impl Api for Client where let body = swagger::ByteArray(body.to_vec()); - Ok(MultigetGetResponse::OctetRsp (body) ) @@ -1248,7 +1221,6 @@ impl Api for Client where .map_err(|e| ApiError(format!("Response was not valid UTF8: {e}")))?; let body = body.to_string(); - Ok(MultigetGetResponse::StringRsp (body) ) @@ -1264,7 +1236,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(MultigetGetResponse::DuplicateResponseLongText (body) ) @@ -1280,7 +1251,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(MultigetGetResponse::DuplicateResponseLongText_2 (body) ) @@ -1296,7 +1266,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(MultigetGetResponse::DuplicateResponseLongText_3 (body) ) @@ -1318,7 +1287,6 @@ impl Api for Client where } } } - async fn multiple_auth_scheme_get( &self, context: &C) -> Result @@ -1352,7 +1320,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1403,7 +1370,6 @@ impl Api for Client where } } } - async fn one_of_get( &self, context: &C) -> Result @@ -1437,7 +1403,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1459,7 +1424,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(OneOfGetResponse::Success (body) ) @@ -1481,7 +1445,6 @@ impl Api for Client where } } } - async fn override_server_get( &self, context: &C) -> Result @@ -1515,7 +1478,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1548,7 +1510,6 @@ impl Api for Client where } } } - async fn paramget_get( &self, param_uuid: Option, @@ -1597,7 +1558,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1619,7 +1579,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(ParamgetGetResponse::JSONRsp (body) ) @@ -1641,7 +1600,6 @@ impl Api for Client where } } } - async fn readonly_auth_scheme_get( &self, context: &C) -> Result @@ -1675,7 +1633,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1726,7 +1683,6 @@ impl Api for Client where } } } - async fn register_callback_post( &self, param_url: String, @@ -1763,7 +1719,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1796,7 +1751,6 @@ impl Api for Client where } } } - async fn required_octet_stream_put( &self, param_body: swagger::ByteArray, @@ -1842,7 +1796,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1875,7 +1828,6 @@ impl Api for Client where } } } - async fn responses_with_headers_get( &self, context: &C) -> Result @@ -1909,7 +1861,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1973,7 +1924,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(ResponsesWithHeadersGetResponse::Success { body, @@ -2037,7 +1987,6 @@ impl Api for Client where } } } - async fn rfc7807_get( &self, context: &C) -> Result @@ -2071,7 +2020,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2093,7 +2041,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(Rfc7807GetResponse::OK (body) ) @@ -2109,7 +2056,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(Rfc7807GetResponse::NotFound (body) ) @@ -2127,7 +2073,6 @@ impl Api for Client where let body = serde_xml_rs::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(Rfc7807GetResponse::NotAcceptable (body) ) @@ -2149,7 +2094,6 @@ impl Api for Client where } } } - async fn two_first_letter_headers( &self, param_x_header_one: Option, @@ -2185,7 +2129,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2253,7 +2196,6 @@ impl Api for Client where } } } - async fn untyped_property_get( &self, param_object_untyped_props: Option, @@ -2301,7 +2243,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2334,7 +2275,6 @@ impl Api for Client where } } } - async fn uuid_get( &self, context: &C) -> Result @@ -2368,7 +2308,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2390,7 +2329,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(UuidGetResponse::DuplicateResponseLongText (body) ) @@ -2412,7 +2350,6 @@ impl Api for Client where } } } - async fn xml_extra_post( &self, param_duplicate_xml_object: Option, @@ -2460,7 +2397,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2498,7 +2434,6 @@ impl Api for Client where } } } - async fn xml_other_post( &self, param_another_xml_object: Option, @@ -2546,7 +2481,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2570,7 +2504,6 @@ impl Api for Client where let body = serde_xml_rs::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(XmlOtherPostResponse::OK (body) ) @@ -2597,7 +2530,6 @@ impl Api for Client where } } } - async fn xml_other_put( &self, param_another_xml_array: Option, @@ -2645,7 +2577,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2683,7 +2614,6 @@ impl Api for Client where } } } - async fn xml_post( &self, param_xml_array: Option, @@ -2731,7 +2661,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2769,7 +2698,6 @@ impl Api for Client where } } } - async fn xml_put( &self, param_xml_object: Option, @@ -2817,7 +2745,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2855,7 +2782,6 @@ impl Api for Client where } } } - async fn enum_in_path_path_param_get( &self, param_path_param: models::StringEnum, @@ -2891,7 +2817,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2924,7 +2849,6 @@ impl Api for Client where } } } - async fn multiple_path_params_with_very_long_path_to_test_formatting_path_param_a_path_param_b_get( &self, param_path_param_a: String, @@ -2962,7 +2886,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2995,7 +2918,6 @@ impl Api for Client where } } } - async fn create_repo( &self, param_object_param: models::ObjectParam, @@ -3041,7 +2963,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -3074,7 +2995,6 @@ impl Api for Client where } } } - async fn get_repo_info( &self, param_repo_id: String, @@ -3110,7 +3030,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -3132,7 +3051,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(GetRepoInfoResponse::OK (body) ) @@ -3154,5 +3072,4 @@ impl Api for Client where } } } - } diff --git a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/lib.rs b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/lib.rs index f4952741578..190fa506356 100644 --- a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/lib.rs +++ b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/lib.rs @@ -35,57 +35,48 @@ pub enum AnyOfGetResponse { AnyOfSuccess (models::AnyOfGet202Response) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum CallbackWithHeaderPostResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum ComplexQueryParamGetResponse { /// Success Success } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum ExamplesTestResponse { /// OK OK (models::AdditionalPropertiesReferencedAnyOfObject) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum FormTestResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum GetWithBooleanParameterResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum JsonComplexQueryParamGetResponse { /// Success Success } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum MandatoryRequestHeaderGetResponse { /// Success Success } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum MergePatchJsonGetResponse { /// merge-patch+json-encoded response Merge (models::AnotherXmlObject) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum MultigetGetResponse { @@ -117,51 +108,43 @@ pub enum MultigetGetResponse { DuplicateResponseLongText_3 (models::AnotherXmlObject) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum MultipleAuthSchemeGetResponse { /// Check that limiting to multiple required auth schemes works CheckThatLimitingToMultipleRequiredAuthSchemesWorks } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum OneOfGetResponse { /// Success Success (models::OneOfGet200Response) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum OverrideServerGetResponse { /// Success. Success } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum ParamgetGetResponse { /// JSON rsp JSONRsp (models::AnotherXmlObject) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum ReadonlyAuthSchemeGetResponse { /// Check that limiting to a single required auth scheme works CheckThatLimitingToASingleRequiredAuthSchemeWorks } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum RegisterCallbackPostResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum RequiredOctetStreamPutResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum ResponsesWithHeadersGetResponse { @@ -197,7 +180,6 @@ pub enum ResponsesWithHeadersGetResponse { > } } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum Rfc7807GetResponse { @@ -213,26 +195,22 @@ pub enum Rfc7807GetResponse { NotAcceptable (models::ObjectWithArrayOfObjects) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum TwoFirstLetterHeadersResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum UntypedPropertyGetResponse { /// Check that untyped properties works CheckThatUntypedPropertiesWorks } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum UuidGetResponse { /// Duplicate Response long text. One. DuplicateResponseLongText (uuid::Uuid) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum XmlExtraPostResponse { @@ -242,7 +220,6 @@ pub enum XmlExtraPostResponse { /// Bad Request BadRequest } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum XmlOtherPostResponse { @@ -253,7 +230,6 @@ pub enum XmlOtherPostResponse { /// Bad Request BadRequest } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum XmlOtherPutResponse { @@ -263,7 +239,6 @@ pub enum XmlOtherPutResponse { /// Bad Request BadRequest } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum XmlPostResponse { @@ -273,7 +248,6 @@ pub enum XmlPostResponse { /// Bad Request BadRequest } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum XmlPutResponse { @@ -283,32 +257,27 @@ pub enum XmlPutResponse { /// Bad Request BadRequest } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum EnumInPathPathParamGetResponse { /// Success Success } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGetResponse { /// Success Success } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum CreateRepoResponse { /// Success Success } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum GetRepoInfoResponse { /// OK OK (String) } - /// API #[async_trait] #[allow(clippy::too_many_arguments, clippy::ptr_arg)] @@ -950,14 +919,12 @@ pub enum CallbackCallbackWithHeaderPostResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum CallbackCallbackPostResponse { /// OK OK } - /// Callback API #[async_trait] pub trait CallbackApi { diff --git a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/server/callbacks.rs b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/server/callbacks.rs index d698a4f5b96..571865b7d4b 100644 --- a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/server/callbacks.rs +++ b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/server/callbacks.rs @@ -266,7 +266,6 @@ impl CallbackApi for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -317,7 +316,6 @@ impl CallbackApi for Client where } } } - async fn callback_callback_post( &self, callback_request_query_url: String, @@ -352,7 +350,6 @@ impl CallbackApi for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -385,5 +382,4 @@ impl CallbackApi for Client where } } } - } diff --git a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/server/mod.rs b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/server/mod.rs index 102a1b85c53..b61d9c1c07d 100644 --- a/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server-deprecated/output/openapi-v3/src/server/mod.rs @@ -147,7 +147,6 @@ mod paths { pub(crate) static ID_XML_OTHER: usize = 28; } - pub struct MakeService where T: Api + Clone + Send + 'static, C: Has + Has> + Send + Sync + 'static @@ -186,7 +185,6 @@ impl hyper::service::Service for MakeService where future::ok(service) } } - fn method_not_allowed() -> Result, crate::ServiceError> { Ok( Response::builder().status(StatusCode::METHOD_NOT_ALLOWED) @@ -253,7 +251,6 @@ impl hyper::service::Service<(Request, C)> for Service where let path = paths::GLOBAL_REGEX_SET.matches(uri.path()); match method { - // AnyOfGet - GET /any-of hyper::Method::GET if path.matched(paths::ID_ANY_OF) => { // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) @@ -290,7 +287,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, AnyOfGetResponse::AlternateSuccess (body) @@ -303,7 +299,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, AnyOfGetResponse::AnyOfSuccess (body) @@ -316,7 +311,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -329,7 +323,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // CallbackWithHeaderPost - POST /callback-with-header hyper::Method::POST if path.matched(paths::ID_CALLBACK_WITH_HEADER) => { // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) @@ -374,7 +367,6 @@ impl hyper::service::Service<(Request, C)> for Service where CallbackWithHeaderPostResponse::OK => { *response.status_mut() = StatusCode::from_u16(204).expect("Unable to turn 204 into a StatusCode"); - }, }, Err(_) => { @@ -387,7 +379,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // ComplexQueryParamGet - GET /complex-query-param hyper::Method::GET if path.matched(paths::ID_COMPLEX_QUERY_PARAM) => { // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) @@ -416,7 +407,6 @@ impl hyper::service::Service<(Request, C)> for Service where ComplexQueryParamGetResponse::Success => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -429,7 +419,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // ExamplesTest - GET /examples-test hyper::Method::GET if path.matched(paths::ID_EXAMPLES_TEST) => { // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) @@ -466,7 +455,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -479,7 +467,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // FormTest - POST /form-test hyper::Method::POST if path.matched(paths::ID_FORM_TEST) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -491,8 +478,6 @@ impl hyper::service::Service<(Request, C)> for Service where // Form parameters let param_required_array = None; - - let result = api_impl.form_test( param_required_array.as_ref(), &context @@ -508,7 +493,6 @@ impl hyper::service::Service<(Request, C)> for Service where FormTestResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -527,7 +511,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // GetWithBooleanParameter - GET /get-with-bool hyper::Method::GET if path.matched(paths::ID_GET_WITH_BOOL) => { // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) @@ -572,7 +555,6 @@ impl hyper::service::Service<(Request, C)> for Service where GetWithBooleanParameterResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -585,7 +567,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // JsonComplexQueryParamGet - GET /json-complex-query-param hyper::Method::GET if path.matched(paths::ID_JSON_COMPLEX_QUERY_PARAM) => { // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) @@ -623,7 +604,6 @@ impl hyper::service::Service<(Request, C)> for Service where JsonComplexQueryParamGetResponse::Success => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -636,7 +616,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // MandatoryRequestHeaderGet - GET /mandatory-request-header hyper::Method::GET if path.matched(paths::ID_MANDATORY_REQUEST_HEADER) => { // Header parameters @@ -677,7 +656,6 @@ impl hyper::service::Service<(Request, C)> for Service where MandatoryRequestHeaderGetResponse::Success => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -690,7 +668,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // MergePatchJsonGet - GET /merge-patch-json hyper::Method::GET if path.matched(paths::ID_MERGE_PATCH_JSON) => { let result = api_impl.merge_patch_json_get( @@ -715,7 +692,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -728,7 +704,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // MultigetGet - GET /multiget hyper::Method::GET if path.matched(paths::ID_MULTIGET) => { let result = api_impl.multiget_get( @@ -753,7 +728,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, MultigetGetResponse::XMLRsp (body) @@ -766,7 +740,6 @@ impl hyper::service::Service<(Request, C)> for Service where // XML Body let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, MultigetGetResponse::OctetRsp (body) @@ -779,7 +752,6 @@ impl hyper::service::Service<(Request, C)> for Service where // Binary Body let body = body.0; *response.body_mut() = Body::from(body); - }, MultigetGetResponse::StringRsp (body) @@ -792,7 +764,6 @@ impl hyper::service::Service<(Request, C)> for Service where // Plain text Body let body = body; *response.body_mut() = Body::from(body); - }, MultigetGetResponse::DuplicateResponseLongText (body) @@ -805,7 +776,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, MultigetGetResponse::DuplicateResponseLongText_2 (body) @@ -818,7 +788,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, MultigetGetResponse::DuplicateResponseLongText_3 (body) @@ -831,7 +800,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -844,7 +812,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // MultipleAuthSchemeGet - GET /multiple_auth_scheme hyper::Method::GET if path.matched(paths::ID_MULTIPLE_AUTH_SCHEME) => { { @@ -891,7 +858,6 @@ impl hyper::service::Service<(Request, C)> for Service where MultipleAuthSchemeGetResponse::CheckThatLimitingToMultipleRequiredAuthSchemesWorks => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -904,7 +870,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // OneOfGet - GET /one-of hyper::Method::GET if path.matched(paths::ID_ONE_OF) => { let result = api_impl.one_of_get( @@ -929,7 +894,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -942,7 +906,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // OverrideServerGet - GET /override-server hyper::Method::GET if path.matched(paths::ID_OVERRIDE_SERVER) => { let result = api_impl.override_server_get( @@ -959,7 +922,6 @@ impl hyper::service::Service<(Request, C)> for Service where OverrideServerGetResponse::Success => { *response.status_mut() = StatusCode::from_u16(204).expect("Unable to turn 204 into a StatusCode"); - }, }, Err(_) => { @@ -972,7 +934,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // ParamgetGet - GET /paramget hyper::Method::GET if path.matched(paths::ID_PARAMGET) => { // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) @@ -1045,7 +1006,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -1058,7 +1018,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // ReadonlyAuthSchemeGet - GET /readonly_auth_scheme hyper::Method::GET if path.matched(paths::ID_READONLY_AUTH_SCHEME) => { { @@ -1104,7 +1063,6 @@ impl hyper::service::Service<(Request, C)> for Service where ReadonlyAuthSchemeGetResponse::CheckThatLimitingToASingleRequiredAuthSchemeWorks => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1117,7 +1075,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // RegisterCallbackPost - POST /register-callback hyper::Method::POST if path.matched(paths::ID_REGISTER_CALLBACK) => { // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) @@ -1162,7 +1119,6 @@ impl hyper::service::Service<(Request, C)> for Service where RegisterCallbackPostResponse::OK => { *response.status_mut() = StatusCode::from_u16(204).expect("Unable to turn 204 into a StatusCode"); - }, }, Err(_) => { @@ -1175,7 +1131,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // RequiredOctetStreamPut - PUT /required_octet_stream hyper::Method::PUT if path.matched(paths::ID_REQUIRED_OCTET_STREAM) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -1196,8 +1151,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter body")) .expect("Unable to create Bad Request response for missing body parameter body")), }; - - let result = api_impl.required_octet_stream_put( param_body, &context @@ -1213,7 +1166,6 @@ impl hyper::service::Service<(Request, C)> for Service where RequiredOctetStreamPutResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1232,7 +1184,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // ResponsesWithHeadersGet - GET /responses_with_headers hyper::Method::GET if path.matched(paths::ID_RESPONSES_WITH_HEADERS) => { let result = api_impl.responses_with_headers_get( @@ -1311,7 +1262,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, ResponsesWithHeadersGetResponse::PreconditionFailed { @@ -1354,7 +1304,6 @@ impl hyper::service::Service<(Request, C)> for Service where failure_info ); } - }, }, Err(_) => { @@ -1367,7 +1316,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Rfc7807Get - GET /rfc7807 hyper::Method::GET if path.matched(paths::ID_RFC7807) => { let result = api_impl.rfc7807_get( @@ -1392,7 +1340,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, Rfc7807GetResponse::NotFound (body) @@ -1405,7 +1352,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, Rfc7807GetResponse::NotAcceptable (body) @@ -1418,7 +1364,6 @@ impl hyper::service::Service<(Request, C)> for Service where // XML Body let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -1431,7 +1376,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // TwoFirstLetterHeaders - POST /operation-two-first-letter-headers hyper::Method::POST if path.matched(paths::ID_OPERATION_TWO_FIRST_LETTER_HEADERS) => { // Header parameters @@ -1488,7 +1432,6 @@ impl hyper::service::Service<(Request, C)> for Service where TwoFirstLetterHeadersResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1501,7 +1444,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // UntypedPropertyGet - GET /untyped_property hyper::Method::GET if path.matched(paths::ID_UNTYPED_PROPERTY) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -1523,8 +1465,6 @@ impl hyper::service::Service<(Request, C)> for Service where } else { None }; - - let result = api_impl.untyped_property_get( param_object_untyped_props, &context @@ -1546,7 +1486,6 @@ impl hyper::service::Service<(Request, C)> for Service where UntypedPropertyGetResponse::CheckThatUntypedPropertiesWorks => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1565,7 +1504,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // UuidGet - GET /uuid hyper::Method::GET if path.matched(paths::ID_UUID) => { let result = api_impl.uuid_get( @@ -1590,7 +1528,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -1603,7 +1540,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // XmlExtraPost - POST /xml_extra hyper::Method::POST if path.matched(paths::ID_XML_EXTRA) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -1625,8 +1561,6 @@ impl hyper::service::Service<(Request, C)> for Service where } else { None }; - - let result = api_impl.xml_extra_post( param_duplicate_xml_object, &context @@ -1648,12 +1582,10 @@ impl hyper::service::Service<(Request, C)> for Service where XmlExtraPostResponse::OK => { *response.status_mut() = StatusCode::from_u16(201).expect("Unable to turn 201 into a StatusCode"); - }, XmlExtraPostResponse::BadRequest => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, }, Err(_) => { @@ -1672,7 +1604,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // XmlOtherPost - POST /xml_other hyper::Method::POST if path.matched(paths::ID_XML_OTHER) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -1694,8 +1625,6 @@ impl hyper::service::Service<(Request, C)> for Service where } else { None }; - - let result = api_impl.xml_other_post( param_another_xml_object, &context @@ -1729,12 +1658,10 @@ impl hyper::service::Service<(Request, C)> for Service where namespaces.insert("".to_string(), models::AnotherXmlObject::NAMESPACE.to_string()); let body = serde_xml_rs::to_string_with_namespaces(&body, namespaces).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, XmlOtherPostResponse::BadRequest => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, }, Err(_) => { @@ -1753,7 +1680,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // XmlOtherPut - PUT /xml_other hyper::Method::PUT if path.matched(paths::ID_XML_OTHER) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -1775,8 +1701,6 @@ impl hyper::service::Service<(Request, C)> for Service where } else { None }; - - let result = api_impl.xml_other_put( param_another_xml_array, &context @@ -1798,12 +1722,10 @@ impl hyper::service::Service<(Request, C)> for Service where XmlOtherPutResponse::OK => { *response.status_mut() = StatusCode::from_u16(201).expect("Unable to turn 201 into a StatusCode"); - }, XmlOtherPutResponse::BadRequest => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, }, Err(_) => { @@ -1822,7 +1744,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // XmlPost - POST /xml hyper::Method::POST if path.matched(paths::ID_XML) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -1844,8 +1765,6 @@ impl hyper::service::Service<(Request, C)> for Service where } else { None }; - - let result = api_impl.xml_post( param_xml_array, &context @@ -1867,12 +1786,10 @@ impl hyper::service::Service<(Request, C)> for Service where XmlPostResponse::OK => { *response.status_mut() = StatusCode::from_u16(201).expect("Unable to turn 201 into a StatusCode"); - }, XmlPostResponse::BadRequest => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, }, Err(_) => { @@ -1891,7 +1808,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // XmlPut - PUT /xml hyper::Method::PUT if path.matched(paths::ID_XML) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -1913,8 +1829,6 @@ impl hyper::service::Service<(Request, C)> for Service where } else { None }; - - let result = api_impl.xml_put( param_xml_object, &context @@ -1936,12 +1850,10 @@ impl hyper::service::Service<(Request, C)> for Service where XmlPutResponse::OK => { *response.status_mut() = StatusCode::from_u16(201).expect("Unable to turn 201 into a StatusCode"); - }, XmlPutResponse::BadRequest => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, }, Err(_) => { @@ -1960,7 +1872,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // EnumInPathPathParamGet - GET /enum_in_path/{path_param} hyper::Method::GET if path.matched(paths::ID_ENUM_IN_PATH_PATH_PARAM) => { // Path parameters @@ -2001,7 +1912,6 @@ impl hyper::service::Service<(Request, C)> for Service where EnumInPathPathParamGetResponse::Success => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -2014,7 +1924,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGet - GET /multiple-path-params-with-very-long-path-to-test-formatting/{path_param_a}/{path_param_b} hyper::Method::GET if path.matched(paths::ID_MULTIPLE_PATH_PARAMS_WITH_VERY_LONG_PATH_TO_TEST_FORMATTING_PATH_PARAM_A_PATH_PARAM_B) => { // Path parameters @@ -2070,7 +1979,6 @@ impl hyper::service::Service<(Request, C)> for Service where MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGetResponse::Success => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -2083,7 +1991,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // CreateRepo - POST /repos hyper::Method::POST if path.matched(paths::ID_REPOS) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -2115,8 +2022,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter ObjectParam")) .expect("Unable to create Bad Request response for missing body parameter ObjectParam")), }; - - let result = api_impl.create_repo( param_object_param, &context @@ -2138,7 +2043,6 @@ impl hyper::service::Service<(Request, C)> for Service where CreateRepoResponse::Success => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -2157,7 +2061,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // GetRepoInfo - GET /repos/{repoId} hyper::Method::GET if path.matched(paths::ID_REPOS_REPOID) => { // Path parameters @@ -2206,7 +2109,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -2219,7 +2121,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - _ if path.matched(paths::ID_ANY_OF) => method_not_allowed(), _ if path.matched(paths::ID_CALLBACK_WITH_HEADER) => method_not_allowed(), _ if path.matched(paths::ID_COMPLEX_QUERY_PARAM) => method_not_allowed(), @@ -2260,7 +2161,6 @@ impl hyper::service::Service<(Request, C)> for Service where )) } } - /// Request parser for `Api`. pub struct ApiRequestParser; impl RequestParser for ApiRequestParser { diff --git a/samples/server/petstore/rust-server-deprecated/output/ops-v3/examples/server/server.rs b/samples/server/petstore/rust-server-deprecated/output/ops-v3/examples/server/server.rs index d51ecdd7028..ea0bc050d95 100644 --- a/samples/server/petstore/rust-server-deprecated/output/ops-v3/examples/server/server.rs +++ b/samples/server/petstore/rust-server-deprecated/output/ops-v3/examples/server/server.rs @@ -154,7 +154,6 @@ impl Api for Server where C: Has + Send + Sync info!("op10_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op11_get( &self, context: &C) -> Result @@ -162,7 +161,6 @@ impl Api for Server where C: Has + Send + Sync info!("op11_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op12_get( &self, context: &C) -> Result @@ -170,7 +168,6 @@ impl Api for Server where C: Has + Send + Sync info!("op12_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op13_get( &self, context: &C) -> Result @@ -178,7 +175,6 @@ impl Api for Server where C: Has + Send + Sync info!("op13_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op14_get( &self, context: &C) -> Result @@ -186,7 +182,6 @@ impl Api for Server where C: Has + Send + Sync info!("op14_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op15_get( &self, context: &C) -> Result @@ -194,7 +189,6 @@ impl Api for Server where C: Has + Send + Sync info!("op15_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op16_get( &self, context: &C) -> Result @@ -202,7 +196,6 @@ impl Api for Server where C: Has + Send + Sync info!("op16_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op17_get( &self, context: &C) -> Result @@ -210,7 +203,6 @@ impl Api for Server where C: Has + Send + Sync info!("op17_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op18_get( &self, context: &C) -> Result @@ -218,7 +210,6 @@ impl Api for Server where C: Has + Send + Sync info!("op18_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op19_get( &self, context: &C) -> Result @@ -226,7 +217,6 @@ impl Api for Server where C: Has + Send + Sync info!("op19_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op1_get( &self, context: &C) -> Result @@ -234,7 +224,6 @@ impl Api for Server where C: Has + Send + Sync info!("op1_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op20_get( &self, context: &C) -> Result @@ -242,7 +231,6 @@ impl Api for Server where C: Has + Send + Sync info!("op20_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op21_get( &self, context: &C) -> Result @@ -250,7 +238,6 @@ impl Api for Server where C: Has + Send + Sync info!("op21_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op22_get( &self, context: &C) -> Result @@ -258,7 +245,6 @@ impl Api for Server where C: Has + Send + Sync info!("op22_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op23_get( &self, context: &C) -> Result @@ -266,7 +252,6 @@ impl Api for Server where C: Has + Send + Sync info!("op23_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op24_get( &self, context: &C) -> Result @@ -274,7 +259,6 @@ impl Api for Server where C: Has + Send + Sync info!("op24_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op25_get( &self, context: &C) -> Result @@ -282,7 +266,6 @@ impl Api for Server where C: Has + Send + Sync info!("op25_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op26_get( &self, context: &C) -> Result @@ -290,7 +273,6 @@ impl Api for Server where C: Has + Send + Sync info!("op26_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op27_get( &self, context: &C) -> Result @@ -298,7 +280,6 @@ impl Api for Server where C: Has + Send + Sync info!("op27_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op28_get( &self, context: &C) -> Result @@ -306,7 +287,6 @@ impl Api for Server where C: Has + Send + Sync info!("op28_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op29_get( &self, context: &C) -> Result @@ -314,7 +294,6 @@ impl Api for Server where C: Has + Send + Sync info!("op29_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op2_get( &self, context: &C) -> Result @@ -322,7 +301,6 @@ impl Api for Server where C: Has + Send + Sync info!("op2_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op30_get( &self, context: &C) -> Result @@ -330,7 +308,6 @@ impl Api for Server where C: Has + Send + Sync info!("op30_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op31_get( &self, context: &C) -> Result @@ -338,7 +315,6 @@ impl Api for Server where C: Has + Send + Sync info!("op31_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op32_get( &self, context: &C) -> Result @@ -346,7 +322,6 @@ impl Api for Server where C: Has + Send + Sync info!("op32_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op33_get( &self, context: &C) -> Result @@ -354,7 +329,6 @@ impl Api for Server where C: Has + Send + Sync info!("op33_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op34_get( &self, context: &C) -> Result @@ -362,7 +336,6 @@ impl Api for Server where C: Has + Send + Sync info!("op34_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op35_get( &self, context: &C) -> Result @@ -370,7 +343,6 @@ impl Api for Server where C: Has + Send + Sync info!("op35_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op36_get( &self, context: &C) -> Result @@ -378,7 +350,6 @@ impl Api for Server where C: Has + Send + Sync info!("op36_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op37_get( &self, context: &C) -> Result @@ -386,7 +357,6 @@ impl Api for Server where C: Has + Send + Sync info!("op37_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op3_get( &self, context: &C) -> Result @@ -394,7 +364,6 @@ impl Api for Server where C: Has + Send + Sync info!("op3_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op4_get( &self, context: &C) -> Result @@ -402,7 +371,6 @@ impl Api for Server where C: Has + Send + Sync info!("op4_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op5_get( &self, context: &C) -> Result @@ -410,7 +378,6 @@ impl Api for Server where C: Has + Send + Sync info!("op5_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op6_get( &self, context: &C) -> Result @@ -418,7 +385,6 @@ impl Api for Server where C: Has + Send + Sync info!("op6_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op7_get( &self, context: &C) -> Result @@ -426,7 +392,6 @@ impl Api for Server where C: Has + Send + Sync info!("op7_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op8_get( &self, context: &C) -> Result @@ -434,7 +399,6 @@ impl Api for Server where C: Has + Send + Sync info!("op8_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn op9_get( &self, context: &C) -> Result @@ -442,5 +406,4 @@ impl Api for Server where C: Has + Send + Sync info!("op9_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - } diff --git a/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/client/mod.rs b/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/client/mod.rs index 683cc4d7c3e..3e50d9202b8 100644 --- a/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/client/mod.rs @@ -451,7 +451,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -484,7 +483,6 @@ impl Api for Client where } } } - async fn op11_get( &self, context: &C) -> Result @@ -518,7 +516,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -551,7 +548,6 @@ impl Api for Client where } } } - async fn op12_get( &self, context: &C) -> Result @@ -585,7 +581,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -618,7 +613,6 @@ impl Api for Client where } } } - async fn op13_get( &self, context: &C) -> Result @@ -652,7 +646,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -685,7 +678,6 @@ impl Api for Client where } } } - async fn op14_get( &self, context: &C) -> Result @@ -719,7 +711,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -752,7 +743,6 @@ impl Api for Client where } } } - async fn op15_get( &self, context: &C) -> Result @@ -786,7 +776,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -819,7 +808,6 @@ impl Api for Client where } } } - async fn op16_get( &self, context: &C) -> Result @@ -853,7 +841,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -886,7 +873,6 @@ impl Api for Client where } } } - async fn op17_get( &self, context: &C) -> Result @@ -920,7 +906,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -953,7 +938,6 @@ impl Api for Client where } } } - async fn op18_get( &self, context: &C) -> Result @@ -987,7 +971,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1020,7 +1003,6 @@ impl Api for Client where } } } - async fn op19_get( &self, context: &C) -> Result @@ -1054,7 +1036,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1087,7 +1068,6 @@ impl Api for Client where } } } - async fn op1_get( &self, context: &C) -> Result @@ -1121,7 +1101,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1154,7 +1133,6 @@ impl Api for Client where } } } - async fn op20_get( &self, context: &C) -> Result @@ -1188,7 +1166,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1221,7 +1198,6 @@ impl Api for Client where } } } - async fn op21_get( &self, context: &C) -> Result @@ -1255,7 +1231,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1288,7 +1263,6 @@ impl Api for Client where } } } - async fn op22_get( &self, context: &C) -> Result @@ -1322,7 +1296,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1355,7 +1328,6 @@ impl Api for Client where } } } - async fn op23_get( &self, context: &C) -> Result @@ -1389,7 +1361,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1422,7 +1393,6 @@ impl Api for Client where } } } - async fn op24_get( &self, context: &C) -> Result @@ -1456,7 +1426,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1489,7 +1458,6 @@ impl Api for Client where } } } - async fn op25_get( &self, context: &C) -> Result @@ -1523,7 +1491,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1556,7 +1523,6 @@ impl Api for Client where } } } - async fn op26_get( &self, context: &C) -> Result @@ -1590,7 +1556,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1623,7 +1588,6 @@ impl Api for Client where } } } - async fn op27_get( &self, context: &C) -> Result @@ -1657,7 +1621,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1690,7 +1653,6 @@ impl Api for Client where } } } - async fn op28_get( &self, context: &C) -> Result @@ -1724,7 +1686,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1757,7 +1718,6 @@ impl Api for Client where } } } - async fn op29_get( &self, context: &C) -> Result @@ -1791,7 +1751,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1824,7 +1783,6 @@ impl Api for Client where } } } - async fn op2_get( &self, context: &C) -> Result @@ -1858,7 +1816,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1891,7 +1848,6 @@ impl Api for Client where } } } - async fn op30_get( &self, context: &C) -> Result @@ -1925,7 +1881,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1958,7 +1913,6 @@ impl Api for Client where } } } - async fn op31_get( &self, context: &C) -> Result @@ -1992,7 +1946,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2025,7 +1978,6 @@ impl Api for Client where } } } - async fn op32_get( &self, context: &C) -> Result @@ -2059,7 +2011,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2092,7 +2043,6 @@ impl Api for Client where } } } - async fn op33_get( &self, context: &C) -> Result @@ -2126,7 +2076,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2159,7 +2108,6 @@ impl Api for Client where } } } - async fn op34_get( &self, context: &C) -> Result @@ -2193,7 +2141,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2226,7 +2173,6 @@ impl Api for Client where } } } - async fn op35_get( &self, context: &C) -> Result @@ -2260,7 +2206,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2293,7 +2238,6 @@ impl Api for Client where } } } - async fn op36_get( &self, context: &C) -> Result @@ -2327,7 +2271,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2360,7 +2303,6 @@ impl Api for Client where } } } - async fn op37_get( &self, context: &C) -> Result @@ -2394,7 +2336,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2427,7 +2368,6 @@ impl Api for Client where } } } - async fn op3_get( &self, context: &C) -> Result @@ -2461,7 +2401,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2494,7 +2433,6 @@ impl Api for Client where } } } - async fn op4_get( &self, context: &C) -> Result @@ -2528,7 +2466,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2561,7 +2498,6 @@ impl Api for Client where } } } - async fn op5_get( &self, context: &C) -> Result @@ -2595,7 +2531,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2628,7 +2563,6 @@ impl Api for Client where } } } - async fn op6_get( &self, context: &C) -> Result @@ -2662,7 +2596,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2695,7 +2628,6 @@ impl Api for Client where } } } - async fn op7_get( &self, context: &C) -> Result @@ -2729,7 +2661,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2762,7 +2693,6 @@ impl Api for Client where } } } - async fn op8_get( &self, context: &C) -> Result @@ -2796,7 +2726,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2829,7 +2758,6 @@ impl Api for Client where } } } - async fn op9_get( &self, context: &C) -> Result @@ -2863,7 +2791,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2896,5 +2823,4 @@ impl Api for Client where } } } - } diff --git a/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/lib.rs b/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/lib.rs index 866ce4e4654..1146e3a542b 100644 --- a/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/lib.rs +++ b/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/lib.rs @@ -25,223 +25,186 @@ pub enum Op10GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op11GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op12GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op13GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op14GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op15GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op16GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op17GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op18GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op19GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op1GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op20GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op21GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op22GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op23GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op24GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op25GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op26GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op27GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op28GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op29GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op2GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op30GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op31GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op32GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op33GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op34GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op35GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op36GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op37GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op3GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op4GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op5GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op6GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op7GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op8GetResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Op9GetResponse { /// OK OK } - /// API #[async_trait] #[allow(clippy::too_many_arguments, clippy::ptr_arg)] diff --git a/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/server/mod.rs b/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/server/mod.rs index a0658a61ab8..354758908f0 100644 --- a/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server-deprecated/output/ops-v3/src/server/mod.rs @@ -149,7 +149,6 @@ mod paths { pub(crate) static ID_OP9: usize = 36; } - pub struct MakeService where T: Api + Clone + Send + 'static, C: Has + Send + Sync + 'static @@ -188,7 +187,6 @@ impl hyper::service::Service for MakeService where future::ok(service) } } - fn method_not_allowed() -> Result, crate::ServiceError> { Ok( Response::builder().status(StatusCode::METHOD_NOT_ALLOWED) @@ -255,7 +253,6 @@ impl hyper::service::Service<(Request, C)> for Service where let path = paths::GLOBAL_REGEX_SET.matches(uri.path()); match method { - // Op10Get - GET /op10 hyper::Method::GET if path.matched(paths::ID_OP10) => { let result = api_impl.op10_get( @@ -272,7 +269,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op10GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -285,7 +281,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op11Get - GET /op11 hyper::Method::GET if path.matched(paths::ID_OP11) => { let result = api_impl.op11_get( @@ -302,7 +297,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op11GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -315,7 +309,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op12Get - GET /op12 hyper::Method::GET if path.matched(paths::ID_OP12) => { let result = api_impl.op12_get( @@ -332,7 +325,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op12GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -345,7 +337,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op13Get - GET /op13 hyper::Method::GET if path.matched(paths::ID_OP13) => { let result = api_impl.op13_get( @@ -362,7 +353,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op13GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -375,7 +365,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op14Get - GET /op14 hyper::Method::GET if path.matched(paths::ID_OP14) => { let result = api_impl.op14_get( @@ -392,7 +381,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op14GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -405,7 +393,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op15Get - GET /op15 hyper::Method::GET if path.matched(paths::ID_OP15) => { let result = api_impl.op15_get( @@ -422,7 +409,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op15GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -435,7 +421,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op16Get - GET /op16 hyper::Method::GET if path.matched(paths::ID_OP16) => { let result = api_impl.op16_get( @@ -452,7 +437,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op16GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -465,7 +449,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op17Get - GET /op17 hyper::Method::GET if path.matched(paths::ID_OP17) => { let result = api_impl.op17_get( @@ -482,7 +465,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op17GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -495,7 +477,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op18Get - GET /op18 hyper::Method::GET if path.matched(paths::ID_OP18) => { let result = api_impl.op18_get( @@ -512,7 +493,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op18GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -525,7 +505,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op19Get - GET /op19 hyper::Method::GET if path.matched(paths::ID_OP19) => { let result = api_impl.op19_get( @@ -542,7 +521,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op19GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -555,7 +533,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op1Get - GET /op1 hyper::Method::GET if path.matched(paths::ID_OP1) => { let result = api_impl.op1_get( @@ -572,7 +549,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op1GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -585,7 +561,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op20Get - GET /op20 hyper::Method::GET if path.matched(paths::ID_OP20) => { let result = api_impl.op20_get( @@ -602,7 +577,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op20GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -615,7 +589,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op21Get - GET /op21 hyper::Method::GET if path.matched(paths::ID_OP21) => { let result = api_impl.op21_get( @@ -632,7 +605,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op21GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -645,7 +617,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op22Get - GET /op22 hyper::Method::GET if path.matched(paths::ID_OP22) => { let result = api_impl.op22_get( @@ -662,7 +633,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op22GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -675,7 +645,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op23Get - GET /op23 hyper::Method::GET if path.matched(paths::ID_OP23) => { let result = api_impl.op23_get( @@ -692,7 +661,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op23GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -705,7 +673,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op24Get - GET /op24 hyper::Method::GET if path.matched(paths::ID_OP24) => { let result = api_impl.op24_get( @@ -722,7 +689,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op24GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -735,7 +701,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op25Get - GET /op25 hyper::Method::GET if path.matched(paths::ID_OP25) => { let result = api_impl.op25_get( @@ -752,7 +717,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op25GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -765,7 +729,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op26Get - GET /op26 hyper::Method::GET if path.matched(paths::ID_OP26) => { let result = api_impl.op26_get( @@ -782,7 +745,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op26GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -795,7 +757,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op27Get - GET /op27 hyper::Method::GET if path.matched(paths::ID_OP27) => { let result = api_impl.op27_get( @@ -812,7 +773,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op27GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -825,7 +785,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op28Get - GET /op28 hyper::Method::GET if path.matched(paths::ID_OP28) => { let result = api_impl.op28_get( @@ -842,7 +801,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op28GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -855,7 +813,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op29Get - GET /op29 hyper::Method::GET if path.matched(paths::ID_OP29) => { let result = api_impl.op29_get( @@ -872,7 +829,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op29GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -885,7 +841,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op2Get - GET /op2 hyper::Method::GET if path.matched(paths::ID_OP2) => { let result = api_impl.op2_get( @@ -902,7 +857,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op2GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -915,7 +869,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op30Get - GET /op30 hyper::Method::GET if path.matched(paths::ID_OP30) => { let result = api_impl.op30_get( @@ -932,7 +885,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op30GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -945,7 +897,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op31Get - GET /op31 hyper::Method::GET if path.matched(paths::ID_OP31) => { let result = api_impl.op31_get( @@ -962,7 +913,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op31GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -975,7 +925,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op32Get - GET /op32 hyper::Method::GET if path.matched(paths::ID_OP32) => { let result = api_impl.op32_get( @@ -992,7 +941,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op32GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1005,7 +953,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op33Get - GET /op33 hyper::Method::GET if path.matched(paths::ID_OP33) => { let result = api_impl.op33_get( @@ -1022,7 +969,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op33GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1035,7 +981,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op34Get - GET /op34 hyper::Method::GET if path.matched(paths::ID_OP34) => { let result = api_impl.op34_get( @@ -1052,7 +997,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op34GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1065,7 +1009,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op35Get - GET /op35 hyper::Method::GET if path.matched(paths::ID_OP35) => { let result = api_impl.op35_get( @@ -1082,7 +1025,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op35GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1095,7 +1037,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op36Get - GET /op36 hyper::Method::GET if path.matched(paths::ID_OP36) => { let result = api_impl.op36_get( @@ -1112,7 +1053,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op36GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1125,7 +1065,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op37Get - GET /op37 hyper::Method::GET if path.matched(paths::ID_OP37) => { let result = api_impl.op37_get( @@ -1142,7 +1081,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op37GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1155,7 +1093,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op3Get - GET /op3 hyper::Method::GET if path.matched(paths::ID_OP3) => { let result = api_impl.op3_get( @@ -1172,7 +1109,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op3GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1185,7 +1121,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op4Get - GET /op4 hyper::Method::GET if path.matched(paths::ID_OP4) => { let result = api_impl.op4_get( @@ -1202,7 +1137,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op4GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1215,7 +1149,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op5Get - GET /op5 hyper::Method::GET if path.matched(paths::ID_OP5) => { let result = api_impl.op5_get( @@ -1232,7 +1165,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op5GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1245,7 +1177,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op6Get - GET /op6 hyper::Method::GET if path.matched(paths::ID_OP6) => { let result = api_impl.op6_get( @@ -1262,7 +1193,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op6GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1275,7 +1205,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op7Get - GET /op7 hyper::Method::GET if path.matched(paths::ID_OP7) => { let result = api_impl.op7_get( @@ -1292,7 +1221,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op7GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1305,7 +1233,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op8Get - GET /op8 hyper::Method::GET if path.matched(paths::ID_OP8) => { let result = api_impl.op8_get( @@ -1322,7 +1249,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op8GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1335,7 +1261,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // Op9Get - GET /op9 hyper::Method::GET if path.matched(paths::ID_OP9) => { let result = api_impl.op9_get( @@ -1352,7 +1277,6 @@ impl hyper::service::Service<(Request, C)> for Service where Op9GetResponse::OK => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1365,7 +1289,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - _ if path.matched(paths::ID_OP1) => method_not_allowed(), _ if path.matched(paths::ID_OP10) => method_not_allowed(), _ if path.matched(paths::ID_OP11) => method_not_allowed(), @@ -1414,7 +1337,6 @@ impl hyper::service::Service<(Request, C)> for Service where )) } } - /// Request parser for `Api`. pub struct ApiRequestParser; impl RequestParser for ApiRequestParser { diff --git a/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/examples/server/server.rs b/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/examples/server/server.rs index 2920da48619..d360e5cdfb0 100644 --- a/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/examples/server/server.rs +++ b/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/examples/server/server.rs @@ -154,7 +154,6 @@ impl Api for Server where C: Has + Send + Sync info!("test_special_tags({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn call123example( &self, context: &C) -> Result @@ -162,7 +161,6 @@ impl Api for Server where C: Has + Send + Sync info!("call123example() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn fake_outer_boolean_serialize( &self, body: Option, @@ -171,7 +169,6 @@ impl Api for Server where C: Has + Send + Sync info!("fake_outer_boolean_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn fake_outer_composite_serialize( &self, body: Option, @@ -180,7 +177,6 @@ impl Api for Server where C: Has + Send + Sync info!("fake_outer_composite_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn fake_outer_number_serialize( &self, body: Option, @@ -189,7 +185,6 @@ impl Api for Server where C: Has + Send + Sync info!("fake_outer_number_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn fake_outer_string_serialize( &self, body: Option, @@ -198,7 +193,6 @@ impl Api for Server where C: Has + Send + Sync info!("fake_outer_string_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn fake_response_with_numerical_description( &self, context: &C) -> Result @@ -206,7 +200,6 @@ impl Api for Server where C: Has + Send + Sync info!("fake_response_with_numerical_description() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn test_body_with_query_params( &self, query: String, @@ -216,7 +209,6 @@ impl Api for Server where C: Has + Send + Sync info!("test_body_with_query_params(\"{}\", {:?}) - X-Span-ID: {:?}", query, body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// To test \"client\" model async fn test_client_model( &self, @@ -226,7 +218,6 @@ impl Api for Server where C: Has + Send + Sync info!("test_client_model({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 async fn test_endpoint_parameters( &self, @@ -249,7 +240,6 @@ impl Api for Server where C: Has + Send + Sync info!("test_endpoint_parameters({}, {}, \"{}\", {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, date, date_time, password, callback, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// To test enum parameters async fn test_enum_parameters( &self, @@ -265,7 +255,6 @@ impl Api for Server where C: Has + Send + Sync info!("test_enum_parameters({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", enum_header_string_array, enum_header_string, enum_query_string_array, enum_query_string, enum_query_integer, enum_query_double, enum_form_string, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// test inline additionalProperties async fn test_inline_additional_properties( &self, @@ -275,7 +264,6 @@ impl Api for Server where C: Has + Send + Sync info!("test_inline_additional_properties({:?}) - X-Span-ID: {:?}", param, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// test json serialization of form data async fn test_json_form_data( &self, @@ -286,7 +274,6 @@ impl Api for Server where C: Has + Send + Sync info!("test_json_form_data(\"{}\", \"{}\") - X-Span-ID: {:?}", param, param2, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn hyphen_param( &self, hyphen_param: String, @@ -295,7 +282,6 @@ impl Api for Server where C: Has + Send + Sync info!("hyphen_param(\"{}\") - X-Span-ID: {:?}", hyphen_param, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// To test class name in snake case async fn test_classname( &self, @@ -305,7 +291,6 @@ impl Api for Server where C: Has + Send + Sync info!("test_classname({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Add a new pet to the store async fn add_pet( &self, @@ -315,7 +300,6 @@ impl Api for Server where C: Has + Send + Sync info!("add_pet({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Finds Pets by status async fn find_pets_by_status( &self, @@ -325,7 +309,6 @@ impl Api for Server where C: Has + Send + Sync info!("find_pets_by_status({:?}) - X-Span-ID: {:?}", status, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Finds Pets by tags async fn find_pets_by_tags( &self, @@ -335,7 +318,6 @@ impl Api for Server where C: Has + Send + Sync info!("find_pets_by_tags({:?}) - X-Span-ID: {:?}", tags, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Update an existing pet async fn update_pet( &self, @@ -345,7 +327,6 @@ impl Api for Server where C: Has + Send + Sync info!("update_pet({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Deletes a pet async fn delete_pet( &self, @@ -356,7 +337,6 @@ impl Api for Server where C: Has + Send + Sync info!("delete_pet({}, {:?}) - X-Span-ID: {:?}", pet_id, api_key, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Find pet by ID async fn get_pet_by_id( &self, @@ -366,7 +346,6 @@ impl Api for Server where C: Has + Send + Sync info!("get_pet_by_id({}) - X-Span-ID: {:?}", pet_id, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Updates a pet in the store with form data async fn update_pet_with_form( &self, @@ -378,7 +357,6 @@ impl Api for Server where C: Has + Send + Sync info!("update_pet_with_form({}, {:?}, {:?}) - X-Span-ID: {:?}", pet_id, name, status, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// uploads an image async fn upload_file( &self, @@ -390,7 +368,6 @@ impl Api for Server where C: Has + Send + Sync info!("upload_file({}, {:?}, {:?}) - X-Span-ID: {:?}", pet_id, additional_metadata, file, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Returns pet inventories by status async fn get_inventory( &self, @@ -399,7 +376,6 @@ impl Api for Server where C: Has + Send + Sync info!("get_inventory() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Place an order for a pet async fn place_order( &self, @@ -409,7 +385,6 @@ impl Api for Server where C: Has + Send + Sync info!("place_order({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Delete purchase order by ID async fn delete_order( &self, @@ -419,7 +394,6 @@ impl Api for Server where C: Has + Send + Sync info!("delete_order(\"{}\") - X-Span-ID: {:?}", order_id, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Find purchase order by ID async fn get_order_by_id( &self, @@ -429,7 +403,6 @@ impl Api for Server where C: Has + Send + Sync info!("get_order_by_id({}) - X-Span-ID: {:?}", order_id, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Create user async fn create_user( &self, @@ -439,7 +412,6 @@ impl Api for Server where C: Has + Send + Sync info!("create_user({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Creates list of users with given input array async fn create_users_with_array_input( &self, @@ -449,7 +421,6 @@ impl Api for Server where C: Has + Send + Sync info!("create_users_with_array_input({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Creates list of users with given input array async fn create_users_with_list_input( &self, @@ -459,7 +430,6 @@ impl Api for Server where C: Has + Send + Sync info!("create_users_with_list_input({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Logs user into the system async fn login_user( &self, @@ -470,7 +440,6 @@ impl Api for Server where C: Has + Send + Sync info!("login_user(\"{}\", \"{}\") - X-Span-ID: {:?}", username, password, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Logs out current logged in user session async fn logout_user( &self, @@ -479,7 +448,6 @@ impl Api for Server where C: Has + Send + Sync info!("logout_user() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Delete user async fn delete_user( &self, @@ -489,7 +457,6 @@ impl Api for Server where C: Has + Send + Sync info!("delete_user(\"{}\") - X-Span-ID: {:?}", username, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Get user by user name async fn get_user_by_name( &self, @@ -499,7 +466,6 @@ impl Api for Server where C: Has + Send + Sync info!("get_user_by_name(\"{}\") - X-Span-ID: {:?}", username, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Updated user async fn update_user( &self, @@ -510,5 +476,4 @@ impl Api for Server where C: Has + Send + Sync info!("update_user(\"{}\", {:?}) - X-Span-ID: {:?}", username, body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - } diff --git a/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs b/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs index 7019561622d..62c04f02695 100644 --- a/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs +++ b/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs @@ -464,7 +464,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -486,7 +485,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(TestSpecialTagsResponse::SuccessfulOperation (body) ) @@ -508,7 +506,6 @@ impl Api for Client where } } } - async fn call123example( &self, context: &C) -> Result @@ -542,7 +539,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -575,7 +571,6 @@ impl Api for Client where } } } - async fn fake_outer_boolean_serialize( &self, param_body: Option, @@ -623,7 +618,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -645,7 +639,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(FakeOuterBooleanSerializeResponse::OutputBoolean (body) ) @@ -667,7 +660,6 @@ impl Api for Client where } } } - async fn fake_outer_composite_serialize( &self, param_body: Option, @@ -715,7 +707,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -737,7 +728,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(FakeOuterCompositeSerializeResponse::OutputComposite (body) ) @@ -759,7 +749,6 @@ impl Api for Client where } } } - async fn fake_outer_number_serialize( &self, param_body: Option, @@ -807,7 +796,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -829,7 +817,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(FakeOuterNumberSerializeResponse::OutputNumber (body) ) @@ -851,7 +838,6 @@ impl Api for Client where } } } - async fn fake_outer_string_serialize( &self, param_body: Option, @@ -899,7 +885,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -921,7 +906,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(FakeOuterStringSerializeResponse::OutputString (body) ) @@ -943,7 +927,6 @@ impl Api for Client where } } } - async fn fake_response_with_numerical_description( &self, context: &C) -> Result @@ -977,7 +960,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1010,7 +992,6 @@ impl Api for Client where } } } - async fn test_body_with_query_params( &self, param_query: String, @@ -1059,7 +1040,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1092,7 +1072,6 @@ impl Api for Client where } } } - async fn test_client_model( &self, param_body: models::Client, @@ -1138,7 +1117,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1160,7 +1138,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(TestClientModelResponse::SuccessfulOperation (body) ) @@ -1182,7 +1159,6 @@ impl Api for Client where } } } - async fn test_endpoint_parameters( &self, param_number: f64, @@ -1319,7 +1295,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1375,7 +1350,6 @@ impl Api for Client where } } } - async fn test_enum_parameters( &self, param_enum_header_string_array: Option<&Vec>, @@ -1451,7 +1425,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1524,7 +1497,6 @@ impl Api for Client where } } } - async fn test_inline_additional_properties( &self, param_param: std::collections::HashMap, @@ -1570,7 +1542,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1603,7 +1574,6 @@ impl Api for Client where } } } - async fn test_json_form_data( &self, param_param: String, @@ -1660,7 +1630,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1693,7 +1662,6 @@ impl Api for Client where } } } - async fn hyphen_param( &self, param_hyphen_param: String, @@ -1729,7 +1697,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1762,7 +1729,6 @@ impl Api for Client where } } } - async fn test_classname( &self, param_body: models::Client, @@ -1811,7 +1777,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1841,7 +1806,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(TestClassnameResponse::SuccessfulOperation (body) ) @@ -1863,7 +1827,6 @@ impl Api for Client where } } } - async fn add_pet( &self, param_body: models::Pet, @@ -1909,7 +1872,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1960,7 +1922,6 @@ impl Api for Client where } } } - async fn find_pets_by_status( &self, param_status: &Vec, @@ -1997,7 +1958,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2039,7 +1999,6 @@ impl Api for Client where let body = serde_xml_rs::from_str::>(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(FindPetsByStatusResponse::SuccessfulOperation (body) ) @@ -2066,7 +2025,6 @@ impl Api for Client where } } } - async fn find_pets_by_tags( &self, param_tags: &Vec, @@ -2103,7 +2061,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2145,7 +2102,6 @@ impl Api for Client where let body = serde_xml_rs::from_str::>(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(FindPetsByTagsResponse::SuccessfulOperation (body) ) @@ -2172,7 +2128,6 @@ impl Api for Client where } } } - async fn update_pet( &self, param_body: models::Pet, @@ -2218,7 +2173,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2279,7 +2233,6 @@ impl Api for Client where } } } - async fn delete_pet( &self, param_pet_id: i64, @@ -2316,7 +2269,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2385,7 +2337,6 @@ impl Api for Client where } } } - async fn get_pet_by_id( &self, param_pet_id: i64, @@ -2421,7 +2372,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2453,7 +2403,6 @@ impl Api for Client where let body = serde_xml_rs::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(GetPetByIdResponse::SuccessfulOperation (body) ) @@ -2485,7 +2434,6 @@ impl Api for Client where } } } - async fn update_pet_with_form( &self, param_pet_id: i64, @@ -2548,7 +2496,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2599,7 +2546,6 @@ impl Api for Client where } } } - async fn upload_file( &self, param_pet_id: i64, @@ -2693,8 +2639,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {multipart_header} - {e}"))) }); - - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2734,7 +2678,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(UploadFileResponse::SuccessfulOperation (body) ) @@ -2756,7 +2699,6 @@ impl Api for Client where } } } - async fn get_inventory( &self, context: &C) -> Result @@ -2790,7 +2732,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2820,7 +2761,6 @@ impl Api for Client where let body = serde_json::from_str::>(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(GetInventoryResponse::SuccessfulOperation (body) ) @@ -2842,7 +2782,6 @@ impl Api for Client where } } } - async fn place_order( &self, param_body: models::Order, @@ -2888,7 +2827,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -2912,7 +2850,6 @@ impl Api for Client where let body = serde_xml_rs::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(PlaceOrderResponse::SuccessfulOperation (body) ) @@ -2939,7 +2876,6 @@ impl Api for Client where } } } - async fn delete_order( &self, param_order_id: String, @@ -2975,7 +2911,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -3013,7 +2948,6 @@ impl Api for Client where } } } - async fn get_order_by_id( &self, param_order_id: i64, @@ -3049,7 +2983,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -3073,7 +3006,6 @@ impl Api for Client where let body = serde_xml_rs::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(GetOrderByIdResponse::SuccessfulOperation (body) ) @@ -3105,7 +3037,6 @@ impl Api for Client where } } } - async fn create_user( &self, param_body: models::User, @@ -3151,7 +3082,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -3184,7 +3114,6 @@ impl Api for Client where } } } - async fn create_users_with_array_input( &self, param_body: &Vec, @@ -3230,7 +3159,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -3263,7 +3191,6 @@ impl Api for Client where } } } - async fn create_users_with_list_input( &self, param_body: &Vec, @@ -3309,7 +3236,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -3342,7 +3268,6 @@ impl Api for Client where } } } - async fn login_user( &self, param_username: String, @@ -3382,7 +3307,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -3434,7 +3358,6 @@ impl Api for Client where let body = serde_xml_rs::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(LoginUserResponse::SuccessfulOperation { body, @@ -3465,7 +3388,6 @@ impl Api for Client where } } } - async fn logout_user( &self, context: &C) -> Result @@ -3499,7 +3421,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -3532,7 +3453,6 @@ impl Api for Client where } } } - async fn delete_user( &self, param_username: String, @@ -3568,7 +3488,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -3606,7 +3525,6 @@ impl Api for Client where } } } - async fn get_user_by_name( &self, param_username: String, @@ -3642,7 +3560,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -3666,7 +3583,6 @@ impl Api for Client where let body = serde_xml_rs::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(GetUserByNameResponse::SuccessfulOperation (body) ) @@ -3698,7 +3614,6 @@ impl Api for Client where } } } - async fn update_user( &self, param_username: String, @@ -3746,7 +3661,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -3784,5 +3698,4 @@ impl Api for Client where } } } - } diff --git a/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs b/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs index b910c9ae6b2..eceda44ef61 100644 --- a/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs +++ b/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs @@ -26,60 +26,51 @@ pub enum TestSpecialTagsResponse { SuccessfulOperation (models::Client) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum Call123exampleResponse { /// success Success } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum FakeOuterBooleanSerializeResponse { /// Output boolean OutputBoolean (bool) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum FakeOuterCompositeSerializeResponse { /// Output composite OutputComposite (models::OuterComposite) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum FakeOuterNumberSerializeResponse { /// Output number OutputNumber (f64) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum FakeOuterStringSerializeResponse { /// Output string OutputString (String) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum FakeResponseWithNumericalDescriptionResponse { /// 1234 Status200 } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum TestBodyWithQueryParamsResponse { /// Success Success } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum TestClientModelResponse { /// successful operation SuccessfulOperation (models::Client) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum TestEndpointParametersResponse { @@ -89,7 +80,6 @@ pub enum TestEndpointParametersResponse { /// User not found UserNotFound } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum TestEnumParametersResponse { @@ -99,38 +89,32 @@ pub enum TestEnumParametersResponse { /// Not found NotFound } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum TestInlineAdditionalPropertiesResponse { /// successful operation SuccessfulOperation } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum TestJsonFormDataResponse { /// successful operation SuccessfulOperation } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum HyphenParamResponse { /// Success Success } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum TestClassnameResponse { /// successful operation SuccessfulOperation (models::Client) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum AddPetResponse { /// Invalid input InvalidInput } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum FindPetsByStatusResponse { @@ -141,7 +125,6 @@ pub enum FindPetsByStatusResponse { /// Invalid status value InvalidStatusValue } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum FindPetsByTagsResponse { @@ -152,7 +135,6 @@ pub enum FindPetsByTagsResponse { /// Invalid tag value InvalidTagValue } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum UpdatePetResponse { @@ -165,13 +147,11 @@ pub enum UpdatePetResponse { /// Validation exception ValidationException } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum DeletePetResponse { /// Invalid pet value InvalidPetValue } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum GetPetByIdResponse { @@ -185,27 +165,23 @@ pub enum GetPetByIdResponse { /// Pet not found PetNotFound } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum UpdatePetWithFormResponse { /// Invalid input InvalidInput } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum UploadFileResponse { /// successful operation SuccessfulOperation (models::ApiResponse) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum GetInventoryResponse { /// successful operation SuccessfulOperation (std::collections::HashMap) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum PlaceOrderResponse { @@ -216,7 +192,6 @@ pub enum PlaceOrderResponse { /// Invalid Order InvalidOrder } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum DeleteOrderResponse { @@ -226,7 +201,6 @@ pub enum DeleteOrderResponse { /// Order not found OrderNotFound } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum GetOrderByIdResponse { @@ -240,25 +214,21 @@ pub enum GetOrderByIdResponse { /// Order not found OrderNotFound } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum CreateUserResponse { /// successful operation SuccessfulOperation } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum CreateUsersWithArrayInputResponse { /// successful operation SuccessfulOperation } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum CreateUsersWithListInputResponse { /// successful operation SuccessfulOperation } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum LoginUserResponse { @@ -280,13 +250,11 @@ pub enum LoginUserResponse { /// Invalid username/password supplied InvalidUsername } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum LogoutUserResponse { /// successful operation SuccessfulOperation } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum DeleteUserResponse { @@ -296,7 +264,6 @@ pub enum DeleteUserResponse { /// User not found UserNotFound } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum GetUserByNameResponse { @@ -310,7 +277,6 @@ pub enum GetUserByNameResponse { /// User not found UserNotFound } - #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] pub enum UpdateUserResponse { @@ -320,7 +286,6 @@ pub enum UpdateUserResponse { /// User not found UserNotFound } - /// API #[async_trait] #[allow(clippy::too_many_arguments, clippy::ptr_arg)] diff --git a/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs b/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs index a6c6aa055f1..076fa107751 100644 --- a/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs +++ b/samples/server/petstore/rust-server-deprecated/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs @@ -159,7 +159,6 @@ mod paths { } } - pub struct MakeService where T: Api + Clone + Send + 'static, C: Has + Has> + Send + Sync + 'static @@ -211,7 +210,6 @@ impl hyper::service::Service for MakeService where future::ok(service) } } - fn method_not_allowed() -> Result, crate::ServiceError> { Ok( Response::builder().status(StatusCode::METHOD_NOT_ALLOWED) @@ -292,7 +290,6 @@ impl hyper::service::Service<(Request, C)> for Service where let path = paths::GLOBAL_REGEX_SET.matches(uri.path()); match method { - // TestSpecialTags - PATCH /another-fake/dummy hyper::Method::PATCH if path.matched(paths::ID_ANOTHER_FAKE_DUMMY) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -324,8 +321,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter body")) .expect("Unable to create Bad Request response for missing body parameter body")), }; - - let result = api_impl.test_special_tags( param_body, &context @@ -355,7 +350,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -374,7 +368,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // Call123example - GET /fake/operation-with-numeric-id hyper::Method::GET if path.matched(paths::ID_FAKE_OPERATION_WITH_NUMERIC_ID) => { let result = api_impl.call123example( @@ -391,7 +384,6 @@ impl hyper::service::Service<(Request, C)> for Service where Call123exampleResponse::Success => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -404,7 +396,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // FakeOuterBooleanSerialize - POST /fake/outer/boolean hyper::Method::POST if path.matched(paths::ID_FAKE_OUTER_BOOLEAN) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -426,8 +417,6 @@ impl hyper::service::Service<(Request, C)> for Service where } else { None }; - - let result = api_impl.fake_outer_boolean_serialize( param_body, &context @@ -457,7 +446,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -476,7 +464,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // FakeOuterCompositeSerialize - POST /fake/outer/composite hyper::Method::POST if path.matched(paths::ID_FAKE_OUTER_COMPOSITE) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -498,8 +485,6 @@ impl hyper::service::Service<(Request, C)> for Service where } else { None }; - - let result = api_impl.fake_outer_composite_serialize( param_body, &context @@ -529,7 +514,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -548,7 +532,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // FakeOuterNumberSerialize - POST /fake/outer/number hyper::Method::POST if path.matched(paths::ID_FAKE_OUTER_NUMBER) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -570,8 +553,6 @@ impl hyper::service::Service<(Request, C)> for Service where } else { None }; - - let result = api_impl.fake_outer_number_serialize( param_body, &context @@ -601,7 +582,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -620,7 +600,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // FakeOuterStringSerialize - POST /fake/outer/string hyper::Method::POST if path.matched(paths::ID_FAKE_OUTER_STRING) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -642,8 +621,6 @@ impl hyper::service::Service<(Request, C)> for Service where } else { None }; - - let result = api_impl.fake_outer_string_serialize( param_body, &context @@ -673,7 +650,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -692,7 +668,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // FakeResponseWithNumericalDescription - GET /fake/response-with-numerical-description hyper::Method::GET if path.matched(paths::ID_FAKE_RESPONSE_WITH_NUMERICAL_DESCRIPTION) => { let result = api_impl.fake_response_with_numerical_description( @@ -709,7 +684,6 @@ impl hyper::service::Service<(Request, C)> for Service where FakeResponseWithNumericalDescriptionResponse::Status200 => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -722,7 +696,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // TestBodyWithQueryParams - PUT /fake/body-with-query-params hyper::Method::PUT if path.matched(paths::ID_FAKE_BODY_WITH_QUERY_PARAMS) => { // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) @@ -781,8 +754,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter body")) .expect("Unable to create Bad Request response for missing body parameter body")), }; - - let result = api_impl.test_body_with_query_params( param_query, param_body, @@ -805,7 +776,6 @@ impl hyper::service::Service<(Request, C)> for Service where TestBodyWithQueryParamsResponse::Success => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -824,7 +794,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // TestClientModel - PATCH /fake hyper::Method::PATCH if path.matched(paths::ID_FAKE) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -856,8 +825,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter body")) .expect("Unable to create Bad Request response for missing body parameter body")), }; - - let result = api_impl.test_client_model( param_body, &context @@ -887,7 +854,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -906,7 +872,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // TestEndpointParameters - POST /fake hyper::Method::POST if path.matched(paths::ID_FAKE) => { { @@ -954,8 +919,6 @@ impl hyper::service::Service<(Request, C)> for Service where Some("password_example".to_string()); let param_callback = Some("callback_example".to_string()); - - let result = api_impl.test_endpoint_parameters( param_number, param_double, @@ -984,12 +947,10 @@ impl hyper::service::Service<(Request, C)> for Service where TestEndpointParametersResponse::InvalidUsernameSupplied => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, TestEndpointParametersResponse::UserNotFound => { *response.status_mut() = StatusCode::from_u16(404).expect("Unable to turn 404 into a StatusCode"); - }, }, Err(_) => { @@ -1008,7 +969,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // TestEnumParameters - GET /fake hyper::Method::GET if path.matched(paths::ID_FAKE) => { // Header parameters @@ -1120,8 +1080,6 @@ impl hyper::service::Service<(Request, C)> for Service where // Form parameters let param_enum_form_string = None; - - let result = api_impl.test_enum_parameters( param_enum_header_string_array.as_ref(), param_enum_header_string, @@ -1143,12 +1101,10 @@ impl hyper::service::Service<(Request, C)> for Service where TestEnumParametersResponse::InvalidRequest => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, TestEnumParametersResponse::NotFound => { *response.status_mut() = StatusCode::from_u16(404).expect("Unable to turn 404 into a StatusCode"); - }, }, Err(_) => { @@ -1167,7 +1123,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // TestInlineAdditionalProperties - POST /fake/inline-additionalProperties hyper::Method::POST if path.matched(paths::ID_FAKE_INLINE_ADDITIONALPROPERTIES) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -1199,8 +1154,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter param")) .expect("Unable to create Bad Request response for missing body parameter param")), }; - - let result = api_impl.test_inline_additional_properties( param_param, &context @@ -1222,7 +1175,6 @@ impl hyper::service::Service<(Request, C)> for Service where TestInlineAdditionalPropertiesResponse::SuccessfulOperation => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1241,7 +1193,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // TestJsonFormData - GET /fake/jsonFormData hyper::Method::GET if path.matched(paths::ID_FAKE_JSONFORMDATA) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -1255,8 +1206,6 @@ impl hyper::service::Service<(Request, C)> for Service where "param_example".to_string(); let param_param2 = "param2_example".to_string(); - - let result = api_impl.test_json_form_data( param_param, param_param2, @@ -1273,7 +1222,6 @@ impl hyper::service::Service<(Request, C)> for Service where TestJsonFormDataResponse::SuccessfulOperation => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1292,7 +1240,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // HyphenParam - GET /fake/hyphenParam/{hyphen-param} hyper::Method::GET if path.matched(paths::ID_FAKE_HYPHENPARAM_HYPHEN_PARAM) => { // Path parameters @@ -1333,7 +1280,6 @@ impl hyper::service::Service<(Request, C)> for Service where HyphenParamResponse::Success => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -1346,7 +1292,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // TestClassname - PATCH /fake_classname_test hyper::Method::PATCH if path.matched(paths::ID_FAKE_CLASSNAME_TEST) => { { @@ -1388,8 +1333,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter body")) .expect("Unable to create Bad Request response for missing body parameter body")), }; - - let result = api_impl.test_classname( param_body, &context @@ -1419,7 +1362,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -1438,7 +1380,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // AddPet - POST /pet hyper::Method::POST if path.matched(paths::ID_PET) => { { @@ -1500,8 +1441,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter body")) .expect("Unable to create Bad Request response for missing body parameter body")), }; - - let result = api_impl.add_pet( param_body, &context @@ -1523,7 +1462,6 @@ impl hyper::service::Service<(Request, C)> for Service where AddPetResponse::InvalidInput => { *response.status_mut() = StatusCode::from_u16(405).expect("Unable to turn 405 into a StatusCode"); - }, }, Err(_) => { @@ -1542,7 +1480,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // FindPetsByStatus - GET /pet/findByStatus hyper::Method::GET if path.matched(paths::ID_PET_FINDBYSTATUS) => { { @@ -1604,12 +1541,10 @@ impl hyper::service::Service<(Request, C)> for Service where // XML Body let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, FindPetsByStatusResponse::InvalidStatusValue => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, }, Err(_) => { @@ -1622,7 +1557,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // FindPetsByTags - GET /pet/findByTags hyper::Method::GET if path.matched(paths::ID_PET_FINDBYTAGS) => { { @@ -1684,12 +1618,10 @@ impl hyper::service::Service<(Request, C)> for Service where // XML Body let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, FindPetsByTagsResponse::InvalidTagValue => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, }, Err(_) => { @@ -1702,7 +1634,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // UpdatePet - PUT /pet hyper::Method::PUT if path.matched(paths::ID_PET) => { { @@ -1764,8 +1695,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter body")) .expect("Unable to create Bad Request response for missing body parameter body")), }; - - let result = api_impl.update_pet( param_body, &context @@ -1787,17 +1716,14 @@ impl hyper::service::Service<(Request, C)> for Service where UpdatePetResponse::InvalidIDSupplied => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, UpdatePetResponse::PetNotFound => { *response.status_mut() = StatusCode::from_u16(404).expect("Unable to turn 404 into a StatusCode"); - }, UpdatePetResponse::ValidationException => { *response.status_mut() = StatusCode::from_u16(405).expect("Unable to turn 405 into a StatusCode"); - }, }, Err(_) => { @@ -1816,7 +1742,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // DeletePet - DELETE /pet/{petId} hyper::Method::DELETE if path.matched(paths::ID_PET_PETID) => { { @@ -1908,7 +1833,6 @@ impl hyper::service::Service<(Request, C)> for Service where DeletePetResponse::InvalidPetValue => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, }, Err(_) => { @@ -1921,7 +1845,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // GetPetById - GET /pet/{petId} hyper::Method::GET if path.matched(paths::ID_PET_PETID) => { { @@ -1980,17 +1903,14 @@ impl hyper::service::Service<(Request, C)> for Service where // XML Body let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, GetPetByIdResponse::InvalidIDSupplied => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, GetPetByIdResponse::PetNotFound => { *response.status_mut() = StatusCode::from_u16(404).expect("Unable to turn 404 into a StatusCode"); - }, }, Err(_) => { @@ -2003,7 +1923,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // UpdatePetWithForm - POST /pet/{petId} hyper::Method::POST if path.matched(paths::ID_PET_PETID) => { { @@ -2070,8 +1989,6 @@ impl hyper::service::Service<(Request, C)> for Service where Some("name_example".to_string()); let param_status = Some("status_example".to_string()); - - let result = api_impl.update_pet_with_form( param_pet_id, param_name, @@ -2089,7 +2006,6 @@ impl hyper::service::Service<(Request, C)> for Service where UpdatePetWithFormResponse::InvalidInput => { *response.status_mut() = StatusCode::from_u16(405).expect("Unable to turn 405 into a StatusCode"); - }, }, Err(_) => { @@ -2108,7 +2024,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // UploadFile - POST /pet/{petId}/uploadImage hyper::Method::POST if path.matched(paths::ID_PET_PETID_UPLOADIMAGE) => { { @@ -2268,8 +2183,6 @@ impl hyper::service::Service<(Request, C)> for Service where None } }; - - let result = api_impl.upload_file( param_pet_id, param_additional_metadata, @@ -2295,7 +2208,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -2314,7 +2226,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // GetInventory - GET /store/inventory hyper::Method::GET if path.matched(paths::ID_STORE_INVENTORY) => { { @@ -2349,7 +2260,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -2362,7 +2272,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // PlaceOrder - POST /store/order hyper::Method::POST if path.matched(paths::ID_STORE_ORDER) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -2394,8 +2303,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter body")) .expect("Unable to create Bad Request response for missing body parameter body")), }; - - let result = api_impl.place_order( param_body, &context @@ -2425,12 +2332,10 @@ impl hyper::service::Service<(Request, C)> for Service where // XML Body let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, PlaceOrderResponse::InvalidOrder => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, }, Err(_) => { @@ -2449,7 +2354,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // DeleteOrder - DELETE /store/order/{order_id} hyper::Method::DELETE if path.matched(paths::ID_STORE_ORDER_ORDER_ID) => { // Path parameters @@ -2490,12 +2394,10 @@ impl hyper::service::Service<(Request, C)> for Service where DeleteOrderResponse::InvalidIDSupplied => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, DeleteOrderResponse::OrderNotFound => { *response.status_mut() = StatusCode::from_u16(404).expect("Unable to turn 404 into a StatusCode"); - }, }, Err(_) => { @@ -2508,7 +2410,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // GetOrderById - GET /store/order/{order_id} hyper::Method::GET if path.matched(paths::ID_STORE_ORDER_ORDER_ID) => { // Path parameters @@ -2557,17 +2458,14 @@ impl hyper::service::Service<(Request, C)> for Service where // XML Body let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, GetOrderByIdResponse::InvalidIDSupplied => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, GetOrderByIdResponse::OrderNotFound => { *response.status_mut() = StatusCode::from_u16(404).expect("Unable to turn 404 into a StatusCode"); - }, }, Err(_) => { @@ -2580,7 +2478,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // CreateUser - POST /user hyper::Method::POST if path.matched(paths::ID_USER) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -2612,8 +2509,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter body")) .expect("Unable to create Bad Request response for missing body parameter body")), }; - - let result = api_impl.create_user( param_body, &context @@ -2635,7 +2530,6 @@ impl hyper::service::Service<(Request, C)> for Service where CreateUserResponse::SuccessfulOperation => { *response.status_mut() = StatusCode::from_u16(0).expect("Unable to turn 0 into a StatusCode"); - }, }, Err(_) => { @@ -2654,7 +2548,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // CreateUsersWithArrayInput - POST /user/createWithArray hyper::Method::POST if path.matched(paths::ID_USER_CREATEWITHARRAY) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -2686,8 +2579,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter body")) .expect("Unable to create Bad Request response for missing body parameter body")), }; - - let result = api_impl.create_users_with_array_input( param_body.as_ref(), &context @@ -2709,7 +2600,6 @@ impl hyper::service::Service<(Request, C)> for Service where CreateUsersWithArrayInputResponse::SuccessfulOperation => { *response.status_mut() = StatusCode::from_u16(0).expect("Unable to turn 0 into a StatusCode"); - }, }, Err(_) => { @@ -2728,7 +2618,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // CreateUsersWithListInput - POST /user/createWithList hyper::Method::POST if path.matched(paths::ID_USER_CREATEWITHLIST) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -2760,8 +2649,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter body")) .expect("Unable to create Bad Request response for missing body parameter body")), }; - - let result = api_impl.create_users_with_list_input( param_body.as_ref(), &context @@ -2783,7 +2670,6 @@ impl hyper::service::Service<(Request, C)> for Service where CreateUsersWithListInputResponse::SuccessfulOperation => { *response.status_mut() = StatusCode::from_u16(0).expect("Unable to turn 0 into a StatusCode"); - }, }, Err(_) => { @@ -2802,7 +2688,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // LoginUser - GET /user/login hyper::Method::GET if path.matched(paths::ID_USER_LOGIN) => { // Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response) @@ -2918,12 +2803,10 @@ impl hyper::service::Service<(Request, C)> for Service where // XML Body let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, LoginUserResponse::InvalidUsername => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, }, Err(_) => { @@ -2936,7 +2819,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // LogoutUser - GET /user/logout hyper::Method::GET if path.matched(paths::ID_USER_LOGOUT) => { let result = api_impl.logout_user( @@ -2953,7 +2835,6 @@ impl hyper::service::Service<(Request, C)> for Service where LogoutUserResponse::SuccessfulOperation => { *response.status_mut() = StatusCode::from_u16(0).expect("Unable to turn 0 into a StatusCode"); - }, }, Err(_) => { @@ -2966,7 +2847,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // DeleteUser - DELETE /user/{username} hyper::Method::DELETE if path.matched(paths::ID_USER_USERNAME) => { // Path parameters @@ -3007,12 +2887,10 @@ impl hyper::service::Service<(Request, C)> for Service where DeleteUserResponse::InvalidUsernameSupplied => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, DeleteUserResponse::UserNotFound => { *response.status_mut() = StatusCode::from_u16(404).expect("Unable to turn 404 into a StatusCode"); - }, }, Err(_) => { @@ -3025,7 +2903,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // GetUserByName - GET /user/{username} hyper::Method::GET if path.matched(paths::ID_USER_USERNAME) => { // Path parameters @@ -3074,17 +2951,14 @@ impl hyper::service::Service<(Request, C)> for Service where // XML Body let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, GetUserByNameResponse::InvalidUsernameSupplied => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, GetUserByNameResponse::UserNotFound => { *response.status_mut() = StatusCode::from_u16(404).expect("Unable to turn 404 into a StatusCode"); - }, }, Err(_) => { @@ -3097,7 +2971,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // UpdateUser - PUT /user/{username} hyper::Method::PUT if path.matched(paths::ID_USER_USERNAME) => { // Path parameters @@ -3152,8 +3025,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter body")) .expect("Unable to create Bad Request response for missing body parameter body")), }; - - let result = api_impl.update_user( param_username, param_body, @@ -3176,12 +3047,10 @@ impl hyper::service::Service<(Request, C)> for Service where UpdateUserResponse::InvalidUserSupplied => { *response.status_mut() = StatusCode::from_u16(400).expect("Unable to turn 400 into a StatusCode"); - }, UpdateUserResponse::UserNotFound => { *response.status_mut() = StatusCode::from_u16(404).expect("Unable to turn 404 into a StatusCode"); - }, }, Err(_) => { @@ -3200,7 +3069,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - _ if path.matched(paths::ID_ANOTHER_FAKE_DUMMY) => method_not_allowed(), _ if path.matched(paths::ID_FAKE) => method_not_allowed(), _ if path.matched(paths::ID_FAKE_BODY_WITH_QUERY_PARAMS) => method_not_allowed(), @@ -3240,7 +3108,6 @@ impl hyper::service::Service<(Request, C)> for Service where )) } } - /// Request parser for `Api`. pub struct ApiRequestParser; impl RequestParser for ApiRequestParser { diff --git a/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/examples/server/server.rs b/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/examples/server/server.rs index 7cac3452a97..e36bcaabb52 100644 --- a/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/examples/server/server.rs +++ b/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/examples/server/server.rs @@ -118,5 +118,4 @@ impl Api for Server where C: Has + Send + Sync info!("ping_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - } diff --git a/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/client/mod.rs b/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/client/mod.rs index df5337dd74e..7ac43c70387 100644 --- a/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/client/mod.rs +++ b/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/client/mod.rs @@ -415,7 +415,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -466,5 +465,4 @@ impl Api for Client where } } } - } diff --git a/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/lib.rs b/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/lib.rs index 495d022b04a..6a5aca7d194 100644 --- a/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/lib.rs +++ b/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/lib.rs @@ -25,7 +25,6 @@ pub enum PingGetResponse { /// OK OK } - /// API #[async_trait] #[allow(clippy::too_many_arguments, clippy::ptr_arg)] diff --git a/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/server/mod.rs b/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/server/mod.rs index cb5761f4901..3b97db5fb68 100644 --- a/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/server/mod.rs +++ b/samples/server/petstore/rust-server-deprecated/output/ping-bearer-auth/src/server/mod.rs @@ -41,7 +41,6 @@ mod paths { pub(crate) static ID_PING: usize = 0; } - pub struct MakeService where T: Api + Clone + Send + 'static, C: Has + Has> + Send + Sync + 'static @@ -80,7 +79,6 @@ impl hyper::service::Service for MakeService where future::ok(service) } } - fn method_not_allowed() -> Result, crate::ServiceError> { Ok( Response::builder().status(StatusCode::METHOD_NOT_ALLOWED) @@ -147,7 +145,6 @@ impl hyper::service::Service<(Request, C)> for Service where let path = paths::GLOBAL_REGEX_SET.matches(uri.path()); match method { - // PingGet - GET /ping hyper::Method::GET if path.matched(paths::ID_PING) => { { @@ -174,7 +171,6 @@ impl hyper::service::Service<(Request, C)> for Service where PingGetResponse::OK => { *response.status_mut() = StatusCode::from_u16(201).expect("Unable to turn 201 into a StatusCode"); - }, }, Err(_) => { @@ -187,7 +183,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - _ if path.matched(paths::ID_PING) => method_not_allowed(), _ => Ok(Response::builder().status(StatusCode::NOT_FOUND) .body(Body::empty()) @@ -200,7 +195,6 @@ impl hyper::service::Service<(Request, C)> for Service where )) } } - /// Request parser for `Api`. pub struct ApiRequestParser; impl RequestParser for ApiRequestParser { diff --git a/samples/server/petstore/rust-server-deprecated/output/rust-server-test/examples/server/server.rs b/samples/server/petstore/rust-server-deprecated/output/rust-server-test/examples/server/server.rs index 00240b2ecdc..f274b4c1aad 100644 --- a/samples/server/petstore/rust-server-deprecated/output/rust-server-test/examples/server/server.rs +++ b/samples/server/petstore/rust-server-deprecated/output/rust-server-test/examples/server/server.rs @@ -126,7 +126,6 @@ impl Api for Server where C: Has + Send + Sync info!("all_of_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// A dummy endpoint to make the spec valid. async fn dummy_get( &self, @@ -135,7 +134,6 @@ impl Api for Server where C: Has + Send + Sync info!("dummy_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn dummy_put( &self, nested_response: models::DummyPutRequest, @@ -144,7 +142,6 @@ impl Api for Server where C: Has + Send + Sync info!("dummy_put({:?}) - X-Span-ID: {:?}", nested_response, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Get a file async fn file_response_get( &self, @@ -153,7 +150,6 @@ impl Api for Server where C: Has + Send + Sync info!("file_response_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn get_structured_yaml( &self, context: &C) -> Result @@ -161,7 +157,6 @@ impl Api for Server where C: Has + Send + Sync info!("get_structured_yaml() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Test HTML handling async fn html_post( &self, @@ -171,7 +166,6 @@ impl Api for Server where C: Has + Send + Sync info!("html_post(\"{}\") - X-Span-ID: {:?}", body, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - async fn post_yaml( &self, value: String, @@ -180,7 +174,6 @@ impl Api for Server where C: Has + Send + Sync info!("post_yaml(\"{}\") - X-Span-ID: {:?}", value, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Get an arbitrary JSON blob. async fn raw_json_get( &self, @@ -189,7 +182,6 @@ impl Api for Server where C: Has + Send + Sync info!("raw_json_get() - X-Span-ID: {:?}", context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - /// Send an arbitrary JSON blob async fn solo_object_post( &self, @@ -199,5 +191,4 @@ impl Api for Server where C: Has + Send + Sync info!("solo_object_post({:?}) - X-Span-ID: {:?}", value, context.get().0.clone()); Err(ApiError("Api-Error: Operation is NOT implemented".into())) } - } diff --git a/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/client/mod.rs b/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/client/mod.rs index 555113f36ca..5cabbfd3ab8 100644 --- a/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/client/mod.rs +++ b/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/client/mod.rs @@ -423,7 +423,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -445,7 +444,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(AllOfGetResponse::OK (body) ) @@ -467,7 +465,6 @@ impl Api for Client where } } } - async fn dummy_get( &self, context: &C) -> Result @@ -501,7 +498,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -534,7 +530,6 @@ impl Api for Client where } } } - async fn dummy_put( &self, param_nested_response: models::DummyPutRequest, @@ -580,7 +575,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -613,7 +607,6 @@ impl Api for Client where } } } - async fn file_response_get( &self, context: &C) -> Result @@ -647,7 +640,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -669,7 +661,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(FileResponseGetResponse::Success (body) ) @@ -691,7 +682,6 @@ impl Api for Client where } } } - async fn get_structured_yaml( &self, context: &C) -> Result @@ -725,7 +715,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -746,7 +735,6 @@ impl Api for Client where .map_err(|e| ApiError(format!("Response was not valid UTF8: {e}")))?; let body = body.to_string(); - Ok(GetStructuredYamlResponse::OK (body) ) @@ -768,7 +756,6 @@ impl Api for Client where } } } - async fn html_post( &self, param_body: String, @@ -814,7 +801,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -835,7 +821,6 @@ impl Api for Client where .map_err(|e| ApiError(format!("Response was not valid UTF8: {e}")))?; let body = body.to_string(); - Ok(HtmlPostResponse::Success (body) ) @@ -857,7 +842,6 @@ impl Api for Client where } } } - async fn post_yaml( &self, param_value: String, @@ -903,7 +887,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -936,7 +919,6 @@ impl Api for Client where } } } - async fn raw_json_get( &self, context: &C) -> Result @@ -970,7 +952,6 @@ impl Api for Client where Ok(req) => req, Err(e) => return Err(ApiError(format!("Unable to create request: {e}"))) }; - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -992,7 +973,6 @@ impl Api for Client where let body = serde_json::from_str::(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {e}")))?; - Ok(RawJsonGetResponse::Success (body) ) @@ -1014,7 +994,6 @@ impl Api for Client where } } } - async fn solo_object_post( &self, param_value: serde_json::Value, @@ -1060,7 +1039,6 @@ impl Api for Client where Ok(h) => h, Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}"))) }); - let header = HeaderValue::from_str(Has::::get(context).0.as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { Ok(h) => h, @@ -1093,5 +1071,4 @@ impl Api for Client where } } } - } diff --git a/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/lib.rs b/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/lib.rs index 3adabd148d8..4d1dc3f567b 100644 --- a/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/lib.rs +++ b/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/lib.rs @@ -26,59 +26,50 @@ pub enum AllOfGetResponse { OK (models::AllOfObject) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum DummyGetResponse { /// Success Success } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum DummyPutResponse { /// Success Success } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum FileResponseGetResponse { /// Success Success (swagger::ByteArray) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum GetStructuredYamlResponse { /// OK OK (String) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum HtmlPostResponse { /// Success Success (String) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum PostYamlResponse { /// OK OK } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum RawJsonGetResponse { /// Success Success (serde_json::Value) } - #[derive(Debug, PartialEq, Serialize, Deserialize)] pub enum SoloObjectPostResponse { /// OK OK } - /// API #[async_trait] #[allow(clippy::too_many_arguments, clippy::ptr_arg)] diff --git a/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/server/mod.rs b/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/server/mod.rs index 4c288f04851..e3637b564c7 100644 --- a/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/server/mod.rs +++ b/samples/server/petstore/rust-server-deprecated/output/rust-server-test/src/server/mod.rs @@ -63,7 +63,6 @@ mod paths { pub(crate) static ID_SOLO_OBJECT: usize = 7; } - pub struct MakeService where T: Api + Clone + Send + 'static, C: Has + Send + Sync + 'static @@ -102,7 +101,6 @@ impl hyper::service::Service for MakeService where future::ok(service) } } - fn method_not_allowed() -> Result, crate::ServiceError> { Ok( Response::builder().status(StatusCode::METHOD_NOT_ALLOWED) @@ -169,7 +167,6 @@ impl hyper::service::Service<(Request, C)> for Service where let path = paths::GLOBAL_REGEX_SET.matches(uri.path()); match method { - // AllOfGet - GET /allOf hyper::Method::GET if path.matched(paths::ID_ALLOF) => { let result = api_impl.all_of_get( @@ -194,7 +191,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -207,7 +203,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // DummyGet - GET /dummy hyper::Method::GET if path.matched(paths::ID_DUMMY) => { let result = api_impl.dummy_get( @@ -224,7 +219,6 @@ impl hyper::service::Service<(Request, C)> for Service where DummyGetResponse::Success => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -237,7 +231,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // DummyPut - PUT /dummy hyper::Method::PUT if path.matched(paths::ID_DUMMY) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -269,8 +262,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter nested_response")) .expect("Unable to create Bad Request response for missing body parameter nested_response")), }; - - let result = api_impl.dummy_put( param_nested_response, &context @@ -292,7 +283,6 @@ impl hyper::service::Service<(Request, C)> for Service where DummyPutResponse::Success => { *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); - }, }, Err(_) => { @@ -311,7 +301,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // FileResponseGet - GET /file_response hyper::Method::GET if path.matched(paths::ID_FILE_RESPONSE) => { let result = api_impl.file_response_get( @@ -336,7 +325,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -349,7 +337,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // GetStructuredYaml - GET /get-structured-yaml hyper::Method::GET if path.matched(paths::ID_GET_STRUCTURED_YAML) => { let result = api_impl.get_structured_yaml( @@ -374,7 +361,6 @@ impl hyper::service::Service<(Request, C)> for Service where // Plain text Body let body = body; *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -387,7 +373,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // HtmlPost - POST /html hyper::Method::POST if path.matched(paths::ID_HTML) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -414,8 +399,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter body")) .expect("Unable to create Bad Request response for missing body parameter body")), }; - - let result = api_impl.html_post( param_body, &context @@ -439,7 +422,6 @@ impl hyper::service::Service<(Request, C)> for Service where // Plain text Body let body = body; *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -458,7 +440,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // PostYaml - POST /post-yaml hyper::Method::POST if path.matched(paths::ID_POST_YAML) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -485,8 +466,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter value")) .expect("Unable to create Bad Request response for missing body parameter value")), }; - - let result = api_impl.post_yaml( param_value, &context @@ -502,7 +481,6 @@ impl hyper::service::Service<(Request, C)> for Service where PostYamlResponse::OK => { *response.status_mut() = StatusCode::from_u16(204).expect("Unable to turn 204 into a StatusCode"); - }, }, Err(_) => { @@ -521,7 +499,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - // RawJsonGet - GET /raw_json hyper::Method::GET if path.matched(paths::ID_RAW_JSON) => { let result = api_impl.raw_json_get( @@ -546,7 +523,6 @@ impl hyper::service::Service<(Request, C)> for Service where // JSON Body let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); *response.body_mut() = Body::from(body); - }, }, Err(_) => { @@ -559,7 +535,6 @@ impl hyper::service::Service<(Request, C)> for Service where Ok(response) }, - // SoloObjectPost - POST /solo-object hyper::Method::POST if path.matched(paths::ID_SOLO_OBJECT) => { // Handle body parameters (note that non-required body parameters will ignore garbage @@ -591,8 +566,6 @@ impl hyper::service::Service<(Request, C)> for Service where .body(Body::from("Missing required body parameter value")) .expect("Unable to create Bad Request response for missing body parameter value")), }; - - let result = api_impl.solo_object_post( param_value, &context @@ -614,7 +587,6 @@ impl hyper::service::Service<(Request, C)> for Service where SoloObjectPostResponse::OK => { *response.status_mut() = StatusCode::from_u16(204).expect("Unable to turn 204 into a StatusCode"); - }, }, Err(_) => { @@ -633,7 +605,6 @@ impl hyper::service::Service<(Request, C)> for Service where .expect("Unable to create Bad Request response due to unable to read body")), } }, - _ if path.matched(paths::ID_ALLOF) => method_not_allowed(), _ if path.matched(paths::ID_DUMMY) => method_not_allowed(), _ if path.matched(paths::ID_FILE_RESPONSE) => method_not_allowed(), @@ -653,7 +624,6 @@ impl hyper::service::Service<(Request, C)> for Service where )) } } - /// Request parser for `Api`. pub struct ApiRequestParser; impl RequestParser for ApiRequestParser {