Map type date to correct rust type NaiveDate (#17095)

* Fix clippy errors (rustc 1.73.0)

* Add feature docker-in-docker

* Fix mapping of "date"

See issue #9769

The type
  type: string
  format: date
was mapped to DateTime<Utc> which violates the OpenAPI spec

see https://swagger.io/docs/specification/data-models/data-types/
This commit is contained in:
Markus Lenger 2023-11-18 03:33:45 +01:00 committed by GitHub
parent 5c69284928
commit 1ce95ff41e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 207 additions and 202 deletions

View File

@ -9,7 +9,12 @@
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
},
"ghcr.io/snebjorn/devcontainer-feature/chromium:latest": {}
"ghcr.io/snebjorn/devcontainer-feature/chromium:latest": {},
"docker-in-docker": {
"version": "latest",
"moby": true,
"dockerDashComposeVersion": "v1"
}
},
// Configure tool-specific properties.
"customizations": {
@ -44,4 +49,4 @@
// "postCreateCommand": "mvn clean package -DskipTests",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
}

View File

@ -193,7 +193,7 @@ public class RustServerCodegen extends AbstractRustCodegen implements CodegenCon
typeMapping.put("ByteArray", bytesType);
typeMapping.put("binary", bytesType);
typeMapping.put("boolean", "bool");
typeMapping.put("date", "chrono::DateTime::<chrono::Utc>");
typeMapping.put("date", "chrono::naive::NaiveDate");
typeMapping.put("DateTime", "chrono::DateTime::<chrono::Utc>");
typeMapping.put("password", "String");
typeMapping.put("File", bytesType);

View File

