Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<Part>{{/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<Part>{{/reactive}}{{^reactive}}{{#isArray}}List<MultipartFile>{{/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}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString> + 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,
Expand All @@ -135,7 +134,6 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString> + 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<swagger::ByteArray>,
Expand All @@ -145,5 +143,4 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString> + 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()))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ impl<S, C> Api<C> for Client<S, C> where
});
body_parts.push(part);
}

if let Some(optional_binary_field) = param_optional_binary_field {
let part = Node::Part(Part {
headers: {
Expand All @@ -457,7 +456,6 @@ impl<S, C> Api<C> for Client<S, C> where
});
body_parts.push(part);
}

{
let part = Node::Part(Part {
headers: {
Expand All @@ -479,7 +477,6 @@ impl<S, C> Api<C> for Client<S, C> 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(
Expand All @@ -491,7 +488,6 @@ impl<S, C> Api<C> for Client<S, C> where

// Add the message body to the request object.
*request.body_mut() = Body::from(body);

let header = HeaderValue::from_str(Has::<XSpanIdString>::get(context).0.as_str());
request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header {
Ok(h) => h,
Expand Down Expand Up @@ -524,7 +520,6 @@ impl<S, C> Api<C> for Client<S, C> where
}
}
}

async fn multipart_request_post(
&self,
param_string_field: String,
Expand Down Expand Up @@ -643,8 +638,6 @@ impl<S, C> Api<C> for Client<S, C> where
Ok(h) => h,
Err(e) => return Err(ApiError(format!("Unable to create header: {multipart_header} - {e}")))
});


let header = HeaderValue::from_str(Has::<XSpanIdString>::get(context).0.as_str());
request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header {
Ok(h) => h,
Expand Down Expand Up @@ -677,7 +670,6 @@ impl<S, C> Api<C> for Client<S, C> where
}
}
}

async fn multiple_identical_mime_types_post(
&self,
param_binary1: Option<swagger::ByteArray>,
Expand Down Expand Up @@ -730,7 +722,6 @@ impl<S, C> Api<C> for Client<S, C> where
});
body_parts.push(part);
}

if let Some(binary2) = param_binary2 {
let part = Node::Part(Part {
headers: {
Expand All @@ -752,7 +743,6 @@ impl<S, C> Api<C> for Client<S, C> 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(
Expand All @@ -764,7 +754,6 @@ impl<S, C> Api<C> for Client<S, C> where

// Add the message body to the request object.
*request.body_mut() = Body::from(body);

let header = HeaderValue::from_str(Has::<XSpanIdString>::get(context).0.as_str());
request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header {
Ok(h) => h,
Expand Down Expand Up @@ -797,5 +786,4 @@ impl<S, C> Api<C> for Client<S, C> where
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ mod paths {
pub(crate) static ID_MULTIPLE_IDENTICAL_MIME_TYPES: usize = 2;
}


pub struct MakeService<T, C> where
T: Api<C> + Clone + Send + 'static,
C: Has<XSpanIdString> + Send + Sync + 'static
Expand Down Expand Up @@ -104,7 +103,6 @@ impl<T, C, Target> hyper::service::Service<Target> for MakeService<T, C> where
future::ok(service)
}
}

fn method_not_allowed() -> Result<Response<Body>, crate::ServiceError> {
Ok(
Response::builder().status(StatusCode::METHOD_NOT_ALLOWED)
Expand Down Expand Up @@ -185,7 +183,6 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> 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
Expand Down Expand Up @@ -272,8 +269,6 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> 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,
Expand All @@ -297,7 +292,6 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
MultipartRelatedRequestPostResponse::OK
=> {
*response.status_mut() = StatusCode::from_u16(201).expect("Unable to turn 201 into a StatusCode");

},
},
Err(_) => {
Expand All @@ -316,7 +310,6 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> 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
Expand Down Expand Up @@ -465,8 +458,6 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> 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,
Expand All @@ -485,7 +476,6 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
MultipartRequestPostResponse::OK
=> {
*response.status_mut() = StatusCode::from_u16(201).expect("Unable to turn 201 into a StatusCode");

},
},
Err(_) => {
Expand All @@ -504,7 +494,6 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> 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
Expand Down Expand Up @@ -567,8 +556,6 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
}

// Check that the required multipart chunks are present.


let result = api_impl.multiple_identical_mime_types_post(
param_binary1,
param_binary2,
Expand All @@ -591,7 +578,6 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
MultipleIdenticalMimeTypesPostResponse::OK
=> {
*response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

},
},
Err(_) => {
Expand All @@ -610,7 +596,6 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> 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(),
Expand All @@ -626,7 +611,6 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
))
}
}

/// Request parser for `Api`.
pub struct ApiRequestParser;
impl<T> RequestParser<T> for ApiRequestParser {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,4 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString> + Send + Sync
info!("op_get({:?}) - X-Span-ID: {:?}", op_get_request, context.get().0.clone());
Err(ApiError("Api-Error: Operation is NOT implemented".into()))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ impl<S, C> Api<C> for Client<S, C> where
Ok(h) => h,
Err(e) => return Err(ApiError(format!("Unable to create header: {header} - {e}")))
});

let header = HeaderValue::from_str(Has::<XSpanIdString>::get(context).0.as_str());
request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header {
Ok(h) => h,
Expand Down Expand Up @@ -460,5 +459,4 @@ impl<S, C> Api<C> for Client<S, C> where
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ pub enum OpGetResponse {
/// OK
OK
}

/// API
#[async_trait]
#[allow(clippy::too_many_arguments, clippy::ptr_arg)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ mod paths {
pub(crate) static ID_OP: usize = 0;
}


pub struct MakeService<T, C> where
T: Api<C> + Clone + Send + 'static,
C: Has<XSpanIdString> + Send + Sync + 'static
Expand Down Expand Up @@ -80,7 +79,6 @@ impl<T, C, Target> hyper::service::Service<Target> for MakeService<T, C> where
future::ok(service)
}
}

fn method_not_allowed() -> Result<Response<Body>, crate::ServiceError> {
Ok(
Response::builder().status(StatusCode::METHOD_NOT_ALLOWED)
Expand Down Expand Up @@ -147,7 +145,6 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> 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
Expand Down Expand Up @@ -179,8 +176,6 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> 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
Expand All @@ -202,7 +197,6 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
OpGetResponse::OK
=> {
*response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode");

},
},
Err(_) => {
Expand All @@ -221,7 +215,6 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> 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())
Expand All @@ -234,7 +227,6 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
))
}
}

/// Request parser for `Api`.
pub struct ApiRequestParser;
impl<T> RequestParser<T> for ApiRequestParser {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ impl<C> CallbackApi<C> for Server<C> where C: Has<XSpanIdString> + 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,
Expand All @@ -121,5 +120,4 @@ impl<C> CallbackApi<C> for Server<C> where C: Has<XSpanIdString> + Send + Sync
info!("callback_callback_post() - X-Span-ID: {:?}", context.get().0.clone());
Err(ApiError("Api-Error: Operation is NOT implemented".into()))
}

}
Loading
Loading