@ -310,7 +310,7 @@
match auth_data {
{{#authMethods}}
{{#isBasicBasic}}
&AuthData::Basic(ref basic_header) => {
AuthData::Basic(basic_header) => {
let auth = swagger::auth::Header(basic_header.clone());
let header = match HeaderValue::from_str(&format!("{}", auth)) {
Ok(h) => h,
@ -322,7 +322,7 @@
},
{{/isBasicBasic}}
{{#isBasicBearer}}
&AuthData::Bearer(ref bearer_header) => {
AuthData::Bearer(bearer_header) => {
let auth = swagger::auth::Header(bearer_header.clone());
let header = match HeaderValue::from_str(&format!("{}", auth)) {
Ok(h) => h,
@ -335,7 +335,7 @@
{{/isBasicBearer}}
{{#isOAuth}}
{{^isBasicBearer}}
&AuthData::Bearer(ref bearer_header) => {
AuthData::Bearer(bearer_header) => {
let auth = swagger::auth::Header(bearer_header.clone());
let header = match HeaderValue::from_str(&format!("{}", auth)) {
Ok(h) => h,

View File

@ -389,7 +389,7 @@ impl std::string::ToString for {{{classname}}} {
{{/required}}
{{^required}}
self.{{{name}}}.as_ref().map(|{{{name}}}| {
vec![
[
"{{{baseName}}}".to_string(),
{{^isArray}}
{{#isNullable}}

View File

@ -574,27 +574,27 @@
{{#vendorExtensions}}
{{#x-produces-xml}}
{{^x-has-namespace}}
let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
let body_content = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
{{/x-has-namespace}}
{{#x-has-namespace}}
let mut namespaces = std::collections::BTreeMap::new();
// An empty string is used to indicate a global namespace in xmltree.
namespaces.insert("".to_string(), {{{dataType}}}::NAMESPACE.to_string());
let body = serde_xml_rs::to_string_with_namespaces(&body, namespaces).expect("impossible to fail to serialize");
let body_content = serde_xml_rs::to_string_with_namespaces(&body, namespaces).expect("impossible to fail to serialize");
{{/x-has-namespace}}
{{/x-produces-xml}}
{{#x-produces-json}}
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
{{/x-produces-json}}
{{#x-produces-bytes}}
let body = body.0;
let body_content = body.0;
{{/x-produces-bytes}}
{{#x-produces-plain-text}}
let body = body;
let body_content = body;
{{/x-produces-plain-text}}
{{/vendorExtensions}}
*response.body_mut() = Body::from(body);
*response.body_mut() = Body::from(body_content);
{{/dataType}}
},
{{/responses}}

View File

@ -180,7 +180,7 @@ impl std::string::ToString for MultipartRequestObjectField {
self.field_b.as_ref().map(|field_b| {
vec![
[
"field_b".to_string(),
field_b.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
].join(",")

View File

@ -1165,7 +1165,7 @@ impl<S, C> Api<C> for Client<S, C> where
// Currently only authentication with Basic and Bearer are supported
#[allow(clippy::single_match, clippy::match_single_binding)]
match auth_data {
&AuthData::Bearer(ref bearer_header) => {
AuthData::Bearer(bearer_header) => {
let auth = swagger::auth::Header(bearer_header.clone());
let header = match HeaderValue::from_str(&format!("{}", auth)) {
Ok(h) => h,
@ -1489,7 +1489,7 @@ impl<S, C> Api<C> for Client<S, C> where
// Currently only authentication with Basic and Bearer are supported
#[allow(clippy::single_match, clippy::match_single_binding)]
match auth_data {
&AuthData::Bearer(ref bearer_header) => {
AuthData::Bearer(bearer_header) => {
let auth = swagger::auth::Header(bearer_header.clone());
let header = match HeaderValue::from_str(&format!("{}", auth)) {
Ok(h) => h,

View File

@ -295,7 +295,7 @@ impl std::string::ToString for AnotherXmlObject {
let params: Vec<Option<String>> = vec![
self.inner_string.as_ref().map(|inner_string| {
vec![
[
"inner_string".to_string(),
inner_string.to_string(),
].join(",")
@ -815,7 +815,7 @@ impl std::string::ToString for DuplicateXmlObject {
let params: Vec<Option<String>> = vec![
self.inner_string.as_ref().map(|inner_string| {
vec![
[
"inner_string".to_string(),
inner_string.to_string(),
].join(",")
@ -1233,7 +1233,7 @@ impl std::string::ToString for MultigetGet201Response {
let params: Vec<Option<String>> = vec![
self.foo.as_ref().map(|foo| {
vec![
[
"foo".to_string(),
foo.to_string(),
].join(",")
@ -1574,7 +1574,7 @@ impl std::string::ToString for NullableTest {
self.nullable_with_null_default.as_ref().map(|nullable_with_null_default| {
vec![
[
"nullableWithNullDefault".to_string(),
nullable_with_null_default.as_ref().map_or("null".to_string(), |x| x.to_string()),
].join(",")
@ -1582,7 +1582,7 @@ impl std::string::ToString for NullableTest {
self.nullable_with_present_default.as_ref().map(|nullable_with_present_default| {
vec![
[
"nullableWithPresentDefault".to_string(),
nullable_with_present_default.as_ref().map_or("null".to_string(), |x| x.to_string()),
].join(",")
@ -1590,7 +1590,7 @@ impl std::string::ToString for NullableTest {
self.nullable_with_no_default.as_ref().map(|nullable_with_no_default| {
vec![
[
"nullableWithNoDefault".to_string(),
nullable_with_no_default.as_ref().map_or("null".to_string(), |x| x.to_string()),
].join(",")
@ -1598,7 +1598,7 @@ impl std::string::ToString for NullableTest {
self.nullable_array.as_ref().map(|nullable_array| {
vec![
[
"nullableArray".to_string(),
nullable_array.as_ref().map_or("null".to_string(), |x| x.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
].join(",")
@ -1750,7 +1750,7 @@ impl std::string::ToString for ObjectHeader {
self.optional_object_header.as_ref().map(|optional_object_header| {
vec![
[
"optionalObjectHeader".to_string(),
optional_object_header.to_string(),
].join(",")
@ -1895,7 +1895,7 @@ impl std::string::ToString for ObjectParam {
self.optional_param.as_ref().map(|optional_param| {
vec![
[
"optionalParam".to_string(),
optional_param.to_string(),
].join(",")
@ -2189,7 +2189,7 @@ impl std::string::ToString for ObjectWithArrayOfObjects {
let params: Vec<Option<String>> = vec![
self.object_array.as_ref().map(|object_array| {
vec![
[
"objectArray".to_string(),
object_array.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
].join(",")
@ -2963,7 +2963,7 @@ impl std::string::ToString for XmlObject {
let params: Vec<Option<String>> = vec![
self.inner_string.as_ref().map(|inner_string| {
vec![
[
"innerString".to_string(),
inner_string.to_string(),
].join(",")
@ -2971,7 +2971,7 @@ impl std::string::ToString for XmlObject {
self.other_inner_rename.as_ref().map(|other_inner_rename| {
vec![
[
"other_inner_rename".to_string(),
other_inner_rename.to_string(),
].join(",")

View File

@ -257,8 +257,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for ANY_OF_GET_SUCCESS"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
AnyOfGetResponse::AlternateSuccess
(body)
@ -268,8 +268,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for ANY_OF_GET_ALTERNATE_SUCCESS"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
AnyOfGetResponse::AnyOfSuccess
(body)
@ -279,8 +279,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for ANY_OF_GET_ANY_OF_SUCCESS"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -569,8 +569,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/merge-patch+json")
.expect("Unable to create Content-Type header for MERGE_PATCH_JSON_GET_MERGE"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -605,8 +605,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for MULTIGET_GET_JSON_RSP"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
MultigetGetResponse::XMLRsp
(body)
@ -616,8 +616,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/xml")
.expect("Unable to create Content-Type header for MULTIGET_GET_XML_RSP"));
let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
MultigetGetResponse::OctetRsp
(body)
@ -627,8 +627,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/octet-stream")
.expect("Unable to create Content-Type header for MULTIGET_GET_OCTET_RSP"));
let body = body.0;
*response.body_mut() = Body::from(body);
let body_content = body.0;
*response.body_mut() = Body::from(body_content);
},
MultigetGetResponse::StringRsp
(body)
@ -638,8 +638,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("text/plain")
.expect("Unable to create Content-Type header for MULTIGET_GET_STRING_RSP"));
let body = body;
*response.body_mut() = Body::from(body);
let body_content = body;
*response.body_mut() = Body::from(body_content);
},
MultigetGetResponse::DuplicateResponseLongText
(body)
@ -649,8 +649,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
MultigetGetResponse::DuplicateResponseLongText_2
(body)
@ -660,8 +660,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT_2"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
MultigetGetResponse::DuplicateResponseLongText_3
(body)
@ -671,8 +671,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT_3"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -766,8 +766,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for ONE_OF_GET_SUCCESS"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -888,8 +888,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for PARAMGET_GET_JSON_RSP"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -1145,8 +1145,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for RESPONSES_WITH_HEADERS_GET_SUCCESS"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
ResponsesWithHeadersGetResponse::PreconditionFailed
{
@ -1221,8 +1221,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for RFC7807_GET_OK"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
Rfc7807GetResponse::NotFound
(body)
@ -1232,8 +1232,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/problem+json")
.expect("Unable to create Content-Type header for RFC7807_GET_NOT_FOUND"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
Rfc7807GetResponse::NotAcceptable
(body)
@ -1243,8 +1243,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/problem+xml")
.expect("Unable to create Content-Type header for RFC7807_GET_NOT_ACCEPTABLE"));
let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -1342,8 +1342,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for UUID_GET_DUPLICATE_RESPONSE_LONG_TEXT"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -1477,8 +1477,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
// An empty string is used to indicate a global namespace in xmltree.
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);
let body_content = serde_xml_rs::to_string_with_namespaces(&body, namespaces).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
XmlOtherPostResponse::BadRequest
=> {
@ -1821,8 +1821,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for GET_REPO_INFO_OK"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {

View File

@ -12,7 +12,7 @@ Name | Type | Description | Notes
**string** | **String** | | [optional] [default to None]
**byte** | [***swagger::ByteArray**](ByteArray.md) | |
**binary** | [***swagger::ByteArray**](file.md) | | [optional] [default to None]
**date** | [***chrono::DateTime::<chrono::Utc>**](date.md) | |
**date** | [***chrono::naive::NaiveDate**](date.md) | |
**date_time** | [**chrono::DateTime::<chrono::Utc>**](DateTime.md) | | [optional] [default to None]
**uuid** | [***uuid::Uuid**](UUID.md) | | [optional] [default to None]
**password** | **String** | |

View File

@ -311,7 +311,7 @@ Name | Type | Description | Notes
**float** | **f32**| None |
**string** | **String**| None |
**binary** | **swagger::ByteArray**| None |
**date** | **chrono::DateTime::<chrono::Utc>**| None |
**date** | **chrono::naive::NaiveDate**| None |
**date_time** | **chrono::DateTime::<chrono::Utc>**| None |
**password** | **String**| None |
**callback** | **String**| None |

View File

@ -241,7 +241,7 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString> + Send + Sync
float: Option<f32>,
string: Option<String>,
binary: Option<swagger::ByteArray>,
date: Option<chrono::DateTime::<chrono::Utc>>,
date: Option<chrono::naive::NaiveDate>,
date_time: Option<chrono::DateTime::<chrono::Utc>>,
password: Option<String>,
callback: Option<String>,

View File

@ -1250,7 +1250,7 @@ impl<S, C> Api<C> for Client<S, C> where
param_float: Option<f32>,
param_string: Option<String>,
param_binary: Option<swagger::ByteArray>,
param_date: Option<chrono::DateTime::<chrono::Utc>>,
param_date: Option<chrono::naive::NaiveDate>,
param_date_time: Option<chrono::DateTime::<chrono::Utc>>,
param_password: Option<String>,
param_callback: Option<String>,
@ -1320,7 +1320,7 @@ impl<S, C> Api<C> for Client<S, C> where
// Currently only authentication with Basic and Bearer are supported
#[allow(clippy::single_match, clippy::match_single_binding)]
match auth_data {
&AuthData::Basic(ref basic_header) => {
AuthData::Basic(basic_header) => {
let auth = swagger::auth::Header(basic_header.clone());
let header = match HeaderValue::from_str(&format!("{}", auth)) {
Ok(h) => h,
@ -1824,7 +1824,7 @@ impl<S, C> Api<C> for Client<S, C> where
// Currently only authentication with Basic and Bearer are supported
#[allow(clippy::single_match, clippy::match_single_binding)]
match auth_data {
&AuthData::Bearer(ref bearer_header) => {
AuthData::Bearer(bearer_header) => {
let auth = swagger::auth::Header(bearer_header.clone());
let header = match HeaderValue::from_str(&format!("{}", auth)) {
Ok(h) => h,
@ -1914,7 +1914,7 @@ impl<S, C> Api<C> for Client<S, C> where
// Currently only authentication with Basic and Bearer are supported
#[allow(clippy::single_match, clippy::match_single_binding)]
match auth_data {
&AuthData::Bearer(ref bearer_header) => {
AuthData::Bearer(bearer_header) => {
let auth = swagger::auth::Header(bearer_header.clone());
let header = match HeaderValue::from_str(&format!("{}", auth)) {
Ok(h) => h,
@ -2022,7 +2022,7 @@ impl<S, C> Api<C> for Client<S, C> where
// Currently only authentication with Basic and Bearer are supported
#[allow(clippy::single_match, clippy::match_single_binding)]
match auth_data {
&AuthData::Bearer(ref bearer_header) => {
AuthData::Bearer(bearer_header) => {
let auth = swagger::auth::Header(bearer_header.clone());
let header = match HeaderValue::from_str(&format!("{}", auth)) {
Ok(h) => h,
@ -2127,7 +2127,7 @@ impl<S, C> Api<C> for Client<S, C> where
// Currently only authentication with Basic and Bearer are supported
#[allow(clippy::single_match, clippy::match_single_binding)]
match auth_data {
&AuthData::Bearer(ref bearer_header) => {
AuthData::Bearer(bearer_header) => {
let auth = swagger::auth::Header(bearer_header.clone());
let header = match HeaderValue::from_str(&format!("{}", auth)) {
Ok(h) => h,
@ -2337,7 +2337,7 @@ impl<S, C> Api<C> for Client<S, C> where
// Currently only authentication with Basic and Bearer are supported
#[allow(clippy::single_match, clippy::match_single_binding)]
match auth_data {
&AuthData::Bearer(ref bearer_header) => {
AuthData::Bearer(bearer_header) => {
let auth = swagger::auth::Header(bearer_header.clone());
let header = match HeaderValue::from_str(&format!("{}", auth)) {
Ok(h) => h,
@ -2450,7 +2450,7 @@ impl<S, C> Api<C> for Client<S, C> where
// Currently only authentication with Basic and Bearer are supported
#[allow(clippy::single_match, clippy::match_single_binding)]
match auth_data {
&AuthData::Bearer(ref bearer_header) => {
AuthData::Bearer(bearer_header) => {
let auth = swagger::auth::Header(bearer_header.clone());
let header = match HeaderValue::from_str(&format!("{}", auth)) {
Ok(h) => h,
@ -2596,7 +2596,7 @@ impl<S, C> Api<C> for Client<S, C> where
// Currently only authentication with Basic and Bearer are supported
#[allow(clippy::single_match, clippy::match_single_binding)]
match auth_data {
&AuthData::Bearer(ref bearer_header) => {
AuthData::Bearer(bearer_header) => {
let auth = swagger::auth::Header(bearer_header.clone());
let header = match HeaderValue::from_str(&format!("{}", auth)) {
Ok(h) => h,

View File

@ -387,7 +387,7 @@ pub trait Api<C: Send + Sync> {
float: Option<f32>,
string: Option<String>,
binary: Option<swagger::ByteArray>,
date: Option<chrono::DateTime::<chrono::Utc>>,
date: Option<chrono::naive::NaiveDate>,
date_time: Option<chrono::DateTime::<chrono::Utc>>,
password: Option<String>,
callback: Option<String>,
@ -624,7 +624,7 @@ pub trait ApiNoContext<C: Send + Sync> {
float: Option<f32>,
string: Option<String>,
binary: Option<swagger::ByteArray>,
date: Option<chrono::DateTime::<chrono::Utc>>,
date: Option<chrono::naive::NaiveDate>,
date_time: Option<chrono::DateTime::<chrono::Utc>>,
password: Option<String>,
callback: Option<String>,
@ -915,7 +915,7 @@ impl<T: Api<C> + Send + Sync, C: Clone + Send + Sync> ApiNoContext<C> for Contex
float: Option<f32>,
string: Option<String>,
binary: Option<swagger::ByteArray>,
date: Option<chrono::DateTime::<chrono::Utc>>,
date: Option<chrono::naive::NaiveDate>,
date_time: Option<chrono::DateTime::<chrono::Utc>>,
password: Option<String>,
callback: Option<String>,

View File

@ -178,7 +178,7 @@ impl std::string::ToString for Animal {
self.color.as_ref().map(|color| {
vec![
[
"color".to_string(),
color.to_string(),
].join(",")
@ -463,7 +463,7 @@ impl std::string::ToString for ApiResponse {
let params: Vec<Option<String>> = vec![
self.code.as_ref().map(|code| {
vec![
[
"code".to_string(),
code.to_string(),
].join(",")
@ -471,7 +471,7 @@ impl std::string::ToString for ApiResponse {
self.r#type.as_ref().map(|r#type| {
vec![
[
"type".to_string(),
r#type.to_string(),
].join(",")
@ -479,7 +479,7 @@ impl std::string::ToString for ApiResponse {
self.message.as_ref().map(|message| {
vec![
[
"message".to_string(),
message.to_string(),
].join(",")
@ -746,7 +746,7 @@ impl std::string::ToString for ArrayOfNumberOnly {
let params: Vec<Option<String>> = vec![
self.array_number.as_ref().map(|array_number| {
vec![
[
"ArrayNumber".to_string(),
array_number.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
].join(",")
@ -894,7 +894,7 @@ impl std::string::ToString for ArrayTest {
let params: Vec<Option<String>> = vec![
self.array_of_string.as_ref().map(|array_of_string| {
vec![
[
"array_of_string".to_string(),
array_of_string.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
].join(",")
@ -906,7 +906,7 @@ impl std::string::ToString for ArrayTest {
self.array_of_enum.as_ref().map(|array_of_enum| {
vec![
[
"array_of_enum".to_string(),
array_of_enum.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
].join(",")
@ -1073,7 +1073,7 @@ impl std::string::ToString for Capitalization {
let params: Vec<Option<String>> = vec![
self.small_camel.as_ref().map(|small_camel| {
vec![
[
"smallCamel".to_string(),
small_camel.to_string(),
].join(",")
@ -1081,7 +1081,7 @@ impl std::string::ToString for Capitalization {
self.capital_camel.as_ref().map(|capital_camel| {
vec![
[
"CapitalCamel".to_string(),
capital_camel.to_string(),
].join(",")
@ -1089,7 +1089,7 @@ impl std::string::ToString for Capitalization {
self.small_snake.as_ref().map(|small_snake| {
vec![
[
"small_Snake".to_string(),
small_snake.to_string(),
].join(",")
@ -1097,7 +1097,7 @@ impl std::string::ToString for Capitalization {
self.capital_snake.as_ref().map(|capital_snake| {
vec![
[
"Capital_Snake".to_string(),
capital_snake.to_string(),
].join(",")
@ -1105,7 +1105,7 @@ impl std::string::ToString for Capitalization {
self.sca_eth_flow_points.as_ref().map(|sca_eth_flow_points| {
vec![
[
"SCA_ETH_Flow_Points".to_string(),
sca_eth_flow_points.to_string(),
].join(",")
@ -1113,7 +1113,7 @@ impl std::string::ToString for Capitalization {
self.att_name.as_ref().map(|att_name| {
vec![
[
"ATT_NAME".to_string(),
att_name.to_string(),
].join(",")
@ -1279,7 +1279,7 @@ impl std::string::ToString for Cat {
self.color.as_ref().map(|color| {
vec![
[
"color".to_string(),
color.to_string(),
].join(",")
@ -1287,7 +1287,7 @@ impl std::string::ToString for Cat {
self.declawed.as_ref().map(|declawed| {
vec![
[
"declawed".to_string(),
declawed.to_string(),
].join(",")
@ -1434,7 +1434,7 @@ impl std::string::ToString for Category {
let params: Vec<Option<String>> = vec![
self.id.as_ref().map(|id| {
vec![
[
"id".to_string(),
id.to_string(),
].join(",")
@ -1442,7 +1442,7 @@ impl std::string::ToString for Category {
self.name.as_ref().map(|name| {
vec![
[
"name".to_string(),
name.to_string(),
].join(",")
@ -1580,7 +1580,7 @@ impl std::string::ToString for ClassModel {
let params: Vec<Option<String>> = vec![
self._class.as_ref().map(|_class| {
vec![
[
"_class".to_string(),
_class.to_string(),
].join(",")
@ -1713,7 +1713,7 @@ impl std::string::ToString for Client {
let params: Vec<Option<String>> = vec![
self.client.as_ref().map(|client| {
vec![
[
"client".to_string(),
client.to_string(),
].join(",")
@ -1859,7 +1859,7 @@ impl std::string::ToString for Dog {
self.color.as_ref().map(|color| {
vec![
[
"color".to_string(),
color.to_string(),
].join(",")
@ -1867,7 +1867,7 @@ impl std::string::ToString for Dog {
self.breed.as_ref().map(|breed| {
vec![
[
"breed".to_string(),
breed.to_string(),
].join(",")
@ -2009,7 +2009,7 @@ impl std::string::ToString for DollarSpecialLeftSquareBracketModelPeriodNameRigh
let params: Vec<Option<String>> = vec![
self.dollar_special_left_square_bracket_property_period_name_right_square_bracket.as_ref().map(|dollar_special_left_square_bracket_property_period_name_right_square_bracket| {
vec![
[
"$special[property.name]".to_string(),
dollar_special_left_square_bracket_property_period_name_right_square_bracket.to_string(),
].join(",")
@ -2155,7 +2155,7 @@ impl std::string::ToString for EnumArrays {
let params: Vec<Option<String>> = vec![
self.just_symbol.as_ref().map(|just_symbol| {
vec![
[
"just_symbol".to_string(),
just_symbol.to_string(),
].join(",")
@ -2163,7 +2163,7 @@ impl std::string::ToString for EnumArrays {
self.array_enum.as_ref().map(|array_enum| {
vec![
[
"array_enum".to_string(),
array_enum.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
].join(",")
@ -2375,7 +2375,7 @@ impl std::string::ToString for EnumTest {
let params: Vec<Option<String>> = vec![
self.enum_string.as_ref().map(|enum_string| {
vec![
[
"enum_string".to_string(),
enum_string.to_string(),
].join(",")
@ -2387,7 +2387,7 @@ impl std::string::ToString for EnumTest {
self.enum_integer.as_ref().map(|enum_integer| {
vec![
[
"enum_integer".to_string(),
enum_integer.to_string(),
].join(",")
@ -2395,7 +2395,7 @@ impl std::string::ToString for EnumTest {
self.enum_number.as_ref().map(|enum_number| {
vec![
[
"enum_number".to_string(),
enum_number.to_string(),
].join(",")
@ -2578,7 +2578,7 @@ pub struct FormatTest {
pub binary: Option<swagger::ByteArray>,
#[serde(rename = "date")]
pub date: chrono::DateTime::<chrono::Utc>,
pub date: chrono::naive::NaiveDate,
#[serde(rename = "dateTime")]
#[serde(skip_serializing_if="Option::is_none")]
@ -2613,7 +2613,7 @@ fn validate_byte_formattest_byte(
impl FormatTest {
#[allow(clippy::new_without_default)]
pub fn new(number: f64, byte: swagger::ByteArray, date: chrono::DateTime::<chrono::Utc>, password: String, ) -> FormatTest {
pub fn new(number: f64, byte: swagger::ByteArray, date: chrono::naive::NaiveDate, password: String, ) -> FormatTest {
FormatTest {
integer: None,
int32: None,
@ -2640,7 +2640,7 @@ impl std::string::ToString for FormatTest {
let params: Vec<Option<String>> = vec![
self.integer.as_ref().map(|integer| {
vec![
[
"integer".to_string(),
integer.to_string(),
].join(",")
@ -2648,7 +2648,7 @@ impl std::string::ToString for FormatTest {
self.int32.as_ref().map(|int32| {
vec![
[
"int32".to_string(),
int32.to_string(),
].join(",")
@ -2656,7 +2656,7 @@ impl std::string::ToString for FormatTest {
self.int64.as_ref().map(|int64| {
vec![
[
"int64".to_string(),
int64.to_string(),
].join(",")
@ -2668,7 +2668,7 @@ impl std::string::ToString for FormatTest {
self.float.as_ref().map(|float| {
vec![
[
"float".to_string(),
float.to_string(),
].join(",")
@ -2676,7 +2676,7 @@ impl std::string::ToString for FormatTest {
self.double.as_ref().map(|double| {
vec![
[
"double".to_string(),
double.to_string(),
].join(",")
@ -2684,7 +2684,7 @@ impl std::string::ToString for FormatTest {
self.string.as_ref().map(|string| {
vec![
[
"string".to_string(),
string.to_string(),
].join(",")
@ -2732,7 +2732,7 @@ impl std::str::FromStr for FormatTest {
pub string: Vec<String>,
pub byte: Vec<swagger::ByteArray>,
pub binary: Vec<swagger::ByteArray>,
pub date: Vec<chrono::DateTime::<chrono::Utc>>,
pub date: Vec<chrono::naive::NaiveDate>,
pub date_time: Vec<chrono::DateTime::<chrono::Utc>>,
pub uuid: Vec<uuid::Uuid>,
pub password: Vec<String>,
@ -2770,7 +2770,7 @@ impl std::str::FromStr for FormatTest {
"byte" => return std::result::Result::Err("Parsing binary data in this style is not supported in FormatTest".to_string()),
"binary" => return std::result::Result::Err("Parsing binary data in this style is not supported in FormatTest".to_string()),
#[allow(clippy::redundant_clone)]
"date" => intermediate_rep.date.push(<chrono::DateTime::<chrono::Utc> as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
"date" => intermediate_rep.date.push(<chrono::naive::NaiveDate as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
#[allow(clippy::redundant_clone)]
"dateTime" => intermediate_rep.date_time.push(<chrono::DateTime::<chrono::Utc> as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
#[allow(clippy::redundant_clone)]
@ -2884,7 +2884,7 @@ impl std::string::ToString for HasOnlyReadOnly {
let params: Vec<Option<String>> = vec![
self.bar.as_ref().map(|bar| {
vec![
[
"bar".to_string(),
bar.to_string(),
].join(",")
@ -2892,7 +2892,7 @@ impl std::string::ToString for HasOnlyReadOnly {
self.foo.as_ref().map(|foo| {
vec![
[
"foo".to_string(),
foo.to_string(),
].join(",")
@ -3029,7 +3029,7 @@ impl std::string::ToString for List {
let params: Vec<Option<String>> = vec![
self.param_123_list.as_ref().map(|param_123_list| {
vec![
[
"123-list".to_string(),
param_123_list.to_string(),
].join(",")
@ -3468,7 +3468,7 @@ impl std::string::ToString for Model200Response {
let params: Vec<Option<String>> = vec![
self.name.as_ref().map(|name| {
vec![
[
"name".to_string(),
name.to_string(),
].join(",")
@ -3476,7 +3476,7 @@ impl std::string::ToString for Model200Response {
self.class.as_ref().map(|class| {
vec![
[
"class".to_string(),
class.to_string(),
].join(",")
@ -3633,7 +3633,7 @@ impl std::string::ToString for Name {
self.snake_case.as_ref().map(|snake_case| {
vec![
[
"snake_case".to_string(),
snake_case.to_string(),
].join(",")
@ -3641,7 +3641,7 @@ impl std::string::ToString for Name {
self.property.as_ref().map(|property| {
vec![
[
"property".to_string(),
property.to_string(),
].join(",")
@ -3649,7 +3649,7 @@ impl std::string::ToString for Name {
self.param_123_number.as_ref().map(|param_123_number| {
vec![
[
"123Number".to_string(),
param_123_number.to_string(),
].join(",")
@ -3794,7 +3794,7 @@ impl std::string::ToString for NumberOnly {
let params: Vec<Option<String>> = vec![
self.just_number.as_ref().map(|just_number| {
vec![
[
"JustNumber".to_string(),
just_number.to_string(),
].join(",")
@ -4141,7 +4141,7 @@ impl std::string::ToString for Order {
let params: Vec<Option<String>> = vec![
self.id.as_ref().map(|id| {
vec![
[
"id".to_string(),
id.to_string(),
].join(",")
@ -4149,7 +4149,7 @@ impl std::string::ToString for Order {
self.pet_id.as_ref().map(|pet_id| {
vec![
[
"petId".to_string(),
pet_id.to_string(),
].join(",")
@ -4157,7 +4157,7 @@ impl std::string::ToString for Order {
self.quantity.as_ref().map(|quantity| {
vec![
[
"quantity".to_string(),
quantity.to_string(),
].join(",")
@ -4167,7 +4167,7 @@ impl std::string::ToString for Order {
self.status.as_ref().map(|status| {
vec![
[
"status".to_string(),
status.to_string(),
].join(",")
@ -4175,7 +4175,7 @@ impl std::string::ToString for Order {
self.complete.as_ref().map(|complete| {
vec![
[
"complete".to_string(),
complete.to_string(),
].join(",")
@ -4377,7 +4377,7 @@ impl std::string::ToString for OuterComposite {
let params: Vec<Option<String>> = vec![
self.my_number.as_ref().map(|my_number| {
vec![
[
"my_number".to_string(),
my_number.to_string(),
].join(",")
@ -4385,7 +4385,7 @@ impl std::string::ToString for OuterComposite {
self.my_string.as_ref().map(|my_string| {
vec![
[
"my_string".to_string(),
my_string.to_string(),
].join(",")
@ -4393,7 +4393,7 @@ impl std::string::ToString for OuterComposite {
self.my_boolean.as_ref().map(|my_boolean| {
vec![
[
"my_boolean".to_string(),
my_boolean.to_string(),
].join(",")
@ -4699,7 +4699,7 @@ impl std::string::ToString for Pet {
let params: Vec<Option<String>> = vec![
self.id.as_ref().map(|id| {
vec![
[
"id".to_string(),
id.to_string(),
].join(",")
@ -4719,7 +4719,7 @@ impl std::string::ToString for Pet {
self.status.as_ref().map(|status| {
vec![
[
"status".to_string(),
status.to_string(),
].join(",")
@ -4875,7 +4875,7 @@ impl std::string::ToString for ReadOnlyFirst {
let params: Vec<Option<String>> = vec![
self.bar.as_ref().map(|bar| {
vec![
[
"bar".to_string(),
bar.to_string(),
].join(",")
@ -4883,7 +4883,7 @@ impl std::string::ToString for ReadOnlyFirst {
self.baz.as_ref().map(|baz| {
vec![
[
"baz".to_string(),
baz.to_string(),
].join(",")
@ -5022,7 +5022,7 @@ impl std::string::ToString for Return {
let params: Vec<Option<String>> = vec![
self.r#return.as_ref().map(|r#return| {
vec![
[
"return".to_string(),
r#return.to_string(),
].join(",")
@ -5161,7 +5161,7 @@ impl std::string::ToString for Tag {
let params: Vec<Option<String>> = vec![
self.id.as_ref().map(|id| {
vec![
[
"id".to_string(),
id.to_string(),
].join(",")
@ -5169,7 +5169,7 @@ impl std::string::ToString for Tag {
self.name.as_ref().map(|name| {
vec![
[
"name".to_string(),
name.to_string(),
].join(",")
@ -5343,7 +5343,7 @@ impl std::string::ToString for User {
let params: Vec<Option<String>> = vec![
self.id.as_ref().map(|id| {
vec![
[
"id".to_string(),
id.to_string(),
].join(",")
@ -5351,7 +5351,7 @@ impl std::string::ToString for User {
self.username.as_ref().map(|username| {
vec![
[
"username".to_string(),
username.to_string(),
].join(",")
@ -5359,7 +5359,7 @@ impl std::string::ToString for User {
self.first_name.as_ref().map(|first_name| {
vec![
[
"firstName".to_string(),
first_name.to_string(),
].join(",")
@ -5367,7 +5367,7 @@ impl std::string::ToString for User {
self.last_name.as_ref().map(|last_name| {
vec![
[
"lastName".to_string(),
last_name.to_string(),
].join(",")
@ -5375,7 +5375,7 @@ impl std::string::ToString for User {
self.email.as_ref().map(|email| {
vec![
[
"email".to_string(),
email.to_string(),
].join(",")
@ -5383,7 +5383,7 @@ impl std::string::ToString for User {
self.password.as_ref().map(|password| {
vec![
[
"password".to_string(),
password.to_string(),
].join(",")
@ -5391,7 +5391,7 @@ impl std::string::ToString for User {
self.phone.as_ref().map(|phone| {
vec![
[
"phone".to_string(),
phone.to_string(),
].join(",")
@ -5399,7 +5399,7 @@ impl std::string::ToString for User {
self.user_status.as_ref().map(|user_status| {
vec![
[
"userStatus".to_string(),
user_status.to_string(),
].join(",")

View File

@ -316,8 +316,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for TEST_SPECIAL_TAGS_SUCCESSFUL_OPERATION"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -415,8 +415,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("*/*")
.expect("Unable to create Content-Type header for FAKE_OUTER_BOOLEAN_SERIALIZE_OUTPUT_BOOLEAN"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -485,8 +485,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("*/*")
.expect("Unable to create Content-Type header for FAKE_OUTER_COMPOSITE_SERIALIZE_OUTPUT_COMPOSITE"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -555,8 +555,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("*/*")
.expect("Unable to create Content-Type header for FAKE_OUTER_NUMBER_SERIALIZE_OUTPUT_NUMBER"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -625,8 +625,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("*/*")
.expect("Unable to create Content-Type header for FAKE_OUTER_STRING_SERIALIZE_OUTPUT_STRING"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -888,8 +888,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for TEST_CLIENT_MODEL_SUCCESSFUL_OPERATION"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -1302,8 +1302,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for TEST_CLASSNAME_SUCCESSFUL_OPERATION"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -1588,8 +1588,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/xml")
.expect("Unable to create Content-Type header for FIND_PETS_BY_STATUS_SUCCESSFUL_OPERATION"));
let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
FindPetsByStatusResponse::InvalidStatusValue
=> {
@ -1665,8 +1665,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/xml")
.expect("Unable to create Content-Type header for FIND_PETS_BY_TAGS_SUCCESSFUL_OPERATION"));
let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
FindPetsByTagsResponse::InvalidTagValue
=> {
@ -1739,8 +1739,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/xml")
.expect("Unable to create Content-Type header for GET_PET_BY_ID_SUCCESSFUL_OPERATION"));
let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
GetPetByIdResponse::InvalidIDSupplied
=> {
@ -2115,8 +2115,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for UPLOAD_FILE_SUCCESSFUL_OPERATION"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -2224,8 +2224,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for GET_INVENTORY_SUCCESSFUL_OPERATION"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -2284,8 +2284,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/xml")
.expect("Unable to create Content-Type header for GET_ORDER_BY_ID_SUCCESSFUL_OPERATION"));
let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
GetOrderByIdResponse::InvalidIDSupplied
=> {
@ -2366,8 +2366,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/xml")
.expect("Unable to create Content-Type header for PLACE_ORDER_SUCCESSFUL_OPERATION"));
let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
PlaceOrderResponse::InvalidOrder
=> {
@ -2712,8 +2712,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/xml")
.expect("Unable to create Content-Type header for GET_USER_BY_NAME_SUCCESSFUL_OPERATION"));
let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
GetUserByNameResponse::InvalidUsernameSupplied
=> {
@ -2845,8 +2845,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/xml")
.expect("Unable to create Content-Type header for LOGIN_USER_SUCCESSFUL_OPERATION"));
let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
LoginUserResponse::InvalidUsername
=> {

View File

@ -424,7 +424,7 @@ impl<S, C> Api<C> for Client<S, C> where
// Currently only authentication with Basic and Bearer are supported
#[allow(clippy::single_match, clippy::match_single_binding)]
match auth_data {
&AuthData::Bearer(ref bearer_header) => {
AuthData::Bearer(bearer_header) => {
let auth = swagger::auth::Header(bearer_header.clone());
let header = match HeaderValue::from_str(&format!("{}", auth)) {
Ok(h) => h,

View File

@ -39,7 +39,7 @@ impl std::string::ToString for ANullableContainer {
let params: Vec<Option<String>> = vec![
self.nullable_thing.as_ref().map(|nullable_thing| {
vec![
[
"NullableThing".to_string(),
nullable_thing.as_ref().map_or("null".to_string(), |x| x.to_string()),
].join(",")
@ -225,7 +225,7 @@ impl std::string::ToString for AllOfObject {
let params: Vec<Option<String>> = vec![
self.sample_property.as_ref().map(|sample_property| {
vec![
[
"sampleProperty".to_string(),
sample_property.to_string(),
].join(",")
@ -233,7 +233,7 @@ impl std::string::ToString for AllOfObject {
self.sample_base_property.as_ref().map(|sample_base_property| {
vec![
[
"sampleBaseProperty".to_string(),
sample_base_property.to_string(),
].join(",")
@ -361,7 +361,7 @@ impl std::string::ToString for BaseAllOf {
let params: Vec<Option<String>> = vec![
self.sample_base_property.as_ref().map(|sample_base_property| {
vec![
[
"sampleBaseProperty".to_string(),
sample_base_property.to_string(),
].join(",")
@ -493,7 +493,7 @@ impl std::string::ToString for DummyPutRequest {
self.password.as_ref().map(|password| {
vec![
[
"password".to_string(),
password.to_string(),
].join(",")
@ -623,7 +623,7 @@ impl std::string::ToString for GetYamlResponse {
let params: Vec<Option<String>> = vec![
self.value.as_ref().map(|value| {
vec![
[
"value".to_string(),
value.to_string(),
].join(",")
@ -874,7 +874,7 @@ impl std::string::ToString for ObjectOfObjectsInner {
self.optional_thing.as_ref().map(|optional_thing| {
vec![
[
"optional_thing".to_string(),
optional_thing.to_string(),
].join(",")

View File

@ -182,8 +182,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("*/*")
.expect("Unable to create Content-Type header for ALL_OF_GET_OK"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -320,8 +320,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/json")
.expect("Unable to create Content-Type header for FILE_RESPONSE_GET_SUCCESS"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -356,8 +356,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("application/yaml")
.expect("Unable to create Content-Type header for GET_STRUCTURED_YAML_OK"));
let body = body;
*response.body_mut() = Body::from(body);
let body_content = body;
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -418,8 +418,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("text/html")
.expect("Unable to create Content-Type header for HTML_POST_SUCCESS"));
let body = body;
*response.body_mut() = Body::from(body);
let body_content = body;
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {
@ -521,8 +521,8 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
CONTENT_TYPE,
HeaderValue::from_str("*/*")
.expect("Unable to create Content-Type header for RAW_JSON_GET_SUCCESS"));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body);
let body_content = serde_json::to_string(&body).expect("impossible to fail to serialize");
*response.body_mut() = Body::from(body_content);
},
},
Err(_) => {