From d0d0252fffb2dbf7e7275b7bcf22dbcd736798f0 Mon Sep 17 00:00:00 2001 From: Richard Whitehouse Date: Sun, 29 Mar 2020 20:04:56 +0100 Subject: [PATCH] [Rust Server] Don't use structs in models (#5557) * [Rust Server] Don't use structs in models This avoids namespace clashes between model names and types used. * [Rust Server] Handle models named after results * [Rust Server] Add test for result models * Update samples --- .../codegen/languages/RustServerCodegen.java | 4 +- .../rust-server/client-imports.mustache | 2 - .../example-server-common.mustache | 1 - .../main/resources/rust-server/lib.mustache | 3 - .../resources/rust-server/models.mustache | 127 +- .../rust-server/server-imports.mustache | 2 - .../rust-server/server-operation.mustache | 4 +- .../resources/3_0/rust-server/openapi-v3.yaml | 8 + .../test/resources/3_0/rust-server/piers.yaml | 74 ++ .../multipart-v3/examples/server/server.rs | 1 - .../output/multipart-v3/src/client/mod.rs | 2 - .../output/multipart-v3/src/lib.rs | 3 - .../output/multipart-v3/src/models.rs | 127 +- .../output/multipart-v3/src/server/mod.rs | 2 - .../no-example-v3/examples/server/server.rs | 1 - .../output/no-example-v3/src/client/mod.rs | 2 - .../output/no-example-v3/src/lib.rs | 3 - .../output/no-example-v3/src/models.rs | 37 +- .../output/no-example-v3/src/server/mod.rs | 2 - .../rust-server/output/openapi-v3/README.md | 4 + .../output/openapi-v3/api/openapi.yaml | 8 + .../rust-server/output/openapi-v3/docs/Err.md | 9 + .../output/openapi-v3/docs/Error.md | 9 + .../rust-server/output/openapi-v3/docs/Ok.md | 9 + .../output/openapi-v3/docs/Result.md | 9 + .../openapi-v3/examples/client/server.rs | 1 - .../openapi-v3/examples/server/server.rs | 1 - .../output/openapi-v3/src/client/callbacks.rs | 2 - .../output/openapi-v3/src/client/mod.rs | 2 - .../rust-server/output/openapi-v3/src/lib.rs | 3 - .../output/openapi-v3/src/models.rs | 709 ++++++----- .../output/openapi-v3/src/server/callbacks.rs | 2 - .../output/openapi-v3/src/server/mod.rs | 6 +- .../output/ops-v3/examples/server/server.rs | 1 - .../output/ops-v3/src/client/mod.rs | 2 - .../rust-server/output/ops-v3/src/lib.rs | 3 - .../rust-server/output/ops-v3/src/models.rs | 11 +- .../output/ops-v3/src/server/mod.rs | 2 - .../docs/AdditionalPropertiesClass.md | 4 +- .../docs/MapTest.md | 6 +- ...dPropertiesAndAdditionalPropertiesClass.md | 2 +- .../docs/store_api.md | 4 +- .../examples/server/server.rs | 3 +- .../src/client/mod.rs | 6 +- .../src/lib.rs | 11 +- .../src/models.rs | 1061 ++++++++--------- .../src/server/mod.rs | 18 +- .../examples/server/server.rs | 1 - .../output/rust-server-test/src/client/mod.rs | 2 - .../output/rust-server-test/src/lib.rs | 3 - .../output/rust-server-test/src/models.rs | 223 ++-- .../output/rust-server-test/src/server/mod.rs | 2 - 52 files changed, 1367 insertions(+), 1177 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/rust-server/piers.yaml create mode 100644 samples/server/petstore/rust-server/output/openapi-v3/docs/Err.md create mode 100644 samples/server/petstore/rust-server/output/openapi-v3/docs/Error.md create mode 100644 samples/server/petstore/rust-server/output/openapi-v3/docs/Ok.md create mode 100644 samples/server/petstore/rust-server/output/openapi-v3/docs/Result.md diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java index 9fac5ab0cad..667bf144e98 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java @@ -207,7 +207,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { typeMapping.put("File", bytesType); typeMapping.put("file", bytesType); typeMapping.put("array", "Vec"); - typeMapping.put("map", "HashMap"); + typeMapping.put("map", "std::collections::HashMap"); typeMapping.put("object", "serde_json::Value"); importMapping = new HashMap(); @@ -1503,7 +1503,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { type = toModelName(cm.additionalPropertiesType); } - cm.dataType = "HashMap"; + cm.dataType = "std::collections::HashMap"; } } else if (cm.dataType != null) { // We need to hack about with single-parameter models to diff --git a/modules/openapi-generator/src/main/resources/rust-server/client-imports.mustache b/modules/openapi-generator/src/main/resources/rust-server/client-imports.mustache index e42746eb0bb..87baaaaffb6 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/client-imports.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/client-imports.mustache @@ -8,8 +8,6 @@ use hyper::{Body, Uri, Response}; use hyper_openssl::HttpsConnector; use serde_json; use std::borrow::Cow; -#[allow(unused_imports)] -use std::collections::{HashMap, BTreeMap}; use std::io::{Read, Error, ErrorKind}; use std::error; use std::fmt; diff --git a/modules/openapi-generator/src/main/resources/rust-server/example-server-common.mustache b/modules/openapi-generator/src/main/resources/rust-server/example-server-common.mustache index 19f104593a6..840b3ade9c1 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/example-server-common.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/example-server-common.mustache @@ -13,7 +13,6 @@ use futures::{future, Future, Stream}; use hyper::server::conn::Http; use hyper::service::MakeService as _; use openssl::ssl::SslAcceptorBuilder; -use std::collections::HashMap; use std::marker::PhantomData; use std::net::SocketAddr; use std::sync::{Arc, Mutex}; diff --git a/modules/openapi-generator/src/main/resources/rust-server/lib.mustache b/modules/openapi-generator/src/main/resources/rust-server/lib.mustache index cf2ada5d089..9597f32b3d1 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/lib.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/lib.mustache @@ -88,9 +88,6 @@ use hyper::header::HeaderValue; use futures::Stream; use std::io::Error; -#[allow(unused_imports)] -use std::collections::HashMap; - #[deprecated(note = "Import swagger-rs directly")] pub use swagger::{ApiError, ContextWrapper}; #[deprecated(note = "Import futures directly")] diff --git a/modules/openapi-generator/src/main/resources/rust-server/models.mustache b/modules/openapi-generator/src/main/resources/rust-server/models.mustache index 5b3668a04b1..8422b82add3 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/models.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/models.mustache @@ -1,25 +1,8 @@ -#![allow(unused_imports, unused_qualifications)] +#![allow(unused_qualifications)] -{{#usesXml}} -use serde_xml_rs; -{{/usesXml}} -use serde::ser::Serializer; - -{{#usesXml}} -use std::collections::{HashMap, BTreeMap}; -{{/usesXml}} -{{^usesXml}} -use std::collections::HashMap; -{{/usesXml}} use models; -use swagger; -use hyper::header::HeaderValue; -use std::string::ParseError; -{{#apiUsesUuid}} -use uuid; -{{/apiUsesUuid}} -use std::str::FromStr; -use header::IntoHeaderValue; +use header; +{{! Don't "use" structs here - they can conflict with the names of models, and mean that the code won't compile }} {{#models}}{{#model}} {{#description}}/// {{{description}}} @@ -36,25 +19,25 @@ pub enum {{{classname}}} { {{#allowableValues}}{{#enumVars}} {{{name}}},{{/enumVars}}{{/allowableValues}} } -impl ::std::fmt::Display for {{{classname}}} { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { +impl std::fmt::Display for {{{classname}}} { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match *self { {{#allowableValues}}{{#enumVars}} {{{classname}}}::{{{name}}} => write!(f, "{}", {{{value}}}),{{/enumVars}}{{/allowableValues}} } } } -impl ::std::str::FromStr for {{{classname}}} { +impl std::str::FromStr for {{{classname}}} { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { match s { {{#allowableValues}} {{#enumVars}} - {{{value}}} => Ok({{{classname}}}::{{{name}}}), + {{{value}}} => std::result::Result::Ok({{{classname}}}::{{{name}}}), {{/enumVars}} {{/allowableValues}} - _ => Err(format!("Value not valid: {}", s)), + _ => std::result::Result::Err(format!("Value not valid: {}", s)), } } } @@ -73,7 +56,7 @@ impl ::std::str::FromStr for {{{classname}}} { {{/xmlName}} pub struct {{{classname}}}({{{dataType}}}); -impl ::std::convert::From<{{{dataType}}}> for {{{classname}}} { +impl std::convert::From<{{{dataType}}}> for {{{classname}}} { fn from(x: {{{dataType}}}) -> Self { {{{classname}}}(x) } @@ -81,27 +64,27 @@ impl ::std::convert::From<{{{dataType}}}> for {{{classname}}} { {{#vendorExtensions.isString}} impl std::str::FromStr for {{{classname}}} { - type Err = ParseError; - fn from_str(x: &str) -> Result { - Ok({{{classname}}}(x.to_string())) + type Err = std::string::ParseError; + fn from_str(x: &str) -> std::result::Result { + std::result::Result::Ok({{{classname}}}(x.to_string())) } } {{/vendorExtensions.isString}} -impl ::std::convert::From<{{{classname}}}> for {{{dataType}}} { +impl std::convert::From<{{{classname}}}> for {{{dataType}}} { fn from(x: {{{classname}}}) -> Self { x.0 } } -impl ::std::ops::Deref for {{{classname}}} { +impl std::ops::Deref for {{{classname}}} { type Target = {{{dataType}}}; fn deref(&self) -> &{{{dataType}}} { &self.0 } } -impl ::std::ops::DerefMut for {{{classname}}} { +impl std::ops::DerefMut for {{{classname}}} { fn deref_mut(&mut self) -> &mut {{{dataType}}} { &mut self.0 } @@ -124,32 +107,32 @@ impl ::std::string::ToString for {{{classname}}} { impl ::std::str::FromStr for {{{classname}}} { type Err = &'static str; - fn from_str(s: &str) -> Result { - Err("Parsing additionalProperties for {{{classname}}} is not supported") + fn from_str(s: &str) -> std::result::Result { + std::result::Result::Err("Parsing additionalProperties for {{{classname}}} is not supported") } } {{/additionalPropertiesType}} {{/dataType}} {{^dataType}} -// Methods for converting between IntoHeaderValue<{{{classname}}}> and HeaderValue +// Methods for converting between header::IntoHeaderValue<{{{classname}}}> and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<{{{classname}}}>) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue<{{{classname}}}>) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue<{{{classname}}}> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue({{{classname}}}::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue<{{{classname}}}> { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(<{{{classname}}} as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) } } {{#arrayModelType}}{{#vendorExtensions}}{{#itemXmlName}}// Utility function for wrapping list elements when serializing xml #[allow(non_snake_case)] -fn wrap_in_{{{itemXmlName}}}(item: &Vec<{{{arrayModelType}}}>, serializer: S) -> Result +fn wrap_in_{{{itemXmlName}}}(item: &Vec<{{{arrayModelType}}}>, serializer: S) -> std::result::Result where - S: Serializer, + S: serde::ser::Serializer, { serde_xml_rs::wrap_primitives(item, serializer, "{{{itemXmlName}}}") } @@ -158,59 +141,59 @@ where #[cfg_attr(feature = "conversion", derive(LabelledGeneric))] pub struct {{{classname}}}({{#vendorExtensions}}{{#itemXmlName}}#[serde(serialize_with = "wrap_in_{{{itemXmlName}}}")]{{/itemXmlName}}{{/vendorExtensions}}Vec<{{{arrayModelType}}}>); -impl ::std::convert::From> for {{{classname}}} { +impl std::convert::From> for {{{classname}}} { fn from(x: Vec<{{{arrayModelType}}}>) -> Self { {{{classname}}}(x) } } -impl ::std::convert::From<{{{classname}}}> for Vec<{{{arrayModelType}}}> { +impl std::convert::From<{{{classname}}}> for Vec<{{{arrayModelType}}}> { fn from(x: {{{classname}}}) -> Self { x.0 } } -impl ::std::iter::FromIterator<{{{arrayModelType}}}> for {{{classname}}} { +impl std::iter::FromIterator<{{{arrayModelType}}}> for {{{classname}}} { fn from_iter>(u: U) -> Self { {{{classname}}}(Vec::<{{{arrayModelType}}}>::from_iter(u)) } } -impl ::std::iter::IntoIterator for {{{classname}}} { +impl std::iter::IntoIterator for {{{classname}}} { type Item = {{{arrayModelType}}}; - type IntoIter = ::std::vec::IntoIter<{{{arrayModelType}}}>; + type IntoIter = std::vec::IntoIter<{{{arrayModelType}}}>; fn into_iter(self) -> Self::IntoIter { self.0.into_iter() } } -impl<'a> ::std::iter::IntoIterator for &'a {{{classname}}} { +impl<'a> std::iter::IntoIterator for &'a {{{classname}}} { type Item = &'a {{{arrayModelType}}}; - type IntoIter = ::std::slice::Iter<'a, {{{arrayModelType}}}>; + type IntoIter = std::slice::Iter<'a, {{{arrayModelType}}}>; fn into_iter(self) -> Self::IntoIter { (&self.0).into_iter() } } -impl<'a> ::std::iter::IntoIterator for &'a mut {{{classname}}} { +impl<'a> std::iter::IntoIterator for &'a mut {{{classname}}} { type Item = &'a mut {{{arrayModelType}}}; - type IntoIter = ::std::slice::IterMut<'a, {{{arrayModelType}}}>; + type IntoIter = std::slice::IterMut<'a, {{{arrayModelType}}}>; fn into_iter(self) -> Self::IntoIter { (&mut self.0).into_iter() } } -impl ::std::ops::Deref for {{{classname}}} { +impl std::ops::Deref for {{{classname}}} { type Target = Vec<{{{arrayModelType}}}>; fn deref(&self) -> &Self::Target { &self.0 } } -impl ::std::ops::DerefMut for {{{classname}}} { +impl std::ops::DerefMut for {{{classname}}} { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } @@ -219,7 +202,7 @@ impl ::std::ops::DerefMut for {{{classname}}} { /// Converts the {{{classname}}} value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for {{{classname}}} { +impl std::string::ToString for {{{classname}}} { fn to_string(&self) -> String { self.iter().map(|x| x.to_string()).collect::>().join(",").to_string() } @@ -228,16 +211,16 @@ impl ::std::string::ToString for {{{classname}}} { /// Converts Query Parameters representation (style=form, explode=false) to a {{{classname}}} value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for {{{classname}}} { - type Err = <{{{arrayModelType}}} as ::std::str::FromStr>::Err; +impl std::str::FromStr for {{{classname}}} { + type Err = <{{{arrayModelType}}} as std::str::FromStr>::Err; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { let mut items = vec![]; for item in s.split(',') { items.push(item.parse()?); } - Ok({{{classname}}}(items)) + std::result::Result::Ok({{{classname}}}(items)) } } @@ -275,7 +258,7 @@ impl {{{classname}}} { /// Converts the {{{classname}}} value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for {{{classname}}} { +impl std::string::ToString for {{{classname}}} { fn to_string(&self) -> String { let mut params: Vec = vec![]; {{#vars}} @@ -341,10 +324,10 @@ impl ::std::string::ToString for {{{classname}}} { /// Converts Query Parameters representation (style=form, explode=false) to a {{{classname}}} value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for {{{classname}}} { +impl std::str::FromStr for {{{classname}}} { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -362,26 +345,26 @@ impl ::std::str::FromStr for {{{classname}}} { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing {{{classname}}}".to_string()) + None => return std::result::Result::Err("Missing value while parsing {{{classname}}}".to_string()) }; if let Some(key) = key_result { match key { {{#vars}} {{#isBinary}} - "{{{baseName}}}" => return Err("Parsing binary data in this style is not supported in {{{classname}}}".to_string()), + "{{{baseName}}}" => return std::result::Result::Err("Parsing binary data in this style is not supported in {{{classname}}}".to_string()), {{/isBinary}} {{^isBinary}} {{#isByteArray}} - "{{{baseName}}}" => return Err("Parsing binary data in this style is not supported in {{{classname}}}".to_string()), + "{{{baseName}}}" => return std::result::Result::Err("Parsing binary data in this style is not supported in {{{classname}}}".to_string()), {{/isByteArray}} {{^isByteArray}} {{#isContainer}} - "{{{baseName}}}" => return Err("Parsing a container in this style is not supported in {{{classname}}}".to_string()), + "{{{baseName}}}" => return std::result::Result::Err("Parsing a container in this style is not supported in {{{classname}}}".to_string()), {{/isContainer}} {{^isContainer}} {{#isNullable}} - "{{{baseName}}}" => return Err("Parsing a nullable type in this style is not supported in {{{classname}}}".to_string()), + "{{{baseName}}}" => return std::result::Result::Err("Parsing a nullable type in this style is not supported in {{{classname}}}".to_string()), {{/isNullable}} {{^isNullable}} "{{{baseName}}}" => intermediate_rep.{{{name}}}.push({{{dataType}}}::from_str(val).map_err(|x| format!("{}", x))?), @@ -390,7 +373,7 @@ impl ::std::str::FromStr for {{{classname}}} { {{/isByteArray}} {{/isBinary}} {{/vars}} - _ => return Err("Unexpected key while parsing {{{classname}}}".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing {{{classname}}}".to_string()) } } @@ -399,10 +382,10 @@ impl ::std::str::FromStr for {{{classname}}} { } // Use the intermediate representation to return the struct - Ok({{{classname}}} { + std::result::Result::Ok({{{classname}}} { {{#vars}} {{#isNullable}} - {{{name}}}: Err("Nullable types not supported in {{{classname}}}".to_string())?, + {{{name}}}: std::result::Result::Err("Nullable types not supported in {{{classname}}}".to_string())?, {{/isNullable}} {{^isNullable}} {{{name}}}: intermediate_rep.{{{name}}}.into_iter().next(){{#required}}.ok_or("{{{baseName}}} missing in {{{classname}}}".to_string())?{{/required}}, @@ -433,7 +416,7 @@ impl {{{classname}}} { #[allow(dead_code)] pub(crate) fn to_xml(&self) -> String { {{#xmlNamespace}} - let mut namespaces = BTreeMap::new(); + let mut namespaces = std::collections::BTreeMap::new(); // An empty string is used to indicate a global namespace in xmltree. namespaces.insert("".to_string(), Self::NAMESPACE.to_string()); serde_xml_rs::to_string_with_namespaces(&self, namespaces).expect("impossible to fail to serialize") diff --git a/modules/openapi-generator/src/main/resources/rust-server/server-imports.mustache b/modules/openapi-generator/src/main/resources/rust-server/server-imports.mustache index c4485bcc313..b73cab65d17 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/server-imports.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/server-imports.mustache @@ -1,5 +1,3 @@ -#[allow(unused_imports)] -use std::collections::{HashMap, BTreeMap, BTreeSet}; use std::marker::PhantomData; use futures::{Future, future, Stream, stream}; use hyper; diff --git a/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache b/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache index d9aa756c839..a8608dee920 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache @@ -14,7 +14,7 @@ // Authorization if let Scopes::Some(ref scopes) = authorization.scopes { - let required_scopes: BTreeSet = vec![ + let required_scopes: std::collections::BTreeSet = vec![ {{#scopes}} "{{{scope}}}".to_string(), // {{{description}}} {{/scopes}} @@ -512,7 +512,7 @@ let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); {{/has_namespace}} {{#has_namespace}} - let mut namespaces = BTreeMap::new(); + 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()); diff --git a/modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml b/modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml index efcb502d1e9..a3fccb6ccbf 100644 --- a/modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml @@ -497,3 +497,11 @@ components: enum: - FOO - BAR + Ok: + type: string + Error: + type: string + Err: + type: string + Result: + type: string diff --git a/modules/openapi-generator/src/test/resources/3_0/rust-server/piers.yaml b/modules/openapi-generator/src/test/resources/3_0/rust-server/piers.yaml new file mode 100644 index 00000000000..9fa61137767 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/rust-server/piers.yaml @@ -0,0 +1,74 @@ +openapi: 3.0.1 +info: + title: OpenAPI Generator rust-server test + version: 0.1.0 +servers: +- url: / +paths: + /a_get: + get: + description: Returns some stuff + operationId: a_get + responses: + 200: + content: + text/plain: + example: ok + schema: + $ref: '#/components/schemas/ok' + description: OK + 404: + content: + text/plain: + example: Not found + schema: + $ref: '#/components/schemas/error' + description: Not found + /a_post/{arg}: + post: + description: Posts some stuff + operationId: a_post + parameters: + - description: A path arg + example: 1 + explode: false + in: path + name: arg + required: true + schema: + $ref: '#/components/schemas/arg' + style: simple + responses: + 200: + content: + text/plain: + example: ok + schema: + $ref: '#/components/schemas/ok' + description: OK + 404: + content: + text/plain: + example: Not found + schema: + $ref: '#/components/schemas/error' + description: Not found +components: + schemas: + ok: + description: OK + example: ok + type: string + error: + description: Some error text + example: Not found + type: string + arg: + description: An arg + example: 1 + enum: + - 0 + - 1 + - 2 + format: int32 + type: integer diff --git a/samples/server/petstore/rust-server/output/multipart-v3/examples/server/server.rs b/samples/server/petstore/rust-server/output/multipart-v3/examples/server/server.rs index 5570c0674a6..00a15cbc85a 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/examples/server/server.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/examples/server/server.rs @@ -13,7 +13,6 @@ use futures::{future, Future, Stream}; use hyper::server::conn::Http; use hyper::service::MakeService as _; use openssl::ssl::SslAcceptorBuilder; -use std::collections::HashMap; use std::marker::PhantomData; use std::net::SocketAddr; use std::sync::{Arc, Mutex}; diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/client/mod.rs index 2015e861f9b..c6d69f9d663 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/client/mod.rs @@ -8,8 +8,6 @@ use hyper::{Body, Uri, Response}; use hyper_openssl::HttpsConnector; use serde_json; use std::borrow::Cow; -#[allow(unused_imports)] -use std::collections::{HashMap, BTreeMap}; use std::io::{Read, Error, ErrorKind}; use std::error; use std::fmt; diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs index 6f943b310e7..3288f851175 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs @@ -65,9 +65,6 @@ use hyper::header::HeaderValue; use futures::Stream; use std::io::Error; -#[allow(unused_imports)] -use std::collections::HashMap; - #[deprecated(note = "Import swagger-rs directly")] pub use swagger::{ApiError, ContextWrapper}; #[deprecated(note = "Import futures directly")] diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/models.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/models.rs index a2386a3b713..136f5fc6359 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/models.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/models.rs @@ -1,27 +1,20 @@ -#![allow(unused_imports, unused_qualifications)] +#![allow(unused_qualifications)] -use serde::ser::Serializer; - -use std::collections::HashMap; use models; -use swagger; -use hyper::header::HeaderValue; -use std::string::ParseError; -use std::str::FromStr; -use header::IntoHeaderValue; +use header; -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(InlineObject::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -51,7 +44,7 @@ impl InlineObject { /// Converts the InlineObject value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for InlineObject { +impl std::string::ToString for InlineObject { fn to_string(&self) -> String { let mut params: Vec = vec![]; // Skipping binary1 in query parameter serialization @@ -67,10 +60,10 @@ impl ::std::string::ToString for InlineObject { /// Converts Query Parameters representation (style=form, explode=false) to a InlineObject value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for InlineObject { +impl std::str::FromStr for InlineObject { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -87,14 +80,14 @@ impl ::std::str::FromStr for InlineObject { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing InlineObject".to_string()) + None => return std::result::Result::Err("Missing value while parsing InlineObject".to_string()) }; if let Some(key) = key_result { match key { - "binary1" => return Err("Parsing binary data in this style is not supported in InlineObject".to_string()), - "binary2" => return Err("Parsing binary data in this style is not supported in InlineObject".to_string()), - _ => return Err("Unexpected key while parsing InlineObject".to_string()) + "binary1" => return std::result::Result::Err("Parsing binary data in this style is not supported in InlineObject".to_string()), + "binary2" => return std::result::Result::Err("Parsing binary data in this style is not supported in InlineObject".to_string()), + _ => return std::result::Result::Err("Unexpected key while parsing InlineObject".to_string()) } } @@ -103,7 +96,7 @@ impl ::std::str::FromStr for InlineObject { } // Use the intermediate representation to return the struct - Ok(InlineObject { + std::result::Result::Ok(InlineObject { binary1: intermediate_rep.binary1.into_iter().next(), binary2: intermediate_rep.binary2.into_iter().next(), }) @@ -112,17 +105,17 @@ impl ::std::str::FromStr for InlineObject { -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(MultipartRelatedRequest::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -156,7 +149,7 @@ impl MultipartRelatedRequest { /// Converts the MultipartRelatedRequest value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for MultipartRelatedRequest { +impl std::string::ToString for MultipartRelatedRequest { fn to_string(&self) -> String { let mut params: Vec = vec![]; // Skipping object_field in query parameter serialization @@ -174,10 +167,10 @@ impl ::std::string::ToString for MultipartRelatedRequest { /// Converts Query Parameters representation (style=form, explode=false) to a MultipartRelatedRequest value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for MultipartRelatedRequest { +impl std::str::FromStr for MultipartRelatedRequest { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -195,15 +188,15 @@ impl ::std::str::FromStr for MultipartRelatedRequest { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing MultipartRelatedRequest".to_string()) + None => return std::result::Result::Err("Missing value while parsing MultipartRelatedRequest".to_string()) }; if let Some(key) = key_result { match key { "object_field" => intermediate_rep.object_field.push(models::MultipartRequestObjectField::from_str(val).map_err(|x| format!("{}", x))?), - "optional_binary_field" => return Err("Parsing binary data in this style is not supported in MultipartRelatedRequest".to_string()), - "required_binary_field" => return Err("Parsing binary data in this style is not supported in MultipartRelatedRequest".to_string()), - _ => return Err("Unexpected key while parsing MultipartRelatedRequest".to_string()) + "optional_binary_field" => return std::result::Result::Err("Parsing binary data in this style is not supported in MultipartRelatedRequest".to_string()), + "required_binary_field" => return std::result::Result::Err("Parsing binary data in this style is not supported in MultipartRelatedRequest".to_string()), + _ => return std::result::Result::Err("Unexpected key while parsing MultipartRelatedRequest".to_string()) } } @@ -212,7 +205,7 @@ impl ::std::str::FromStr for MultipartRelatedRequest { } // Use the intermediate representation to return the struct - Ok(MultipartRelatedRequest { + std::result::Result::Ok(MultipartRelatedRequest { object_field: intermediate_rep.object_field.into_iter().next(), optional_binary_field: intermediate_rep.optional_binary_field.into_iter().next(), required_binary_field: intermediate_rep.required_binary_field.into_iter().next().ok_or("required_binary_field missing in MultipartRelatedRequest".to_string())?, @@ -222,17 +215,17 @@ impl ::std::str::FromStr for MultipartRelatedRequest { -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(MultipartRequest::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -270,7 +263,7 @@ impl MultipartRequest { /// Converts the MultipartRequest value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for MultipartRequest { +impl std::string::ToString for MultipartRequest { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -295,10 +288,10 @@ impl ::std::string::ToString for MultipartRequest { /// Converts Query Parameters representation (style=form, explode=false) to a MultipartRequest value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for MultipartRequest { +impl std::str::FromStr for MultipartRequest { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -317,7 +310,7 @@ impl ::std::str::FromStr for MultipartRequest { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing MultipartRequest".to_string()) + None => return std::result::Result::Err("Missing value while parsing MultipartRequest".to_string()) }; if let Some(key) = key_result { @@ -325,8 +318,8 @@ impl ::std::str::FromStr for MultipartRequest { "string_field" => intermediate_rep.string_field.push(String::from_str(val).map_err(|x| format!("{}", x))?), "optional_string_field" => intermediate_rep.optional_string_field.push(String::from_str(val).map_err(|x| format!("{}", x))?), "object_field" => intermediate_rep.object_field.push(models::MultipartRequestObjectField::from_str(val).map_err(|x| format!("{}", x))?), - "binary_field" => return Err("Parsing binary data in this style is not supported in MultipartRequest".to_string()), - _ => return Err("Unexpected key while parsing MultipartRequest".to_string()) + "binary_field" => return std::result::Result::Err("Parsing binary data in this style is not supported in MultipartRequest".to_string()), + _ => return std::result::Result::Err("Unexpected key while parsing MultipartRequest".to_string()) } } @@ -335,7 +328,7 @@ impl ::std::str::FromStr for MultipartRequest { } // Use the intermediate representation to return the struct - Ok(MultipartRequest { + std::result::Result::Ok(MultipartRequest { string_field: intermediate_rep.string_field.into_iter().next().ok_or("string_field missing in MultipartRequest".to_string())?, optional_string_field: intermediate_rep.optional_string_field.into_iter().next(), object_field: intermediate_rep.object_field.into_iter().next(), @@ -346,17 +339,17 @@ impl ::std::str::FromStr for MultipartRequest { -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(MultipartRequestObjectField::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -385,7 +378,7 @@ impl MultipartRequestObjectField { /// Converts the MultipartRequestObjectField value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for MultipartRequestObjectField { +impl std::string::ToString for MultipartRequestObjectField { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -405,10 +398,10 @@ impl ::std::string::ToString for MultipartRequestObjectField { /// Converts Query Parameters representation (style=form, explode=false) to a MultipartRequestObjectField value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for MultipartRequestObjectField { +impl std::str::FromStr for MultipartRequestObjectField { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -425,14 +418,14 @@ impl ::std::str::FromStr for MultipartRequestObjectField { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing MultipartRequestObjectField".to_string()) + None => return std::result::Result::Err("Missing value while parsing MultipartRequestObjectField".to_string()) }; if let Some(key) = key_result { match key { "field_a" => intermediate_rep.field_a.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "field_b" => return Err("Parsing a container in this style is not supported in MultipartRequestObjectField".to_string()), - _ => return Err("Unexpected key while parsing MultipartRequestObjectField".to_string()) + "field_b" => return std::result::Result::Err("Parsing a container in this style is not supported in MultipartRequestObjectField".to_string()), + _ => return std::result::Result::Err("Unexpected key while parsing MultipartRequestObjectField".to_string()) } } @@ -441,7 +434,7 @@ impl ::std::str::FromStr for MultipartRequestObjectField { } // Use the intermediate representation to return the struct - Ok(MultipartRequestObjectField { + std::result::Result::Ok(MultipartRequestObjectField { field_a: intermediate_rep.field_a.into_iter().next().ok_or("field_a missing in MultipartRequestObjectField".to_string())?, field_b: intermediate_rep.field_b.into_iter().next(), }) diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs index 8fe5570f9b7..34514b5e906 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs @@ -1,5 +1,3 @@ -#[allow(unused_imports)] -use std::collections::{HashMap, BTreeMap, BTreeSet}; use std::marker::PhantomData; use futures::{Future, future, Stream, stream}; use hyper; diff --git a/samples/server/petstore/rust-server/output/no-example-v3/examples/server/server.rs b/samples/server/petstore/rust-server/output/no-example-v3/examples/server/server.rs index 698194e371e..00770ed6546 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/examples/server/server.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/examples/server/server.rs @@ -13,7 +13,6 @@ use futures::{future, Future, Stream}; use hyper::server::conn::Http; use hyper::service::MakeService as _; use openssl::ssl::SslAcceptorBuilder; -use std::collections::HashMap; use std::marker::PhantomData; use std::net::SocketAddr; use std::sync::{Arc, Mutex}; diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/client/mod.rs index d055f146067..529cbe99e0e 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/client/mod.rs @@ -8,8 +8,6 @@ use hyper::{Body, Uri, Response}; use hyper_openssl::HttpsConnector; use serde_json; use std::borrow::Cow; -#[allow(unused_imports)] -use std::collections::{HashMap, BTreeMap}; use std::io::{Read, Error, ErrorKind}; use std::error; use std::fmt; diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs index 6db786d0c8e..4606b6f8bb8 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/lib.rs @@ -56,9 +56,6 @@ use hyper::header::HeaderValue; use futures::Stream; use std::io::Error; -#[allow(unused_imports)] -use std::collections::HashMap; - #[deprecated(note = "Import swagger-rs directly")] pub use swagger::{ApiError, ContextWrapper}; #[deprecated(note = "Import futures directly")] diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/models.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/models.rs index 5b3e76c908b..d3ec845c67c 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/models.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/models.rs @@ -1,27 +1,20 @@ -#![allow(unused_imports, unused_qualifications)] +#![allow(unused_qualifications)] -use serde::ser::Serializer; - -use std::collections::HashMap; use models; -use swagger; -use hyper::header::HeaderValue; -use std::string::ParseError; -use std::str::FromStr; -use header::IntoHeaderValue; +use header; -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(InlineObject::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -46,7 +39,7 @@ impl InlineObject { /// Converts the InlineObject value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for InlineObject { +impl std::string::ToString for InlineObject { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -62,10 +55,10 @@ impl ::std::string::ToString for InlineObject { /// Converts Query Parameters representation (style=form, explode=false) to a InlineObject value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for InlineObject { +impl std::str::FromStr for InlineObject { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -81,13 +74,13 @@ impl ::std::str::FromStr for InlineObject { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing InlineObject".to_string()) + None => return std::result::Result::Err("Missing value while parsing InlineObject".to_string()) }; if let Some(key) = key_result { match key { "propery" => intermediate_rep.propery.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing InlineObject".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing InlineObject".to_string()) } } @@ -96,7 +89,7 @@ impl ::std::str::FromStr for InlineObject { } // Use the intermediate representation to return the struct - Ok(InlineObject { + std::result::Result::Ok(InlineObject { propery: intermediate_rep.propery.into_iter().next(), }) } diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs index 08e06a62739..ff66b021a66 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs @@ -1,5 +1,3 @@ -#[allow(unused_imports)] -use std::collections::{HashMap, BTreeMap, BTreeSet}; use std::marker::PhantomData; use futures::{Future, future, Stream, stream}; use hyper; diff --git a/samples/server/petstore/rust-server/output/openapi-v3/README.md b/samples/server/petstore/rust-server/output/openapi-v3/README.md index a1915a3521b..a4540d22220 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/README.md +++ b/samples/server/petstore/rust-server/output/openapi-v3/README.md @@ -142,6 +142,8 @@ Method | HTTP request | Description - [AnotherXmlObject](docs/AnotherXmlObject.md) - [DuplicateXmlObject](docs/DuplicateXmlObject.md) - [EnumWithStarObject](docs/EnumWithStarObject.md) + - [Err](docs/Err.md) + - [Error](docs/Error.md) - [InlineResponse201](docs/InlineResponse201.md) - [MyId](docs/MyId.md) - [MyIdList](docs/MyIdList.md) @@ -150,8 +152,10 @@ Method | HTTP request | Description - [ObjectParam](docs/ObjectParam.md) - [ObjectUntypedProps](docs/ObjectUntypedProps.md) - [ObjectWithArrayOfObjects](docs/ObjectWithArrayOfObjects.md) + - [Ok](docs/Ok.md) - [OptionalObjectHeader](docs/OptionalObjectHeader.md) - [RequiredObjectHeader](docs/RequiredObjectHeader.md) + - [Result](docs/Result.md) - [StringEnum](docs/StringEnum.md) - [StringObject](docs/StringObject.md) - [UuidObject](docs/UuidObject.md) diff --git a/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml b/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml index ce32d7c9424..7e5d214e8ef 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml +++ b/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml @@ -505,6 +505,14 @@ components: - FOO - BAR type: string + Ok: + type: string + Error: + type: string + Err: + type: string + Result: + type: string inline_response_201: properties: foo: diff --git a/samples/server/petstore/rust-server/output/openapi-v3/docs/Err.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/Err.md new file mode 100644 index 00000000000..58f6f4cadf8 --- /dev/null +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/Err.md @@ -0,0 +1,9 @@ +# Err + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/server/petstore/rust-server/output/openapi-v3/docs/Error.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/Error.md new file mode 100644 index 00000000000..725f180224d --- /dev/null +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/Error.md @@ -0,0 +1,9 @@ +# Error + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/server/petstore/rust-server/output/openapi-v3/docs/Ok.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/Ok.md new file mode 100644 index 00000000000..72325844633 --- /dev/null +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/Ok.md @@ -0,0 +1,9 @@ +# Ok + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/server/petstore/rust-server/output/openapi-v3/docs/Result.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/Result.md new file mode 100644 index 00000000000..a6f795bc966 --- /dev/null +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/Result.md @@ -0,0 +1,9 @@ +# Result + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/server/petstore/rust-server/output/openapi-v3/examples/client/server.rs b/samples/server/petstore/rust-server/output/openapi-v3/examples/client/server.rs index 0af97f30412..de70c7d987a 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/examples/client/server.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/examples/client/server.rs @@ -13,7 +13,6 @@ use futures::{future, Future, Stream}; use hyper::server::conn::Http; use hyper::service::MakeService as _; use openssl::ssl::SslAcceptorBuilder; -use std::collections::HashMap; use std::marker::PhantomData; use std::net::SocketAddr; use std::sync::{Arc, Mutex}; diff --git a/samples/server/petstore/rust-server/output/openapi-v3/examples/server/server.rs b/samples/server/petstore/rust-server/output/openapi-v3/examples/server/server.rs index 2eb1e1dc31a..4dc03e32481 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/examples/server/server.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/examples/server/server.rs @@ -13,7 +13,6 @@ use futures::{future, Future, Stream}; use hyper::server::conn::Http; use hyper::service::MakeService as _; use openssl::ssl::SslAcceptorBuilder; -use std::collections::HashMap; use std::marker::PhantomData; use std::net::SocketAddr; use std::sync::{Arc, Mutex}; diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs index 92223016e37..a2d61295bb5 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs @@ -1,5 +1,3 @@ -#[allow(unused_imports)] -use std::collections::{HashMap, BTreeMap, BTreeSet}; use std::marker::PhantomData; use futures::{Future, future, Stream, stream}; use hyper; diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs index 85d530544fb..9b28f8a50a1 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs @@ -8,8 +8,6 @@ use hyper::{Body, Uri, Response}; use hyper_openssl::HttpsConnector; use serde_json; use std::borrow::Cow; -#[allow(unused_imports)] -use std::collections::{HashMap, BTreeMap}; use std::io::{Read, Error, ErrorKind}; use std::error; use std::fmt; diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs index 1ab58202286..214bbcccc7f 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs @@ -56,9 +56,6 @@ use hyper::header::HeaderValue; use futures::Stream; use std::io::Error; -#[allow(unused_imports)] -use std::collections::HashMap; - #[deprecated(note = "Import swagger-rs directly")] pub use swagger::{ApiError, ContextWrapper}; #[deprecated(note = "Import futures directly")] diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs index e4fd70660a7..572b81057e5 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs @@ -1,37 +1,28 @@ -#![allow(unused_imports, unused_qualifications)] +#![allow(unused_qualifications)] -use serde_xml_rs; -use serde::ser::Serializer; - -use std::collections::{HashMap, BTreeMap}; use models; -use swagger; -use hyper::header::HeaderValue; -use std::string::ParseError; -use uuid; -use std::str::FromStr; -use header::IntoHeaderValue; +use header; -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(AnotherXmlArray::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } // Utility function for wrapping list elements when serializing xml #[allow(non_snake_case)] -fn wrap_in_snake_another_xml_inner(item: &Vec, serializer: S) -> Result +fn wrap_in_snake_another_xml_inner(item: &Vec, serializer: S) -> std::result::Result where - S: Serializer, + S: serde::ser::Serializer, { serde_xml_rs::wrap_primitives(item, serializer, "snake_another_xml_inner") } @@ -40,59 +31,59 @@ where #[cfg_attr(feature = "conversion", derive(LabelledGeneric))] pub struct AnotherXmlArray(#[serde(serialize_with = "wrap_in_snake_another_xml_inner")]Vec); -impl ::std::convert::From> for AnotherXmlArray { +impl std::convert::From> for AnotherXmlArray { fn from(x: Vec) -> Self { AnotherXmlArray(x) } } -impl ::std::convert::From for Vec { +impl std::convert::From for Vec { fn from(x: AnotherXmlArray) -> Self { x.0 } } -impl ::std::iter::FromIterator for AnotherXmlArray { +impl std::iter::FromIterator for AnotherXmlArray { fn from_iter>(u: U) -> Self { AnotherXmlArray(Vec::::from_iter(u)) } } -impl ::std::iter::IntoIterator for AnotherXmlArray { +impl std::iter::IntoIterator for AnotherXmlArray { type Item = String; - type IntoIter = ::std::vec::IntoIter; + type IntoIter = std::vec::IntoIter; fn into_iter(self) -> Self::IntoIter { self.0.into_iter() } } -impl<'a> ::std::iter::IntoIterator for &'a AnotherXmlArray { +impl<'a> std::iter::IntoIterator for &'a AnotherXmlArray { type Item = &'a String; - type IntoIter = ::std::slice::Iter<'a, String>; + type IntoIter = std::slice::Iter<'a, String>; fn into_iter(self) -> Self::IntoIter { (&self.0).into_iter() } } -impl<'a> ::std::iter::IntoIterator for &'a mut AnotherXmlArray { +impl<'a> std::iter::IntoIterator for &'a mut AnotherXmlArray { type Item = &'a mut String; - type IntoIter = ::std::slice::IterMut<'a, String>; + type IntoIter = std::slice::IterMut<'a, String>; fn into_iter(self) -> Self::IntoIter { (&mut self.0).into_iter() } } -impl ::std::ops::Deref for AnotherXmlArray { +impl std::ops::Deref for AnotherXmlArray { type Target = Vec; fn deref(&self) -> &Self::Target { &self.0 } } -impl ::std::ops::DerefMut for AnotherXmlArray { +impl std::ops::DerefMut for AnotherXmlArray { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } @@ -101,7 +92,7 @@ impl ::std::ops::DerefMut for AnotherXmlArray { /// Converts the AnotherXmlArray value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for AnotherXmlArray { +impl std::string::ToString for AnotherXmlArray { fn to_string(&self) -> String { self.iter().map(|x| x.to_string()).collect::>().join(",").to_string() } @@ -110,16 +101,16 @@ impl ::std::string::ToString for AnotherXmlArray { /// Converts Query Parameters representation (style=form, explode=false) to a AnotherXmlArray value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for AnotherXmlArray { - type Err = ::Err; +impl std::str::FromStr for AnotherXmlArray { + type Err = ::Err; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { let mut items = vec![]; for item in s.split(',') { items.push(item.parse()?); } - Ok(AnotherXmlArray(items)) + std::result::Result::Ok(AnotherXmlArray(items)) } } @@ -138,33 +129,33 @@ impl AnotherXmlArray { #[serde(rename = "snake_another_xml_inner")] pub struct AnotherXmlInner(String); -impl ::std::convert::From for AnotherXmlInner { +impl std::convert::From for AnotherXmlInner { fn from(x: String) -> Self { AnotherXmlInner(x) } } impl std::str::FromStr for AnotherXmlInner { - type Err = ParseError; - fn from_str(x: &str) -> Result { - Ok(AnotherXmlInner(x.to_string())) + type Err = std::string::ParseError; + fn from_str(x: &str) -> std::result::Result { + std::result::Result::Ok(AnotherXmlInner(x.to_string())) } } -impl ::std::convert::From for String { +impl std::convert::From for String { fn from(x: AnotherXmlInner) -> Self { x.0 } } -impl ::std::ops::Deref for AnotherXmlInner { +impl std::ops::Deref for AnotherXmlInner { type Target = String; fn deref(&self) -> &String { &self.0 } } -impl ::std::ops::DerefMut for AnotherXmlInner { +impl std::ops::DerefMut for AnotherXmlInner { fn deref_mut(&mut self) -> &mut String { &mut self.0 } @@ -181,17 +172,17 @@ impl AnotherXmlInner { } /// An XML object -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(AnotherXmlObject::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -217,7 +208,7 @@ impl AnotherXmlObject { /// Converts the AnotherXmlObject value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for AnotherXmlObject { +impl std::string::ToString for AnotherXmlObject { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -233,10 +224,10 @@ impl ::std::string::ToString for AnotherXmlObject { /// Converts Query Parameters representation (style=form, explode=false) to a AnotherXmlObject value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for AnotherXmlObject { +impl std::str::FromStr for AnotherXmlObject { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -252,13 +243,13 @@ impl ::std::str::FromStr for AnotherXmlObject { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing AnotherXmlObject".to_string()) + None => return std::result::Result::Err("Missing value while parsing AnotherXmlObject".to_string()) }; if let Some(key) = key_result { match key { "inner_string" => intermediate_rep.inner_string.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing AnotherXmlObject".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing AnotherXmlObject".to_string()) } } @@ -267,7 +258,7 @@ impl ::std::str::FromStr for AnotherXmlObject { } // Use the intermediate representation to return the struct - Ok(AnotherXmlObject { + std::result::Result::Ok(AnotherXmlObject { inner_string: intermediate_rep.inner_string.into_iter().next(), }) } @@ -285,7 +276,7 @@ impl AnotherXmlObject { /// Will panic if serialisation fails. #[allow(dead_code)] pub(crate) fn to_xml(&self) -> String { - let mut namespaces = BTreeMap::new(); + let mut namespaces = std::collections::BTreeMap::new(); // An empty string is used to indicate a global namespace in xmltree. namespaces.insert("".to_string(), Self::NAMESPACE.to_string()); serde_xml_rs::to_string_with_namespaces(&self, namespaces).expect("impossible to fail to serialize") @@ -293,17 +284,17 @@ impl AnotherXmlObject { } /// An XML object -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(DuplicateXmlObject::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -334,7 +325,7 @@ impl DuplicateXmlObject { /// Converts the DuplicateXmlObject value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for DuplicateXmlObject { +impl std::string::ToString for DuplicateXmlObject { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -352,10 +343,10 @@ impl ::std::string::ToString for DuplicateXmlObject { /// Converts Query Parameters representation (style=form, explode=false) to a DuplicateXmlObject value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for DuplicateXmlObject { +impl std::str::FromStr for DuplicateXmlObject { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -372,14 +363,14 @@ impl ::std::str::FromStr for DuplicateXmlObject { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing DuplicateXmlObject".to_string()) + None => return std::result::Result::Err("Missing value while parsing DuplicateXmlObject".to_string()) }; if let Some(key) = key_result { match key { "inner_string" => intermediate_rep.inner_string.push(String::from_str(val).map_err(|x| format!("{}", x))?), "inner_array" => intermediate_rep.inner_array.push(models::XmlArray::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing DuplicateXmlObject".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing DuplicateXmlObject".to_string()) } } @@ -388,7 +379,7 @@ impl ::std::str::FromStr for DuplicateXmlObject { } // Use the intermediate representation to return the struct - Ok(DuplicateXmlObject { + std::result::Result::Ok(DuplicateXmlObject { inner_string: intermediate_rep.inner_string.into_iter().next(), inner_array: intermediate_rep.inner_array.into_iter().next().ok_or("inner_array missing in DuplicateXmlObject".to_string())?, }) @@ -407,7 +398,7 @@ impl DuplicateXmlObject { /// Will panic if serialisation fails. #[allow(dead_code)] pub(crate) fn to_xml(&self) -> String { - let mut namespaces = BTreeMap::new(); + let mut namespaces = std::collections::BTreeMap::new(); // An empty string is used to indicate a global namespace in xmltree. namespaces.insert("".to_string(), Self::NAMESPACE.to_string()); serde_xml_rs::to_string_with_namespaces(&self, namespaces).expect("impossible to fail to serialize") @@ -431,8 +422,8 @@ pub enum EnumWithStarObject { STAR, } -impl ::std::fmt::Display for EnumWithStarObject { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { +impl std::fmt::Display for EnumWithStarObject { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match *self { EnumWithStarObject::FOO => write!(f, "{}", "FOO"), EnumWithStarObject::BAR => write!(f, "{}", "BAR"), @@ -441,15 +432,15 @@ impl ::std::fmt::Display for EnumWithStarObject { } } -impl ::std::str::FromStr for EnumWithStarObject { +impl std::str::FromStr for EnumWithStarObject { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { match s { - "FOO" => Ok(EnumWithStarObject::FOO), - "BAR" => Ok(EnumWithStarObject::BAR), - "*" => Ok(EnumWithStarObject::STAR), - _ => Err(format!("Value not valid: {}", s)), + "FOO" => std::result::Result::Ok(EnumWithStarObject::FOO), + "BAR" => std::result::Result::Ok(EnumWithStarObject::BAR), + "*" => std::result::Result::Ok(EnumWithStarObject::STAR), + _ => std::result::Result::Err(format!("Value not valid: {}", s)), } } } @@ -463,17 +454,109 @@ impl EnumWithStarObject { } } -// Methods for converting between IntoHeaderValue and HeaderValue +#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize, Deserialize)] +#[cfg_attr(feature = "conversion", derive(LabelledGeneric))] +pub struct Err(String); -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::From for Err { + fn from(x: String) -> Self { + Err(x) } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(InlineResponse201::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::str::FromStr for Err { + type Err = std::string::ParseError; + fn from_str(x: &str) -> std::result::Result { + std::result::Result::Ok(Err(x.to_string())) + } +} + +impl std::convert::From for String { + fn from(x: Err) -> Self { + x.0 + } +} + +impl std::ops::Deref for Err { + type Target = String; + fn deref(&self) -> &String { + &self.0 + } +} + +impl std::ops::DerefMut for Err { + fn deref_mut(&mut self) -> &mut String { + &mut self.0 + } +} + + +impl Err { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + +#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize, Deserialize)] +#[cfg_attr(feature = "conversion", derive(LabelledGeneric))] +pub struct Error(String); + +impl std::convert::From for Error { + fn from(x: String) -> Self { + Error(x) + } +} + +impl std::str::FromStr for Error { + type Err = std::string::ParseError; + fn from_str(x: &str) -> std::result::Result { + std::result::Result::Ok(Error(x.to_string())) + } +} + +impl std::convert::From for String { + fn from(x: Error) -> Self { + x.0 + } +} + +impl std::ops::Deref for Error { + type Target = String; + fn deref(&self) -> &String { + &self.0 + } +} + +impl std::ops::DerefMut for Error { + fn deref_mut(&mut self) -> &mut String { + &mut self.0 + } +} + + +impl Error { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue + +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() + } +} + +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -498,7 +581,7 @@ impl InlineResponse201 { /// Converts the InlineResponse201 value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for InlineResponse201 { +impl std::string::ToString for InlineResponse201 { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -514,10 +597,10 @@ impl ::std::string::ToString for InlineResponse201 { /// Converts Query Parameters representation (style=form, explode=false) to a InlineResponse201 value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for InlineResponse201 { +impl std::str::FromStr for InlineResponse201 { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -533,13 +616,13 @@ impl ::std::str::FromStr for InlineResponse201 { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing InlineResponse201".to_string()) + None => return std::result::Result::Err("Missing value while parsing InlineResponse201".to_string()) }; if let Some(key) = key_result { match key { "foo" => intermediate_rep.foo.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing InlineResponse201".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing InlineResponse201".to_string()) } } @@ -548,7 +631,7 @@ impl ::std::str::FromStr for InlineResponse201 { } // Use the intermediate representation to return the struct - Ok(InlineResponse201 { + std::result::Result::Ok(InlineResponse201 { foo: intermediate_rep.foo.into_iter().next(), }) } @@ -568,27 +651,27 @@ impl InlineResponse201 { #[cfg_attr(feature = "conversion", derive(LabelledGeneric))] pub struct MyId(i32); -impl ::std::convert::From for MyId { +impl std::convert::From for MyId { fn from(x: i32) -> Self { MyId(x) } } -impl ::std::convert::From for i32 { +impl std::convert::From for i32 { fn from(x: MyId) -> Self { x.0 } } -impl ::std::ops::Deref for MyId { +impl std::ops::Deref for MyId { type Target = i32; fn deref(&self) -> &i32 { &self.0 } } -impl ::std::ops::DerefMut for MyId { +impl std::ops::DerefMut for MyId { fn deref_mut(&mut self) -> &mut i32 { &mut self.0 } @@ -604,17 +687,17 @@ impl MyId { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(MyIdList::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -622,59 +705,59 @@ impl From for IntoHeaderValue { #[cfg_attr(feature = "conversion", derive(LabelledGeneric))] pub struct MyIdList(Vec); -impl ::std::convert::From> for MyIdList { +impl std::convert::From> for MyIdList { fn from(x: Vec) -> Self { MyIdList(x) } } -impl ::std::convert::From for Vec { +impl std::convert::From for Vec { fn from(x: MyIdList) -> Self { x.0 } } -impl ::std::iter::FromIterator for MyIdList { +impl std::iter::FromIterator for MyIdList { fn from_iter>(u: U) -> Self { MyIdList(Vec::::from_iter(u)) } } -impl ::std::iter::IntoIterator for MyIdList { +impl std::iter::IntoIterator for MyIdList { type Item = i32; - type IntoIter = ::std::vec::IntoIter; + type IntoIter = std::vec::IntoIter; fn into_iter(self) -> Self::IntoIter { self.0.into_iter() } } -impl<'a> ::std::iter::IntoIterator for &'a MyIdList { +impl<'a> std::iter::IntoIterator for &'a MyIdList { type Item = &'a i32; - type IntoIter = ::std::slice::Iter<'a, i32>; + type IntoIter = std::slice::Iter<'a, i32>; fn into_iter(self) -> Self::IntoIter { (&self.0).into_iter() } } -impl<'a> ::std::iter::IntoIterator for &'a mut MyIdList { +impl<'a> std::iter::IntoIterator for &'a mut MyIdList { type Item = &'a mut i32; - type IntoIter = ::std::slice::IterMut<'a, i32>; + type IntoIter = std::slice::IterMut<'a, i32>; fn into_iter(self) -> Self::IntoIter { (&mut self.0).into_iter() } } -impl ::std::ops::Deref for MyIdList { +impl std::ops::Deref for MyIdList { type Target = Vec; fn deref(&self) -> &Self::Target { &self.0 } } -impl ::std::ops::DerefMut for MyIdList { +impl std::ops::DerefMut for MyIdList { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } @@ -683,7 +766,7 @@ impl ::std::ops::DerefMut for MyIdList { /// Converts the MyIdList value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for MyIdList { +impl std::string::ToString for MyIdList { fn to_string(&self) -> String { self.iter().map(|x| x.to_string()).collect::>().join(",").to_string() } @@ -692,16 +775,16 @@ impl ::std::string::ToString for MyIdList { /// Converts Query Parameters representation (style=form, explode=false) to a MyIdList value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for MyIdList { - type Err = ::Err; +impl std::str::FromStr for MyIdList { + type Err = ::Err; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { let mut items = vec![]; for item in s.split(',') { items.push(item.parse()?); } - Ok(MyIdList(items)) + std::result::Result::Ok(MyIdList(items)) } } @@ -715,17 +798,17 @@ impl MyIdList { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(NullableTest::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -777,7 +860,7 @@ impl NullableTest { /// Converts the NullableTest value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for NullableTest { +impl std::string::ToString for NullableTest { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -815,10 +898,10 @@ impl ::std::string::ToString for NullableTest { /// Converts Query Parameters representation (style=form, explode=false) to a NullableTest value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for NullableTest { +impl std::str::FromStr for NullableTest { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -838,17 +921,17 @@ impl ::std::str::FromStr for NullableTest { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing NullableTest".to_string()) + None => return std::result::Result::Err("Missing value while parsing NullableTest".to_string()) }; if let Some(key) = key_result { match key { - "nullable" => return Err("Parsing a nullable type in this style is not supported in NullableTest".to_string()), - "nullableWithNullDefault" => return Err("Parsing a nullable type in this style is not supported in NullableTest".to_string()), - "nullableWithPresentDefault" => return Err("Parsing a nullable type in this style is not supported in NullableTest".to_string()), - "nullableWithNoDefault" => return Err("Parsing a nullable type in this style is not supported in NullableTest".to_string()), - "nullableArray" => return Err("Parsing a container in this style is not supported in NullableTest".to_string()), - _ => return Err("Unexpected key while parsing NullableTest".to_string()) + "nullable" => return std::result::Result::Err("Parsing a nullable type in this style is not supported in NullableTest".to_string()), + "nullableWithNullDefault" => return std::result::Result::Err("Parsing a nullable type in this style is not supported in NullableTest".to_string()), + "nullableWithPresentDefault" => return std::result::Result::Err("Parsing a nullable type in this style is not supported in NullableTest".to_string()), + "nullableWithNoDefault" => return std::result::Result::Err("Parsing a nullable type in this style is not supported in NullableTest".to_string()), + "nullableArray" => return std::result::Result::Err("Parsing a container in this style is not supported in NullableTest".to_string()), + _ => return std::result::Result::Err("Unexpected key while parsing NullableTest".to_string()) } } @@ -857,12 +940,12 @@ impl ::std::str::FromStr for NullableTest { } // Use the intermediate representation to return the struct - Ok(NullableTest { - nullable: Err("Nullable types not supported in NullableTest".to_string())?, - nullable_with_null_default: Err("Nullable types not supported in NullableTest".to_string())?, - nullable_with_present_default: Err("Nullable types not supported in NullableTest".to_string())?, - nullable_with_no_default: Err("Nullable types not supported in NullableTest".to_string())?, - nullable_array: Err("Nullable types not supported in NullableTest".to_string())?, + std::result::Result::Ok(NullableTest { + nullable: std::result::Result::Err("Nullable types not supported in NullableTest".to_string())?, + nullable_with_null_default: std::result::Result::Err("Nullable types not supported in NullableTest".to_string())?, + nullable_with_present_default: std::result::Result::Err("Nullable types not supported in NullableTest".to_string())?, + nullable_with_no_default: std::result::Result::Err("Nullable types not supported in NullableTest".to_string())?, + nullable_array: std::result::Result::Err("Nullable types not supported in NullableTest".to_string())?, }) } } @@ -877,17 +960,17 @@ impl NullableTest { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(ObjectHeader::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -916,7 +999,7 @@ impl ObjectHeader { /// Converts the ObjectHeader value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for ObjectHeader { +impl std::string::ToString for ObjectHeader { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -936,10 +1019,10 @@ impl ::std::string::ToString for ObjectHeader { /// Converts Query Parameters representation (style=form, explode=false) to a ObjectHeader value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for ObjectHeader { +impl std::str::FromStr for ObjectHeader { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -956,14 +1039,14 @@ impl ::std::str::FromStr for ObjectHeader { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing ObjectHeader".to_string()) + None => return std::result::Result::Err("Missing value while parsing ObjectHeader".to_string()) }; if let Some(key) = key_result { match key { "requiredObjectHeader" => intermediate_rep.required_object_header.push(bool::from_str(val).map_err(|x| format!("{}", x))?), "optionalObjectHeader" => intermediate_rep.optional_object_header.push(isize::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing ObjectHeader".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing ObjectHeader".to_string()) } } @@ -972,7 +1055,7 @@ impl ::std::str::FromStr for ObjectHeader { } // Use the intermediate representation to return the struct - Ok(ObjectHeader { + std::result::Result::Ok(ObjectHeader { required_object_header: intermediate_rep.required_object_header.into_iter().next().ok_or("requiredObjectHeader missing in ObjectHeader".to_string())?, optional_object_header: intermediate_rep.optional_object_header.into_iter().next(), }) @@ -989,17 +1072,17 @@ impl ObjectHeader { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(ObjectParam::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -1028,7 +1111,7 @@ impl ObjectParam { /// Converts the ObjectParam value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for ObjectParam { +impl std::string::ToString for ObjectParam { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -1048,10 +1131,10 @@ impl ::std::string::ToString for ObjectParam { /// Converts Query Parameters representation (style=form, explode=false) to a ObjectParam value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for ObjectParam { +impl std::str::FromStr for ObjectParam { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -1068,14 +1151,14 @@ impl ::std::str::FromStr for ObjectParam { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing ObjectParam".to_string()) + None => return std::result::Result::Err("Missing value while parsing ObjectParam".to_string()) }; if let Some(key) = key_result { match key { "requiredParam" => intermediate_rep.required_param.push(bool::from_str(val).map_err(|x| format!("{}", x))?), "optionalParam" => intermediate_rep.optional_param.push(isize::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing ObjectParam".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing ObjectParam".to_string()) } } @@ -1084,7 +1167,7 @@ impl ::std::str::FromStr for ObjectParam { } // Use the intermediate representation to return the struct - Ok(ObjectParam { + std::result::Result::Ok(ObjectParam { required_param: intermediate_rep.required_param.into_iter().next().ok_or("requiredParam missing in ObjectParam".to_string())?, optional_param: intermediate_rep.optional_param.into_iter().next(), }) @@ -1101,17 +1184,17 @@ impl ObjectParam { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(ObjectUntypedProps::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -1149,7 +1232,7 @@ impl ObjectUntypedProps { /// Converts the ObjectUntypedProps value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for ObjectUntypedProps { +impl std::string::ToString for ObjectUntypedProps { fn to_string(&self) -> String { let mut params: Vec = vec![]; // Skipping required_untyped in query parameter serialization @@ -1167,10 +1250,10 @@ impl ::std::string::ToString for ObjectUntypedProps { /// Converts Query Parameters representation (style=form, explode=false) to a ObjectUntypedProps value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for ObjectUntypedProps { +impl std::str::FromStr for ObjectUntypedProps { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -1189,7 +1272,7 @@ impl ::std::str::FromStr for ObjectUntypedProps { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing ObjectUntypedProps".to_string()) + None => return std::result::Result::Err("Missing value while parsing ObjectUntypedProps".to_string()) }; if let Some(key) = key_result { @@ -1198,7 +1281,7 @@ impl ::std::str::FromStr for ObjectUntypedProps { "required_untyped_nullable" => intermediate_rep.required_untyped_nullable.push(serde_json::Value::from_str(val).map_err(|x| format!("{}", x))?), "not_required_untyped" => intermediate_rep.not_required_untyped.push(serde_json::Value::from_str(val).map_err(|x| format!("{}", x))?), "not_required_untyped_nullable" => intermediate_rep.not_required_untyped_nullable.push(serde_json::Value::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing ObjectUntypedProps".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing ObjectUntypedProps".to_string()) } } @@ -1207,7 +1290,7 @@ impl ::std::str::FromStr for ObjectUntypedProps { } // Use the intermediate representation to return the struct - Ok(ObjectUntypedProps { + std::result::Result::Ok(ObjectUntypedProps { required_untyped: intermediate_rep.required_untyped.into_iter().next().ok_or("required_untyped missing in ObjectUntypedProps".to_string())?, required_untyped_nullable: intermediate_rep.required_untyped_nullable.into_iter().next().ok_or("required_untyped_nullable missing in ObjectUntypedProps".to_string())?, not_required_untyped: intermediate_rep.not_required_untyped.into_iter().next(), @@ -1226,17 +1309,17 @@ impl ObjectUntypedProps { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(ObjectWithArrayOfObjects::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -1261,7 +1344,7 @@ impl ObjectWithArrayOfObjects { /// Converts the ObjectWithArrayOfObjects value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for ObjectWithArrayOfObjects { +impl std::string::ToString for ObjectWithArrayOfObjects { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -1277,10 +1360,10 @@ impl ::std::string::ToString for ObjectWithArrayOfObjects { /// Converts Query Parameters representation (style=form, explode=false) to a ObjectWithArrayOfObjects value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for ObjectWithArrayOfObjects { +impl std::str::FromStr for ObjectWithArrayOfObjects { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -1296,13 +1379,13 @@ impl ::std::str::FromStr for ObjectWithArrayOfObjects { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing ObjectWithArrayOfObjects".to_string()) + None => return std::result::Result::Err("Missing value while parsing ObjectWithArrayOfObjects".to_string()) }; if let Some(key) = key_result { match key { - "objectArray" => return Err("Parsing a container in this style is not supported in ObjectWithArrayOfObjects".to_string()), - _ => return Err("Unexpected key while parsing ObjectWithArrayOfObjects".to_string()) + "objectArray" => return std::result::Result::Err("Parsing a container in this style is not supported in ObjectWithArrayOfObjects".to_string()), + _ => return std::result::Result::Err("Unexpected key while parsing ObjectWithArrayOfObjects".to_string()) } } @@ -1311,7 +1394,7 @@ impl ::std::str::FromStr for ObjectWithArrayOfObjects { } // Use the intermediate representation to return the struct - Ok(ObjectWithArrayOfObjects { + std::result::Result::Ok(ObjectWithArrayOfObjects { object_array: intermediate_rep.object_array.into_iter().next(), }) } @@ -1327,31 +1410,77 @@ impl ObjectWithArrayOfObjects { } } +#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize, Deserialize)] +#[cfg_attr(feature = "conversion", derive(LabelledGeneric))] +pub struct Ok(String); + +impl std::convert::From for Ok { + fn from(x: String) -> Self { + Ok(x) + } +} + +impl std::str::FromStr for Ok { + type Err = std::string::ParseError; + fn from_str(x: &str) -> std::result::Result { + std::result::Result::Ok(Ok(x.to_string())) + } +} + +impl std::convert::From for String { + fn from(x: Ok) -> Self { + x.0 + } +} + +impl std::ops::Deref for Ok { + type Target = String; + fn deref(&self) -> &String { + &self.0 + } +} + +impl std::ops::DerefMut for Ok { + fn deref_mut(&mut self) -> &mut String { + &mut self.0 + } +} + + +impl Ok { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + #[derive(Debug, Clone, PartialEq, PartialOrd, Serialize, Deserialize)] #[cfg_attr(feature = "conversion", derive(LabelledGeneric))] pub struct OptionalObjectHeader(i32); -impl ::std::convert::From for OptionalObjectHeader { +impl std::convert::From for OptionalObjectHeader { fn from(x: i32) -> Self { OptionalObjectHeader(x) } } -impl ::std::convert::From for i32 { +impl std::convert::From for i32 { fn from(x: OptionalObjectHeader) -> Self { x.0 } } -impl ::std::ops::Deref for OptionalObjectHeader { +impl std::ops::Deref for OptionalObjectHeader { type Target = i32; fn deref(&self) -> &i32 { &self.0 } } -impl ::std::ops::DerefMut for OptionalObjectHeader { +impl std::ops::DerefMut for OptionalObjectHeader { fn deref_mut(&mut self) -> &mut i32 { &mut self.0 } @@ -1371,27 +1500,27 @@ impl OptionalObjectHeader { #[cfg_attr(feature = "conversion", derive(LabelledGeneric))] pub struct RequiredObjectHeader(bool); -impl ::std::convert::From for RequiredObjectHeader { +impl std::convert::From for RequiredObjectHeader { fn from(x: bool) -> Self { RequiredObjectHeader(x) } } -impl ::std::convert::From for bool { +impl std::convert::From for bool { fn from(x: RequiredObjectHeader) -> Self { x.0 } } -impl ::std::ops::Deref for RequiredObjectHeader { +impl std::ops::Deref for RequiredObjectHeader { type Target = bool; fn deref(&self) -> &bool { &self.0 } } -impl ::std::ops::DerefMut for RequiredObjectHeader { +impl std::ops::DerefMut for RequiredObjectHeader { fn deref_mut(&mut self) -> &mut bool { &mut self.0 } @@ -1407,6 +1536,52 @@ impl RequiredObjectHeader { } } +#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize, Deserialize)] +#[cfg_attr(feature = "conversion", derive(LabelledGeneric))] +pub struct Result(String); + +impl std::convert::From for Result { + fn from(x: String) -> Self { + Result(x) + } +} + +impl std::str::FromStr for Result { + type Err = std::string::ParseError; + fn from_str(x: &str) -> std::result::Result { + std::result::Result::Ok(Result(x.to_string())) + } +} + +impl std::convert::From for String { + fn from(x: Result) -> Self { + x.0 + } +} + +impl std::ops::Deref for Result { + type Target = String; + fn deref(&self) -> &String { + &self.0 + } +} + +impl std::ops::DerefMut for Result { + fn deref_mut(&mut self) -> &mut String { + &mut self.0 + } +} + + +impl Result { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + /// Enumeration of values. /// Since this enum's variants do not hold data, we can easily define them them as `#[repr(C)]` /// which helps with FFI. @@ -1421,8 +1596,8 @@ pub enum StringEnum { BAR, } -impl ::std::fmt::Display for StringEnum { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { +impl std::fmt::Display for StringEnum { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match *self { StringEnum::FOO => write!(f, "{}", "FOO"), StringEnum::BAR => write!(f, "{}", "BAR"), @@ -1430,14 +1605,14 @@ impl ::std::fmt::Display for StringEnum { } } -impl ::std::str::FromStr for StringEnum { +impl std::str::FromStr for StringEnum { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { match s { - "FOO" => Ok(StringEnum::FOO), - "BAR" => Ok(StringEnum::BAR), - _ => Err(format!("Value not valid: {}", s)), + "FOO" => std::result::Result::Ok(StringEnum::FOO), + "BAR" => std::result::Result::Ok(StringEnum::BAR), + _ => std::result::Result::Err(format!("Value not valid: {}", s)), } } } @@ -1455,33 +1630,33 @@ impl StringEnum { #[cfg_attr(feature = "conversion", derive(LabelledGeneric))] pub struct StringObject(String); -impl ::std::convert::From for StringObject { +impl std::convert::From for StringObject { fn from(x: String) -> Self { StringObject(x) } } impl std::str::FromStr for StringObject { - type Err = ParseError; - fn from_str(x: &str) -> Result { - Ok(StringObject(x.to_string())) + type Err = std::string::ParseError; + fn from_str(x: &str) -> std::result::Result { + std::result::Result::Ok(StringObject(x.to_string())) } } -impl ::std::convert::From for String { +impl std::convert::From for String { fn from(x: StringObject) -> Self { x.0 } } -impl ::std::ops::Deref for StringObject { +impl std::ops::Deref for StringObject { type Target = String; fn deref(&self) -> &String { &self.0 } } -impl ::std::ops::DerefMut for StringObject { +impl std::ops::DerefMut for StringObject { fn deref_mut(&mut self) -> &mut String { &mut self.0 } @@ -1502,27 +1677,27 @@ impl StringObject { #[cfg_attr(feature = "conversion", derive(LabelledGeneric))] pub struct UuidObject(uuid::Uuid); -impl ::std::convert::From for UuidObject { +impl std::convert::From for UuidObject { fn from(x: uuid::Uuid) -> Self { UuidObject(x) } } -impl ::std::convert::From for uuid::Uuid { +impl std::convert::From for uuid::Uuid { fn from(x: UuidObject) -> Self { x.0 } } -impl ::std::ops::Deref for UuidObject { +impl std::ops::Deref for UuidObject { type Target = uuid::Uuid; fn deref(&self) -> &uuid::Uuid { &self.0 } } -impl ::std::ops::DerefMut for UuidObject { +impl std::ops::DerefMut for UuidObject { fn deref_mut(&mut self) -> &mut uuid::Uuid { &mut self.0 } @@ -1538,25 +1713,25 @@ impl UuidObject { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(XmlArray::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } // Utility function for wrapping list elements when serializing xml #[allow(non_snake_case)] -fn wrap_in_camelXmlInner(item: &Vec, serializer: S) -> Result +fn wrap_in_camelXmlInner(item: &Vec, serializer: S) -> std::result::Result where - S: Serializer, + S: serde::ser::Serializer, { serde_xml_rs::wrap_primitives(item, serializer, "camelXmlInner") } @@ -1565,59 +1740,59 @@ where #[cfg_attr(feature = "conversion", derive(LabelledGeneric))] pub struct XmlArray(#[serde(serialize_with = "wrap_in_camelXmlInner")]Vec); -impl ::std::convert::From> for XmlArray { +impl std::convert::From> for XmlArray { fn from(x: Vec) -> Self { XmlArray(x) } } -impl ::std::convert::From for Vec { +impl std::convert::From for Vec { fn from(x: XmlArray) -> Self { x.0 } } -impl ::std::iter::FromIterator for XmlArray { +impl std::iter::FromIterator for XmlArray { fn from_iter>(u: U) -> Self { XmlArray(Vec::::from_iter(u)) } } -impl ::std::iter::IntoIterator for XmlArray { +impl std::iter::IntoIterator for XmlArray { type Item = String; - type IntoIter = ::std::vec::IntoIter; + type IntoIter = std::vec::IntoIter; fn into_iter(self) -> Self::IntoIter { self.0.into_iter() } } -impl<'a> ::std::iter::IntoIterator for &'a XmlArray { +impl<'a> std::iter::IntoIterator for &'a XmlArray { type Item = &'a String; - type IntoIter = ::std::slice::Iter<'a, String>; + type IntoIter = std::slice::Iter<'a, String>; fn into_iter(self) -> Self::IntoIter { (&self.0).into_iter() } } -impl<'a> ::std::iter::IntoIterator for &'a mut XmlArray { +impl<'a> std::iter::IntoIterator for &'a mut XmlArray { type Item = &'a mut String; - type IntoIter = ::std::slice::IterMut<'a, String>; + type IntoIter = std::slice::IterMut<'a, String>; fn into_iter(self) -> Self::IntoIter { (&mut self.0).into_iter() } } -impl ::std::ops::Deref for XmlArray { +impl std::ops::Deref for XmlArray { type Target = Vec; fn deref(&self) -> &Self::Target { &self.0 } } -impl ::std::ops::DerefMut for XmlArray { +impl std::ops::DerefMut for XmlArray { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } @@ -1626,7 +1801,7 @@ impl ::std::ops::DerefMut for XmlArray { /// Converts the XmlArray value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for XmlArray { +impl std::string::ToString for XmlArray { fn to_string(&self) -> String { self.iter().map(|x| x.to_string()).collect::>().join(",").to_string() } @@ -1635,16 +1810,16 @@ impl ::std::string::ToString for XmlArray { /// Converts Query Parameters representation (style=form, explode=false) to a XmlArray value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for XmlArray { - type Err = ::Err; +impl std::str::FromStr for XmlArray { + type Err = ::Err; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { let mut items = vec![]; for item in s.split(',') { items.push(item.parse()?); } - Ok(XmlArray(items)) + std::result::Result::Ok(XmlArray(items)) } } @@ -1663,33 +1838,33 @@ impl XmlArray { #[serde(rename = "camelXmlInner")] pub struct XmlInner(String); -impl ::std::convert::From for XmlInner { +impl std::convert::From for XmlInner { fn from(x: String) -> Self { XmlInner(x) } } impl std::str::FromStr for XmlInner { - type Err = ParseError; - fn from_str(x: &str) -> Result { - Ok(XmlInner(x.to_string())) + type Err = std::string::ParseError; + fn from_str(x: &str) -> std::result::Result { + std::result::Result::Ok(XmlInner(x.to_string())) } } -impl ::std::convert::From for String { +impl std::convert::From for String { fn from(x: XmlInner) -> Self { x.0 } } -impl ::std::ops::Deref for XmlInner { +impl std::ops::Deref for XmlInner { type Target = String; fn deref(&self) -> &String { &self.0 } } -impl ::std::ops::DerefMut for XmlInner { +impl std::ops::DerefMut for XmlInner { fn deref_mut(&mut self) -> &mut String { &mut self.0 } @@ -1706,17 +1881,17 @@ impl XmlInner { } /// An XML object -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(XmlObject::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -1747,7 +1922,7 @@ impl XmlObject { /// Converts the XmlObject value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for XmlObject { +impl std::string::ToString for XmlObject { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -1769,10 +1944,10 @@ impl ::std::string::ToString for XmlObject { /// Converts Query Parameters representation (style=form, explode=false) to a XmlObject value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for XmlObject { +impl std::str::FromStr for XmlObject { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -1789,14 +1964,14 @@ impl ::std::str::FromStr for XmlObject { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing XmlObject".to_string()) + None => return std::result::Result::Err("Missing value while parsing XmlObject".to_string()) }; if let Some(key) = key_result { match key { "innerString" => intermediate_rep.inner_string.push(String::from_str(val).map_err(|x| format!("{}", x))?), "other_inner_rename" => intermediate_rep.other_inner_rename.push(isize::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing XmlObject".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing XmlObject".to_string()) } } @@ -1805,7 +1980,7 @@ impl ::std::str::FromStr for XmlObject { } // Use the intermediate representation to return the struct - Ok(XmlObject { + std::result::Result::Ok(XmlObject { inner_string: intermediate_rep.inner_string.into_iter().next(), other_inner_rename: intermediate_rep.other_inner_rename.into_iter().next(), }) @@ -1824,7 +1999,7 @@ impl XmlObject { /// Will panic if serialisation fails. #[allow(dead_code)] pub(crate) fn to_xml(&self) -> String { - let mut namespaces = BTreeMap::new(); + let mut namespaces = std::collections::BTreeMap::new(); // An empty string is used to indicate a global namespace in xmltree. namespaces.insert("".to_string(), Self::NAMESPACE.to_string()); serde_xml_rs::to_string_with_namespaces(&self, namespaces).expect("impossible to fail to serialize") diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/server/callbacks.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/server/callbacks.rs index c07af6a9eff..5518448ae6a 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/server/callbacks.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/server/callbacks.rs @@ -8,8 +8,6 @@ use hyper::{Body, Uri, Response}; use hyper_openssl::HttpsConnector; use serde_json; use std::borrow::Cow; -#[allow(unused_imports)] -use std::collections::{HashMap, BTreeMap}; use std::io::{Read, Error, ErrorKind}; use std::error; use std::fmt; diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs index c29321dce02..eaaeabd4de2 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs @@ -1,5 +1,3 @@ -#[allow(unused_imports)] -use std::collections::{HashMap, BTreeMap, BTreeSet}; use std::marker::PhantomData; use futures::{Future, future, Stream, stream}; use hyper; @@ -511,7 +509,7 @@ where // Authorization if let Scopes::Some(ref scopes) = authorization.scopes { - let required_scopes: BTreeSet = vec![ + let required_scopes: std::collections::BTreeSet = vec![ "test.read".to_string(), // Allowed to read state. "test.write".to_string(), // Allowed to change state. ].into_iter().collect(); @@ -671,7 +669,7 @@ where // Authorization if let Scopes::Some(ref scopes) = authorization.scopes { - let required_scopes: BTreeSet = vec![ + let required_scopes: std::collections::BTreeSet = vec![ "test.read".to_string(), // Allowed to read state. ].into_iter().collect(); diff --git a/samples/server/petstore/rust-server/output/ops-v3/examples/server/server.rs b/samples/server/petstore/rust-server/output/ops-v3/examples/server/server.rs index 701f0c9a0ef..1ac82d33f92 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/examples/server/server.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/examples/server/server.rs @@ -13,7 +13,6 @@ use futures::{future, Future, Stream}; use hyper::server::conn::Http; use hyper::service::MakeService as _; use openssl::ssl::SslAcceptorBuilder; -use std::collections::HashMap; use std::marker::PhantomData; use std::net::SocketAddr; use std::sync::{Arc, Mutex}; diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/ops-v3/src/client/mod.rs index e30b0008b9f..bf742b46319 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/client/mod.rs @@ -8,8 +8,6 @@ use hyper::{Body, Uri, Response}; use hyper_openssl::HttpsConnector; use serde_json; use std::borrow::Cow; -#[allow(unused_imports)] -use std::collections::{HashMap, BTreeMap}; use std::io::{Read, Error, ErrorKind}; use std::error; use std::fmt; diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs b/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs index 094557b8b57..f5c05a844f4 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs @@ -56,9 +56,6 @@ use hyper::header::HeaderValue; use futures::Stream; use std::io::Error; -#[allow(unused_imports)] -use std::collections::HashMap; - #[deprecated(note = "Import swagger-rs directly")] pub use swagger::{ApiError, ContextWrapper}; #[deprecated(note = "Import futures directly")] diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/models.rs b/samples/server/petstore/rust-server/output/ops-v3/src/models.rs index 2665d2eecdf..3b570311421 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/models.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/models.rs @@ -1,12 +1,5 @@ -#![allow(unused_imports, unused_qualifications)] +#![allow(unused_qualifications)] -use serde::ser::Serializer; - -use std::collections::HashMap; use models; -use swagger; -use hyper::header::HeaderValue; -use std::string::ParseError; -use std::str::FromStr; -use header::IntoHeaderValue; +use header; diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs index ebf9b84de3c..c12e72aff56 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs @@ -1,5 +1,3 @@ -#[allow(unused_imports)] -use std::collections::{HashMap, BTreeMap, BTreeSet}; use std::marker::PhantomData; use futures::{Future, future, Stream, stream}; use hyper; diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/AdditionalPropertiesClass.md b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/AdditionalPropertiesClass.md index f76a7457bed..2d62aa0fba9 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/AdditionalPropertiesClass.md +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/AdditionalPropertiesClass.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**map_property** | **HashMap** | | [optional] [default to None] -**map_of_map_property** | [**HashMap>**](map.md) | | [optional] [default to None] +**map_property** | **std::collections::HashMap** | | [optional] [default to None] +**map_of_map_property** | [**std::collections::HashMap>**](map.md) | | [optional] [default to None] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/MapTest.md b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/MapTest.md index a71ba00b19a..d3bdfd717a9 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/MapTest.md +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/MapTest.md @@ -3,9 +3,9 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**map_map_of_string** | [**HashMap>**](map.md) | | [optional] [default to None] -**map_map_of_enum** | [**HashMap>**](map.md) | | [optional] [default to None] -**map_of_enum_string** | **HashMap** | | [optional] [default to None] +**map_map_of_string** | [**std::collections::HashMap>**](map.md) | | [optional] [default to None] +**map_map_of_enum** | [**std::collections::HashMap>**](map.md) | | [optional] [default to None] +**map_of_enum_string** | **std::collections::HashMap** | | [optional] [default to None] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/MixedPropertiesAndAdditionalPropertiesClass.md index 5dd22af8e09..7ef09baf7a2 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **uuid** | [***uuid::Uuid**](UUID.md) | | [optional] [default to None] **date_time** | [**chrono::DateTime::**](DateTime.md) | | [optional] [default to None] -**map** | [**HashMap**](Animal.md) | | [optional] [default to None] +**map** | [**std::collections::HashMap**](Animal.md) | | [optional] [default to None] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/store_api.md b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/store_api.md index 2e4a14543b4..face667c0af 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/store_api.md +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/store_api.md @@ -38,7 +38,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **getInventory** -> HashMap getInventory(ctx, ) +> std::collections::HashMap getInventory(ctx, ) Returns pet inventories by status Returns a map of status codes to quantities @@ -48,7 +48,7 @@ This endpoint does not need any parameter. ### Return type -[**HashMap**](integer.md) +[**std::collections::HashMap**](integer.md) ### Authorization diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/server/server.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/server/server.rs index bf7a7a7bfe7..3247af4b315 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/server/server.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/server/server.rs @@ -13,7 +13,6 @@ use futures::{future, Future, Stream}; use hyper::server::conn::Http; use hyper::service::MakeService as _; use openssl::ssl::SslAcceptorBuilder; -use std::collections::HashMap; use std::marker::PhantomData; use std::net::SocketAddr; use std::sync::{Arc, Mutex}; @@ -290,7 +289,7 @@ impl Api for Server where C: Has{ /// test inline additionalProperties fn test_inline_additional_properties( &self, - param: HashMap, + param: std::collections::HashMap, context: &C) -> Box + Send> { let context = context.clone(); diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs index 960a4af6ad0..01e7bcb42dc 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs @@ -8,8 +8,6 @@ use hyper::{Body, Uri, Response}; use hyper_openssl::HttpsConnector; use serde_json; use std::borrow::Cow; -#[allow(unused_imports)] -use std::collections::{HashMap, BTreeMap}; use std::io::{Read, Error, ErrorKind}; use std::error; use std::fmt; @@ -1413,7 +1411,7 @@ impl Api for Client where fn test_inline_additional_properties( &self, - param_param: HashMap, + param_param: std::collections::HashMap, context: &C) -> Box + Send> { let mut uri = format!( @@ -2719,7 +2717,7 @@ impl Api for Client where str::from_utf8(&body) .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) .and_then(|body| - serde_json::from_str::>(body) + serde_json::from_str::>(body) .map_err(|e| e.into()) ) ) diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs index 05478fe8419..7c196adfae2 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs @@ -60,9 +60,6 @@ use hyper::header::HeaderValue; use futures::Stream; use std::io::Error; -#[allow(unused_imports)] -use std::collections::HashMap; - #[deprecated(note = "Import swagger-rs directly")] pub use swagger::{ApiError, ContextWrapper}; #[deprecated(note = "Import futures directly")] @@ -264,7 +261,7 @@ pub enum DeleteOrderResponse { pub enum GetInventoryResponse { /// successful operation SuccessfulOperation - (HashMap) + (std::collections::HashMap) } #[derive(Debug, PartialEq)] @@ -452,7 +449,7 @@ pub trait Api { /// test inline additionalProperties fn test_inline_additional_properties( &self, - param: HashMap, + param: std::collections::HashMap, context: &C) -> Box + Send>; /// test json serialization of form data @@ -682,7 +679,7 @@ pub trait ApiNoContext { /// test inline additionalProperties fn test_inline_additional_properties( &self, - param: HashMap, + param: std::collections::HashMap, ) -> Box + Send>; /// test json serialization of form data @@ -959,7 +956,7 @@ impl<'a, T: Api, C> ApiNoContext for ContextWrapper<'a, T, C> { /// test inline additionalProperties fn test_inline_additional_properties( &self, - param: HashMap, + param: std::collections::HashMap, ) -> Box + Send> { self.api().test_inline_additional_properties(param, &self.context()) diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs index 923f7fc4682..117da6bad96 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs @@ -1,29 +1,20 @@ -#![allow(unused_imports, unused_qualifications)] +#![allow(unused_qualifications)] -use serde_xml_rs; -use serde::ser::Serializer; - -use std::collections::{HashMap, BTreeMap}; use models; -use swagger; -use hyper::header::HeaderValue; -use std::string::ParseError; -use uuid; -use std::str::FromStr; -use header::IntoHeaderValue; +use header; -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(AdditionalPropertiesClass::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -33,11 +24,11 @@ impl From for IntoHeaderValue { pub struct AdditionalPropertiesClass { #[serde(rename = "map_property")] #[serde(skip_serializing_if="Option::is_none")] - pub map_property: Option>, + pub map_property: Option>, #[serde(rename = "map_of_map_property")] #[serde(skip_serializing_if="Option::is_none")] - pub map_of_map_property: Option>>, + pub map_of_map_property: Option>>, } @@ -53,7 +44,7 @@ impl AdditionalPropertiesClass { /// Converts the AdditionalPropertiesClass value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for AdditionalPropertiesClass { +impl std::string::ToString for AdditionalPropertiesClass { fn to_string(&self) -> String { let mut params: Vec = vec![]; // Skipping map_property in query parameter serialization @@ -68,15 +59,15 @@ impl ::std::string::ToString for AdditionalPropertiesClass { /// Converts Query Parameters representation (style=form, explode=false) to a AdditionalPropertiesClass value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for AdditionalPropertiesClass { +impl std::str::FromStr for AdditionalPropertiesClass { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { - pub map_property: Vec>, - pub map_of_map_property: Vec>>, + pub map_property: Vec>, + pub map_of_map_property: Vec>>, } let mut intermediate_rep = IntermediateRep::default(); @@ -88,14 +79,14 @@ impl ::std::str::FromStr for AdditionalPropertiesClass { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing AdditionalPropertiesClass".to_string()) + None => return std::result::Result::Err("Missing value while parsing AdditionalPropertiesClass".to_string()) }; if let Some(key) = key_result { match key { - "map_property" => return Err("Parsing a container in this style is not supported in AdditionalPropertiesClass".to_string()), - "map_of_map_property" => return Err("Parsing a container in this style is not supported in AdditionalPropertiesClass".to_string()), - _ => return Err("Unexpected key while parsing AdditionalPropertiesClass".to_string()) + "map_property" => return std::result::Result::Err("Parsing a container in this style is not supported in AdditionalPropertiesClass".to_string()), + "map_of_map_property" => return std::result::Result::Err("Parsing a container in this style is not supported in AdditionalPropertiesClass".to_string()), + _ => return std::result::Result::Err("Unexpected key while parsing AdditionalPropertiesClass".to_string()) } } @@ -104,7 +95,7 @@ impl ::std::str::FromStr for AdditionalPropertiesClass { } // Use the intermediate representation to return the struct - Ok(AdditionalPropertiesClass { + std::result::Result::Ok(AdditionalPropertiesClass { map_property: intermediate_rep.map_property.into_iter().next(), map_of_map_property: intermediate_rep.map_of_map_property.into_iter().next(), }) @@ -121,17 +112,17 @@ impl AdditionalPropertiesClass { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(Animal::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -160,7 +151,7 @@ impl Animal { /// Converts the Animal value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for Animal { +impl std::string::ToString for Animal { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -180,10 +171,10 @@ impl ::std::string::ToString for Animal { /// Converts Query Parameters representation (style=form, explode=false) to a Animal value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for Animal { +impl std::str::FromStr for Animal { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -200,14 +191,14 @@ impl ::std::str::FromStr for Animal { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing Animal".to_string()) + None => return std::result::Result::Err("Missing value while parsing Animal".to_string()) }; if let Some(key) = key_result { match key { "className" => intermediate_rep.class_name.push(String::from_str(val).map_err(|x| format!("{}", x))?), "color" => intermediate_rep.color.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing Animal".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing Animal".to_string()) } } @@ -216,7 +207,7 @@ impl ::std::str::FromStr for Animal { } // Use the intermediate representation to return the struct - Ok(Animal { + std::result::Result::Ok(Animal { class_name: intermediate_rep.class_name.into_iter().next().ok_or("className missing in Animal".to_string())?, color: intermediate_rep.color.into_iter().next(), }) @@ -233,17 +224,17 @@ impl Animal { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(AnimalFarm::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -251,59 +242,59 @@ impl From for IntoHeaderValue { #[cfg_attr(feature = "conversion", derive(LabelledGeneric))] pub struct AnimalFarm(Vec); -impl ::std::convert::From> for AnimalFarm { +impl std::convert::From> for AnimalFarm { fn from(x: Vec) -> Self { AnimalFarm(x) } } -impl ::std::convert::From for Vec { +impl std::convert::From for Vec { fn from(x: AnimalFarm) -> Self { x.0 } } -impl ::std::iter::FromIterator for AnimalFarm { +impl std::iter::FromIterator for AnimalFarm { fn from_iter>(u: U) -> Self { AnimalFarm(Vec::::from_iter(u)) } } -impl ::std::iter::IntoIterator for AnimalFarm { +impl std::iter::IntoIterator for AnimalFarm { type Item = Animal; - type IntoIter = ::std::vec::IntoIter; + type IntoIter = std::vec::IntoIter; fn into_iter(self) -> Self::IntoIter { self.0.into_iter() } } -impl<'a> ::std::iter::IntoIterator for &'a AnimalFarm { +impl<'a> std::iter::IntoIterator for &'a AnimalFarm { type Item = &'a Animal; - type IntoIter = ::std::slice::Iter<'a, Animal>; + type IntoIter = std::slice::Iter<'a, Animal>; fn into_iter(self) -> Self::IntoIter { (&self.0).into_iter() } } -impl<'a> ::std::iter::IntoIterator for &'a mut AnimalFarm { +impl<'a> std::iter::IntoIterator for &'a mut AnimalFarm { type Item = &'a mut Animal; - type IntoIter = ::std::slice::IterMut<'a, Animal>; + type IntoIter = std::slice::IterMut<'a, Animal>; fn into_iter(self) -> Self::IntoIter { (&mut self.0).into_iter() } } -impl ::std::ops::Deref for AnimalFarm { +impl std::ops::Deref for AnimalFarm { type Target = Vec; fn deref(&self) -> &Self::Target { &self.0 } } -impl ::std::ops::DerefMut for AnimalFarm { +impl std::ops::DerefMut for AnimalFarm { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } @@ -312,7 +303,7 @@ impl ::std::ops::DerefMut for AnimalFarm { /// Converts the AnimalFarm value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for AnimalFarm { +impl std::string::ToString for AnimalFarm { fn to_string(&self) -> String { self.iter().map(|x| x.to_string()).collect::>().join(",").to_string() } @@ -321,16 +312,16 @@ impl ::std::string::ToString for AnimalFarm { /// Converts Query Parameters representation (style=form, explode=false) to a AnimalFarm value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for AnimalFarm { - type Err = ::Err; +impl std::str::FromStr for AnimalFarm { + type Err = ::Err; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { let mut items = vec![]; for item in s.split(',') { items.push(item.parse()?); } - Ok(AnimalFarm(items)) + std::result::Result::Ok(AnimalFarm(items)) } } @@ -344,17 +335,17 @@ impl AnimalFarm { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(ApiResponse::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -389,7 +380,7 @@ impl ApiResponse { /// Converts the ApiResponse value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for ApiResponse { +impl std::string::ToString for ApiResponse { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -417,10 +408,10 @@ impl ::std::string::ToString for ApiResponse { /// Converts Query Parameters representation (style=form, explode=false) to a ApiResponse value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for ApiResponse { +impl std::str::FromStr for ApiResponse { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -438,7 +429,7 @@ impl ::std::str::FromStr for ApiResponse { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing ApiResponse".to_string()) + None => return std::result::Result::Err("Missing value while parsing ApiResponse".to_string()) }; if let Some(key) = key_result { @@ -446,7 +437,7 @@ impl ::std::str::FromStr for ApiResponse { "code" => intermediate_rep.code.push(i32::from_str(val).map_err(|x| format!("{}", x))?), "type" => intermediate_rep.type_.push(String::from_str(val).map_err(|x| format!("{}", x))?), "message" => intermediate_rep.message.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing ApiResponse".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing ApiResponse".to_string()) } } @@ -455,7 +446,7 @@ impl ::std::str::FromStr for ApiResponse { } // Use the intermediate representation to return the struct - Ok(ApiResponse { + std::result::Result::Ok(ApiResponse { code: intermediate_rep.code.into_iter().next(), type_: intermediate_rep.type_.into_iter().next(), message: intermediate_rep.message.into_iter().next(), @@ -473,17 +464,17 @@ impl ApiResponse { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(ArrayOfArrayOfNumberOnly::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -508,7 +499,7 @@ impl ArrayOfArrayOfNumberOnly { /// Converts the ArrayOfArrayOfNumberOnly value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for ArrayOfArrayOfNumberOnly { +impl std::string::ToString for ArrayOfArrayOfNumberOnly { fn to_string(&self) -> String { let mut params: Vec = vec![]; // Skipping ArrayArrayNumber in query parameter serialization @@ -520,10 +511,10 @@ impl ::std::string::ToString for ArrayOfArrayOfNumberOnly { /// Converts Query Parameters representation (style=form, explode=false) to a ArrayOfArrayOfNumberOnly value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for ArrayOfArrayOfNumberOnly { +impl std::str::FromStr for ArrayOfArrayOfNumberOnly { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -539,13 +530,13 @@ impl ::std::str::FromStr for ArrayOfArrayOfNumberOnly { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing ArrayOfArrayOfNumberOnly".to_string()) + None => return std::result::Result::Err("Missing value while parsing ArrayOfArrayOfNumberOnly".to_string()) }; if let Some(key) = key_result { match key { - "ArrayArrayNumber" => return Err("Parsing a container in this style is not supported in ArrayOfArrayOfNumberOnly".to_string()), - _ => return Err("Unexpected key while parsing ArrayOfArrayOfNumberOnly".to_string()) + "ArrayArrayNumber" => return std::result::Result::Err("Parsing a container in this style is not supported in ArrayOfArrayOfNumberOnly".to_string()), + _ => return std::result::Result::Err("Unexpected key while parsing ArrayOfArrayOfNumberOnly".to_string()) } } @@ -554,7 +545,7 @@ impl ::std::str::FromStr for ArrayOfArrayOfNumberOnly { } // Use the intermediate representation to return the struct - Ok(ArrayOfArrayOfNumberOnly { + std::result::Result::Ok(ArrayOfArrayOfNumberOnly { array_array_number: intermediate_rep.array_array_number.into_iter().next(), }) } @@ -570,17 +561,17 @@ impl ArrayOfArrayOfNumberOnly { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(ArrayOfNumberOnly::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -605,7 +596,7 @@ impl ArrayOfNumberOnly { /// Converts the ArrayOfNumberOnly value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for ArrayOfNumberOnly { +impl std::string::ToString for ArrayOfNumberOnly { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -621,10 +612,10 @@ impl ::std::string::ToString for ArrayOfNumberOnly { /// Converts Query Parameters representation (style=form, explode=false) to a ArrayOfNumberOnly value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for ArrayOfNumberOnly { +impl std::str::FromStr for ArrayOfNumberOnly { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -640,13 +631,13 @@ impl ::std::str::FromStr for ArrayOfNumberOnly { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing ArrayOfNumberOnly".to_string()) + None => return std::result::Result::Err("Missing value while parsing ArrayOfNumberOnly".to_string()) }; if let Some(key) = key_result { match key { - "ArrayNumber" => return Err("Parsing a container in this style is not supported in ArrayOfNumberOnly".to_string()), - _ => return Err("Unexpected key while parsing ArrayOfNumberOnly".to_string()) + "ArrayNumber" => return std::result::Result::Err("Parsing a container in this style is not supported in ArrayOfNumberOnly".to_string()), + _ => return std::result::Result::Err("Unexpected key while parsing ArrayOfNumberOnly".to_string()) } } @@ -655,7 +646,7 @@ impl ::std::str::FromStr for ArrayOfNumberOnly { } // Use the intermediate representation to return the struct - Ok(ArrayOfNumberOnly { + std::result::Result::Ok(ArrayOfNumberOnly { array_number: intermediate_rep.array_number.into_iter().next(), }) } @@ -671,17 +662,17 @@ impl ArrayOfNumberOnly { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(ArrayTest::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -722,7 +713,7 @@ impl ArrayTest { /// Converts the ArrayTest value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for ArrayTest { +impl std::string::ToString for ArrayTest { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -748,10 +739,10 @@ impl ::std::string::ToString for ArrayTest { /// Converts Query Parameters representation (style=form, explode=false) to a ArrayTest value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for ArrayTest { +impl std::str::FromStr for ArrayTest { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -770,16 +761,16 @@ impl ::std::str::FromStr for ArrayTest { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing ArrayTest".to_string()) + None => return std::result::Result::Err("Missing value while parsing ArrayTest".to_string()) }; if let Some(key) = key_result { match key { - "array_of_string" => return Err("Parsing a container in this style is not supported in ArrayTest".to_string()), - "array_array_of_integer" => return Err("Parsing a container in this style is not supported in ArrayTest".to_string()), - "array_array_of_model" => return Err("Parsing a container in this style is not supported in ArrayTest".to_string()), - "array_of_enum" => return Err("Parsing a container in this style is not supported in ArrayTest".to_string()), - _ => return Err("Unexpected key while parsing ArrayTest".to_string()) + "array_of_string" => return std::result::Result::Err("Parsing a container in this style is not supported in ArrayTest".to_string()), + "array_array_of_integer" => return std::result::Result::Err("Parsing a container in this style is not supported in ArrayTest".to_string()), + "array_array_of_model" => return std::result::Result::Err("Parsing a container in this style is not supported in ArrayTest".to_string()), + "array_of_enum" => return std::result::Result::Err("Parsing a container in this style is not supported in ArrayTest".to_string()), + _ => return std::result::Result::Err("Unexpected key while parsing ArrayTest".to_string()) } } @@ -788,7 +779,7 @@ impl ::std::str::FromStr for ArrayTest { } // Use the intermediate representation to return the struct - Ok(ArrayTest { + std::result::Result::Ok(ArrayTest { array_of_string: intermediate_rep.array_of_string.into_iter().next(), array_array_of_integer: intermediate_rep.array_array_of_integer.into_iter().next(), array_array_of_model: intermediate_rep.array_array_of_model.into_iter().next(), @@ -807,17 +798,17 @@ impl ArrayTest { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(Capitalization::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -868,7 +859,7 @@ impl Capitalization { /// Converts the Capitalization value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for Capitalization { +impl std::string::ToString for Capitalization { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -914,10 +905,10 @@ impl ::std::string::ToString for Capitalization { /// Converts Query Parameters representation (style=form, explode=false) to a Capitalization value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for Capitalization { +impl std::str::FromStr for Capitalization { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -938,7 +929,7 @@ impl ::std::str::FromStr for Capitalization { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing Capitalization".to_string()) + None => return std::result::Result::Err("Missing value while parsing Capitalization".to_string()) }; if let Some(key) = key_result { @@ -949,7 +940,7 @@ impl ::std::str::FromStr for Capitalization { "Capital_Snake" => intermediate_rep.capital_snake.push(String::from_str(val).map_err(|x| format!("{}", x))?), "SCA_ETH_Flow_Points" => intermediate_rep.sca_eth_flow_points.push(String::from_str(val).map_err(|x| format!("{}", x))?), "ATT_NAME" => intermediate_rep.att_name.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing Capitalization".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing Capitalization".to_string()) } } @@ -958,7 +949,7 @@ impl ::std::str::FromStr for Capitalization { } // Use the intermediate representation to return the struct - Ok(Capitalization { + std::result::Result::Ok(Capitalization { small_camel: intermediate_rep.small_camel.into_iter().next(), capital_camel: intermediate_rep.capital_camel.into_iter().next(), small_snake: intermediate_rep.small_snake.into_iter().next(), @@ -979,17 +970,17 @@ impl Capitalization { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(Cat::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -1023,7 +1014,7 @@ impl Cat { /// Converts the Cat value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for Cat { +impl std::string::ToString for Cat { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -1049,10 +1040,10 @@ impl ::std::string::ToString for Cat { /// Converts Query Parameters representation (style=form, explode=false) to a Cat value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for Cat { +impl std::str::FromStr for Cat { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -1070,7 +1061,7 @@ impl ::std::str::FromStr for Cat { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing Cat".to_string()) + None => return std::result::Result::Err("Missing value while parsing Cat".to_string()) }; if let Some(key) = key_result { @@ -1078,7 +1069,7 @@ impl ::std::str::FromStr for Cat { "className" => intermediate_rep.class_name.push(String::from_str(val).map_err(|x| format!("{}", x))?), "color" => intermediate_rep.color.push(String::from_str(val).map_err(|x| format!("{}", x))?), "declawed" => intermediate_rep.declawed.push(bool::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing Cat".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing Cat".to_string()) } } @@ -1087,7 +1078,7 @@ impl ::std::str::FromStr for Cat { } // Use the intermediate representation to return the struct - Ok(Cat { + std::result::Result::Ok(Cat { class_name: intermediate_rep.class_name.into_iter().next().ok_or("className missing in Cat".to_string())?, color: intermediate_rep.color.into_iter().next(), declawed: intermediate_rep.declawed.into_iter().next(), @@ -1105,17 +1096,17 @@ impl Cat { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(CatAllOf::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -1140,7 +1131,7 @@ impl CatAllOf { /// Converts the CatAllOf value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for CatAllOf { +impl std::string::ToString for CatAllOf { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -1156,10 +1147,10 @@ impl ::std::string::ToString for CatAllOf { /// Converts Query Parameters representation (style=form, explode=false) to a CatAllOf value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for CatAllOf { +impl std::str::FromStr for CatAllOf { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -1175,13 +1166,13 @@ impl ::std::str::FromStr for CatAllOf { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing CatAllOf".to_string()) + None => return std::result::Result::Err("Missing value while parsing CatAllOf".to_string()) }; if let Some(key) = key_result { match key { "declawed" => intermediate_rep.declawed.push(bool::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing CatAllOf".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing CatAllOf".to_string()) } } @@ -1190,7 +1181,7 @@ impl ::std::str::FromStr for CatAllOf { } // Use the intermediate representation to return the struct - Ok(CatAllOf { + std::result::Result::Ok(CatAllOf { declawed: intermediate_rep.declawed.into_iter().next(), }) } @@ -1206,17 +1197,17 @@ impl CatAllOf { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(Category::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -1247,7 +1238,7 @@ impl Category { /// Converts the Category value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for Category { +impl std::string::ToString for Category { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -1269,10 +1260,10 @@ impl ::std::string::ToString for Category { /// Converts Query Parameters representation (style=form, explode=false) to a Category value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for Category { +impl std::str::FromStr for Category { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -1289,14 +1280,14 @@ impl ::std::str::FromStr for Category { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing Category".to_string()) + None => return std::result::Result::Err("Missing value while parsing Category".to_string()) }; if let Some(key) = key_result { match key { "id" => intermediate_rep.id.push(i64::from_str(val).map_err(|x| format!("{}", x))?), "name" => intermediate_rep.name.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing Category".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing Category".to_string()) } } @@ -1305,7 +1296,7 @@ impl ::std::str::FromStr for Category { } // Use the intermediate representation to return the struct - Ok(Category { + std::result::Result::Ok(Category { id: intermediate_rep.id.into_iter().next(), name: intermediate_rep.name.into_iter().next(), }) @@ -1323,17 +1314,17 @@ impl Category { } /// Model for testing model with \"_class\" property -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(ClassModel::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -1358,7 +1349,7 @@ impl ClassModel { /// Converts the ClassModel value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for ClassModel { +impl std::string::ToString for ClassModel { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -1374,10 +1365,10 @@ impl ::std::string::ToString for ClassModel { /// Converts Query Parameters representation (style=form, explode=false) to a ClassModel value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for ClassModel { +impl std::str::FromStr for ClassModel { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -1393,13 +1384,13 @@ impl ::std::str::FromStr for ClassModel { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing ClassModel".to_string()) + None => return std::result::Result::Err("Missing value while parsing ClassModel".to_string()) }; if let Some(key) = key_result { match key { "_class" => intermediate_rep._class.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing ClassModel".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing ClassModel".to_string()) } } @@ -1408,7 +1399,7 @@ impl ::std::str::FromStr for ClassModel { } // Use the intermediate representation to return the struct - Ok(ClassModel { + std::result::Result::Ok(ClassModel { _class: intermediate_rep._class.into_iter().next(), }) } @@ -1424,17 +1415,17 @@ impl ClassModel { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(Client::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -1459,7 +1450,7 @@ impl Client { /// Converts the Client value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for Client { +impl std::string::ToString for Client { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -1475,10 +1466,10 @@ impl ::std::string::ToString for Client { /// Converts Query Parameters representation (style=form, explode=false) to a Client value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for Client { +impl std::str::FromStr for Client { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -1494,13 +1485,13 @@ impl ::std::str::FromStr for Client { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing Client".to_string()) + None => return std::result::Result::Err("Missing value while parsing Client".to_string()) }; if let Some(key) = key_result { match key { "client" => intermediate_rep.client.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing Client".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing Client".to_string()) } } @@ -1509,7 +1500,7 @@ impl ::std::str::FromStr for Client { } // Use the intermediate representation to return the struct - Ok(Client { + std::result::Result::Ok(Client { client: intermediate_rep.client.into_iter().next(), }) } @@ -1525,17 +1516,17 @@ impl Client { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(Dog::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -1569,7 +1560,7 @@ impl Dog { /// Converts the Dog value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for Dog { +impl std::string::ToString for Dog { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -1595,10 +1586,10 @@ impl ::std::string::ToString for Dog { /// Converts Query Parameters representation (style=form, explode=false) to a Dog value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for Dog { +impl std::str::FromStr for Dog { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -1616,7 +1607,7 @@ impl ::std::str::FromStr for Dog { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing Dog".to_string()) + None => return std::result::Result::Err("Missing value while parsing Dog".to_string()) }; if let Some(key) = key_result { @@ -1624,7 +1615,7 @@ impl ::std::str::FromStr for Dog { "className" => intermediate_rep.class_name.push(String::from_str(val).map_err(|x| format!("{}", x))?), "color" => intermediate_rep.color.push(String::from_str(val).map_err(|x| format!("{}", x))?), "breed" => intermediate_rep.breed.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing Dog".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing Dog".to_string()) } } @@ -1633,7 +1624,7 @@ impl ::std::str::FromStr for Dog { } // Use the intermediate representation to return the struct - Ok(Dog { + std::result::Result::Ok(Dog { class_name: intermediate_rep.class_name.into_iter().next().ok_or("className missing in Dog".to_string())?, color: intermediate_rep.color.into_iter().next(), breed: intermediate_rep.breed.into_iter().next(), @@ -1651,17 +1642,17 @@ impl Dog { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(DogAllOf::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -1686,7 +1677,7 @@ impl DogAllOf { /// Converts the DogAllOf value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for DogAllOf { +impl std::string::ToString for DogAllOf { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -1702,10 +1693,10 @@ impl ::std::string::ToString for DogAllOf { /// Converts Query Parameters representation (style=form, explode=false) to a DogAllOf value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for DogAllOf { +impl std::str::FromStr for DogAllOf { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -1721,13 +1712,13 @@ impl ::std::str::FromStr for DogAllOf { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing DogAllOf".to_string()) + None => return std::result::Result::Err("Missing value while parsing DogAllOf".to_string()) }; if let Some(key) = key_result { match key { "breed" => intermediate_rep.breed.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing DogAllOf".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing DogAllOf".to_string()) } } @@ -1736,7 +1727,7 @@ impl ::std::str::FromStr for DogAllOf { } // Use the intermediate representation to return the struct - Ok(DogAllOf { + std::result::Result::Ok(DogAllOf { breed: intermediate_rep.breed.into_iter().next(), }) } @@ -1752,17 +1743,17 @@ impl DogAllOf { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(EnumArrays::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -1800,7 +1791,7 @@ impl EnumArrays { /// Converts the EnumArrays value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for EnumArrays { +impl std::string::ToString for EnumArrays { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -1824,10 +1815,10 @@ impl ::std::string::ToString for EnumArrays { /// Converts Query Parameters representation (style=form, explode=false) to a EnumArrays value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for EnumArrays { +impl std::str::FromStr for EnumArrays { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -1845,15 +1836,15 @@ impl ::std::str::FromStr for EnumArrays { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing EnumArrays".to_string()) + None => return std::result::Result::Err("Missing value while parsing EnumArrays".to_string()) }; if let Some(key) = key_result { match key { "just_symbol" => intermediate_rep.just_symbol.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "array_enum" => return Err("Parsing a container in this style is not supported in EnumArrays".to_string()), - "array_array_enum" => return Err("Parsing a container in this style is not supported in EnumArrays".to_string()), - _ => return Err("Unexpected key while parsing EnumArrays".to_string()) + "array_enum" => return std::result::Result::Err("Parsing a container in this style is not supported in EnumArrays".to_string()), + "array_array_enum" => return std::result::Result::Err("Parsing a container in this style is not supported in EnumArrays".to_string()), + _ => return std::result::Result::Err("Unexpected key while parsing EnumArrays".to_string()) } } @@ -1862,7 +1853,7 @@ impl ::std::str::FromStr for EnumArrays { } // Use the intermediate representation to return the struct - Ok(EnumArrays { + std::result::Result::Ok(EnumArrays { just_symbol: intermediate_rep.just_symbol.into_iter().next(), array_enum: intermediate_rep.array_enum.into_iter().next(), array_array_enum: intermediate_rep.array_array_enum.into_iter().next(), @@ -1896,8 +1887,8 @@ pub enum EnumClass { _XYZ_, } -impl ::std::fmt::Display for EnumClass { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { +impl std::fmt::Display for EnumClass { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match *self { EnumClass::_ABC => write!(f, "{}", "_abc"), EnumClass::_EFG => write!(f, "{}", "-efg"), @@ -1906,15 +1897,15 @@ impl ::std::fmt::Display for EnumClass { } } -impl ::std::str::FromStr for EnumClass { +impl std::str::FromStr for EnumClass { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { match s { - "_abc" => Ok(EnumClass::_ABC), - "-efg" => Ok(EnumClass::_EFG), - "(xyz)" => Ok(EnumClass::_XYZ_), - _ => Err(format!("Value not valid: {}", s)), + "_abc" => std::result::Result::Ok(EnumClass::_ABC), + "-efg" => std::result::Result::Ok(EnumClass::_EFG), + "(xyz)" => std::result::Result::Ok(EnumClass::_XYZ_), + _ => std::result::Result::Err(format!("Value not valid: {}", s)), } } } @@ -1928,17 +1919,17 @@ impl EnumClass { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(EnumTest::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -1986,7 +1977,7 @@ impl EnumTest { /// Converts the EnumTest value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for EnumTest { +impl std::string::ToString for EnumTest { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -2020,10 +2011,10 @@ impl ::std::string::ToString for EnumTest { /// Converts Query Parameters representation (style=form, explode=false) to a EnumTest value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for EnumTest { +impl std::str::FromStr for EnumTest { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -2043,7 +2034,7 @@ impl ::std::str::FromStr for EnumTest { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing EnumTest".to_string()) + None => return std::result::Result::Err("Missing value while parsing EnumTest".to_string()) }; if let Some(key) = key_result { @@ -2053,7 +2044,7 @@ impl ::std::str::FromStr for EnumTest { "enum_integer" => intermediate_rep.enum_integer.push(i32::from_str(val).map_err(|x| format!("{}", x))?), "enum_number" => intermediate_rep.enum_number.push(f64::from_str(val).map_err(|x| format!("{}", x))?), "outerEnum" => intermediate_rep.outer_enum.push(models::OuterEnum::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing EnumTest".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing EnumTest".to_string()) } } @@ -2062,7 +2053,7 @@ impl ::std::str::FromStr for EnumTest { } // Use the intermediate representation to return the struct - Ok(EnumTest { + std::result::Result::Ok(EnumTest { enum_string: intermediate_rep.enum_string.into_iter().next(), enum_string_required: intermediate_rep.enum_string_required.into_iter().next().ok_or("enum_string_required missing in EnumTest".to_string())?, enum_integer: intermediate_rep.enum_integer.into_iter().next(), @@ -2082,17 +2073,17 @@ impl EnumTest { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(FormatTest::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -2173,7 +2164,7 @@ impl FormatTest { /// Converts the FormatTest value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for FormatTest { +impl std::string::ToString for FormatTest { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -2239,10 +2230,10 @@ impl ::std::string::ToString for FormatTest { /// Converts Query Parameters representation (style=form, explode=false) to a FormatTest value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for FormatTest { +impl std::str::FromStr for FormatTest { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -2270,7 +2261,7 @@ impl ::std::str::FromStr for FormatTest { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing FormatTest".to_string()) + None => return std::result::Result::Err("Missing value while parsing FormatTest".to_string()) }; if let Some(key) = key_result { @@ -2282,13 +2273,13 @@ impl ::std::str::FromStr for FormatTest { "float" => intermediate_rep.float.push(f32::from_str(val).map_err(|x| format!("{}", x))?), "double" => intermediate_rep.double.push(f64::from_str(val).map_err(|x| format!("{}", x))?), "string" => intermediate_rep.string.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "byte" => return Err("Parsing binary data in this style is not supported in FormatTest".to_string()), - "binary" => return Err("Parsing binary data in this style is not supported in FormatTest".to_string()), + "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()), "date" => intermediate_rep.date.push(chrono::DateTime::::from_str(val).map_err(|x| format!("{}", x))?), "dateTime" => intermediate_rep.date_time.push(chrono::DateTime::::from_str(val).map_err(|x| format!("{}", x))?), "uuid" => intermediate_rep.uuid.push(uuid::Uuid::from_str(val).map_err(|x| format!("{}", x))?), "password" => intermediate_rep.password.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing FormatTest".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing FormatTest".to_string()) } } @@ -2297,7 +2288,7 @@ impl ::std::str::FromStr for FormatTest { } // Use the intermediate representation to return the struct - Ok(FormatTest { + std::result::Result::Ok(FormatTest { integer: intermediate_rep.integer.into_iter().next(), int32: intermediate_rep.int32.into_iter().next(), int64: intermediate_rep.int64.into_iter().next(), @@ -2325,17 +2316,17 @@ impl FormatTest { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(HasOnlyReadOnly::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -2365,7 +2356,7 @@ impl HasOnlyReadOnly { /// Converts the HasOnlyReadOnly value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for HasOnlyReadOnly { +impl std::string::ToString for HasOnlyReadOnly { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -2387,10 +2378,10 @@ impl ::std::string::ToString for HasOnlyReadOnly { /// Converts Query Parameters representation (style=form, explode=false) to a HasOnlyReadOnly value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for HasOnlyReadOnly { +impl std::str::FromStr for HasOnlyReadOnly { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -2407,14 +2398,14 @@ impl ::std::str::FromStr for HasOnlyReadOnly { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing HasOnlyReadOnly".to_string()) + None => return std::result::Result::Err("Missing value while parsing HasOnlyReadOnly".to_string()) }; if let Some(key) = key_result { match key { "bar" => intermediate_rep.bar.push(String::from_str(val).map_err(|x| format!("{}", x))?), "foo" => intermediate_rep.foo.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing HasOnlyReadOnly".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing HasOnlyReadOnly".to_string()) } } @@ -2423,7 +2414,7 @@ impl ::std::str::FromStr for HasOnlyReadOnly { } // Use the intermediate representation to return the struct - Ok(HasOnlyReadOnly { + std::result::Result::Ok(HasOnlyReadOnly { bar: intermediate_rep.bar.into_iter().next(), foo: intermediate_rep.foo.into_iter().next(), }) @@ -2440,17 +2431,17 @@ impl HasOnlyReadOnly { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(List::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -2475,7 +2466,7 @@ impl List { /// Converts the List value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for List { +impl std::string::ToString for List { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -2491,10 +2482,10 @@ impl ::std::string::ToString for List { /// Converts Query Parameters representation (style=form, explode=false) to a List value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for List { +impl std::str::FromStr for List { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -2510,13 +2501,13 @@ impl ::std::str::FromStr for List { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing List".to_string()) + None => return std::result::Result::Err("Missing value while parsing List".to_string()) }; if let Some(key) = key_result { match key { "123-list" => intermediate_rep.param_123_list.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing List".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing List".to_string()) } } @@ -2525,7 +2516,7 @@ impl ::std::str::FromStr for List { } // Use the intermediate representation to return the struct - Ok(List { + std::result::Result::Ok(List { param_123_list: intermediate_rep.param_123_list.into_iter().next(), }) } @@ -2541,17 +2532,17 @@ impl List { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(MapTest::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -2561,17 +2552,17 @@ impl From for IntoHeaderValue { pub struct MapTest { #[serde(rename = "map_map_of_string")] #[serde(skip_serializing_if="Option::is_none")] - pub map_map_of_string: Option>>, + pub map_map_of_string: Option>>, // Note: inline enums are not fully supported by openapi-generator #[serde(rename = "map_map_of_enum")] #[serde(skip_serializing_if="Option::is_none")] - pub map_map_of_enum: Option>>, + pub map_map_of_enum: Option>>, // Note: inline enums are not fully supported by openapi-generator #[serde(rename = "map_of_enum_string")] #[serde(skip_serializing_if="Option::is_none")] - pub map_of_enum_string: Option>, + pub map_of_enum_string: Option>, } @@ -2588,7 +2579,7 @@ impl MapTest { /// Converts the MapTest value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for MapTest { +impl std::string::ToString for MapTest { fn to_string(&self) -> String { let mut params: Vec = vec![]; // Skipping map_map_of_string in query parameter serialization @@ -2606,16 +2597,16 @@ impl ::std::string::ToString for MapTest { /// Converts Query Parameters representation (style=form, explode=false) to a MapTest value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for MapTest { +impl std::str::FromStr for MapTest { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { - pub map_map_of_string: Vec>>, - pub map_map_of_enum: Vec>>, - pub map_of_enum_string: Vec>, + pub map_map_of_string: Vec>>, + pub map_map_of_enum: Vec>>, + pub map_of_enum_string: Vec>, } let mut intermediate_rep = IntermediateRep::default(); @@ -2627,15 +2618,15 @@ impl ::std::str::FromStr for MapTest { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing MapTest".to_string()) + None => return std::result::Result::Err("Missing value while parsing MapTest".to_string()) }; if let Some(key) = key_result { match key { - "map_map_of_string" => return Err("Parsing a container in this style is not supported in MapTest".to_string()), - "map_map_of_enum" => return Err("Parsing a container in this style is not supported in MapTest".to_string()), - "map_of_enum_string" => return Err("Parsing a container in this style is not supported in MapTest".to_string()), - _ => return Err("Unexpected key while parsing MapTest".to_string()) + "map_map_of_string" => return std::result::Result::Err("Parsing a container in this style is not supported in MapTest".to_string()), + "map_map_of_enum" => return std::result::Result::Err("Parsing a container in this style is not supported in MapTest".to_string()), + "map_of_enum_string" => return std::result::Result::Err("Parsing a container in this style is not supported in MapTest".to_string()), + _ => return std::result::Result::Err("Unexpected key while parsing MapTest".to_string()) } } @@ -2644,7 +2635,7 @@ impl ::std::str::FromStr for MapTest { } // Use the intermediate representation to return the struct - Ok(MapTest { + std::result::Result::Ok(MapTest { map_map_of_string: intermediate_rep.map_map_of_string.into_iter().next(), map_map_of_enum: intermediate_rep.map_map_of_enum.into_iter().next(), map_of_enum_string: intermediate_rep.map_of_enum_string.into_iter().next(), @@ -2662,17 +2653,17 @@ impl MapTest { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(MixedPropertiesAndAdditionalPropertiesClass::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -2690,7 +2681,7 @@ pub struct MixedPropertiesAndAdditionalPropertiesClass { #[serde(rename = "map")] #[serde(skip_serializing_if="Option::is_none")] - pub map: Option>, + pub map: Option>, } @@ -2707,7 +2698,7 @@ impl MixedPropertiesAndAdditionalPropertiesClass { /// Converts the MixedPropertiesAndAdditionalPropertiesClass value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for MixedPropertiesAndAdditionalPropertiesClass { +impl std::string::ToString for MixedPropertiesAndAdditionalPropertiesClass { fn to_string(&self) -> String { let mut params: Vec = vec![]; // Skipping uuid in query parameter serialization @@ -2724,16 +2715,16 @@ impl ::std::string::ToString for MixedPropertiesAndAdditionalPropertiesClass { /// Converts Query Parameters representation (style=form, explode=false) to a MixedPropertiesAndAdditionalPropertiesClass value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for MixedPropertiesAndAdditionalPropertiesClass { +impl std::str::FromStr for MixedPropertiesAndAdditionalPropertiesClass { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { pub uuid: Vec, pub date_time: Vec>, - pub map: Vec>, + pub map: Vec>, } let mut intermediate_rep = IntermediateRep::default(); @@ -2745,15 +2736,15 @@ impl ::std::str::FromStr for MixedPropertiesAndAdditionalPropertiesClass { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing MixedPropertiesAndAdditionalPropertiesClass".to_string()) + None => return std::result::Result::Err("Missing value while parsing MixedPropertiesAndAdditionalPropertiesClass".to_string()) }; if let Some(key) = key_result { match key { "uuid" => intermediate_rep.uuid.push(uuid::Uuid::from_str(val).map_err(|x| format!("{}", x))?), "dateTime" => intermediate_rep.date_time.push(chrono::DateTime::::from_str(val).map_err(|x| format!("{}", x))?), - "map" => return Err("Parsing a container in this style is not supported in MixedPropertiesAndAdditionalPropertiesClass".to_string()), - _ => return Err("Unexpected key while parsing MixedPropertiesAndAdditionalPropertiesClass".to_string()) + "map" => return std::result::Result::Err("Parsing a container in this style is not supported in MixedPropertiesAndAdditionalPropertiesClass".to_string()), + _ => return std::result::Result::Err("Unexpected key while parsing MixedPropertiesAndAdditionalPropertiesClass".to_string()) } } @@ -2762,7 +2753,7 @@ impl ::std::str::FromStr for MixedPropertiesAndAdditionalPropertiesClass { } // Use the intermediate representation to return the struct - Ok(MixedPropertiesAndAdditionalPropertiesClass { + std::result::Result::Ok(MixedPropertiesAndAdditionalPropertiesClass { uuid: intermediate_rep.uuid.into_iter().next(), date_time: intermediate_rep.date_time.into_iter().next(), map: intermediate_rep.map.into_iter().next(), @@ -2781,17 +2772,17 @@ impl MixedPropertiesAndAdditionalPropertiesClass { } /// Model for testing model name starting with number -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(Model200Response::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -2822,7 +2813,7 @@ impl Model200Response { /// Converts the Model200Response value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for Model200Response { +impl std::string::ToString for Model200Response { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -2844,10 +2835,10 @@ impl ::std::string::ToString for Model200Response { /// Converts Query Parameters representation (style=form, explode=false) to a Model200Response value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for Model200Response { +impl std::str::FromStr for Model200Response { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -2864,14 +2855,14 @@ impl ::std::str::FromStr for Model200Response { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing Model200Response".to_string()) + None => return std::result::Result::Err("Missing value while parsing Model200Response".to_string()) }; if let Some(key) = key_result { match key { "name" => intermediate_rep.name.push(i32::from_str(val).map_err(|x| format!("{}", x))?), "class" => intermediate_rep.class.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing Model200Response".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing Model200Response".to_string()) } } @@ -2880,7 +2871,7 @@ impl ::std::str::FromStr for Model200Response { } // Use the intermediate representation to return the struct - Ok(Model200Response { + std::result::Result::Ok(Model200Response { name: intermediate_rep.name.into_iter().next(), class: intermediate_rep.class.into_iter().next(), }) @@ -2898,17 +2889,17 @@ impl Model200Response { } /// Model for testing reserved words -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(ModelReturn::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -2934,7 +2925,7 @@ impl ModelReturn { /// Converts the ModelReturn value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for ModelReturn { +impl std::string::ToString for ModelReturn { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -2950,10 +2941,10 @@ impl ::std::string::ToString for ModelReturn { /// Converts Query Parameters representation (style=form, explode=false) to a ModelReturn value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for ModelReturn { +impl std::str::FromStr for ModelReturn { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -2969,13 +2960,13 @@ impl ::std::str::FromStr for ModelReturn { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing ModelReturn".to_string()) + None => return std::result::Result::Err("Missing value while parsing ModelReturn".to_string()) }; if let Some(key) = key_result { match key { "return" => intermediate_rep.return_.push(i32::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing ModelReturn".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing ModelReturn".to_string()) } } @@ -2984,7 +2975,7 @@ impl ::std::str::FromStr for ModelReturn { } // Use the intermediate representation to return the struct - Ok(ModelReturn { + std::result::Result::Ok(ModelReturn { return_: intermediate_rep.return_.into_iter().next(), }) } @@ -3001,17 +2992,17 @@ impl ModelReturn { } /// Model for testing model name same as property name -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(Name::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -3051,7 +3042,7 @@ impl Name { /// Converts the Name value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for Name { +impl std::string::ToString for Name { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -3083,10 +3074,10 @@ impl ::std::string::ToString for Name { /// Converts Query Parameters representation (style=form, explode=false) to a Name value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for Name { +impl std::str::FromStr for Name { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -3105,7 +3096,7 @@ impl ::std::str::FromStr for Name { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing Name".to_string()) + None => return std::result::Result::Err("Missing value while parsing Name".to_string()) }; if let Some(key) = key_result { @@ -3114,7 +3105,7 @@ impl ::std::str::FromStr for Name { "snake_case" => intermediate_rep.snake_case.push(i32::from_str(val).map_err(|x| format!("{}", x))?), "property" => intermediate_rep.property.push(String::from_str(val).map_err(|x| format!("{}", x))?), "123Number" => intermediate_rep.param_123_number.push(isize::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing Name".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing Name".to_string()) } } @@ -3123,7 +3114,7 @@ impl ::std::str::FromStr for Name { } // Use the intermediate representation to return the struct - Ok(Name { + std::result::Result::Ok(Name { name: intermediate_rep.name.into_iter().next().ok_or("name missing in Name".to_string())?, snake_case: intermediate_rep.snake_case.into_iter().next(), property: intermediate_rep.property.into_iter().next(), @@ -3142,17 +3133,17 @@ impl Name { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(NumberOnly::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -3177,7 +3168,7 @@ impl NumberOnly { /// Converts the NumberOnly value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for NumberOnly { +impl std::string::ToString for NumberOnly { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -3193,10 +3184,10 @@ impl ::std::string::ToString for NumberOnly { /// Converts Query Parameters representation (style=form, explode=false) to a NumberOnly value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for NumberOnly { +impl std::str::FromStr for NumberOnly { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -3212,13 +3203,13 @@ impl ::std::str::FromStr for NumberOnly { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing NumberOnly".to_string()) + None => return std::result::Result::Err("Missing value while parsing NumberOnly".to_string()) }; if let Some(key) = key_result { match key { "JustNumber" => intermediate_rep.just_number.push(f64::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing NumberOnly".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing NumberOnly".to_string()) } } @@ -3227,7 +3218,7 @@ impl ::std::str::FromStr for NumberOnly { } // Use the intermediate representation to return the struct - Ok(NumberOnly { + std::result::Result::Ok(NumberOnly { just_number: intermediate_rep.just_number.into_iter().next(), }) } @@ -3243,17 +3234,17 @@ impl NumberOnly { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(ObjectContainingObjectWithOnlyAdditionalProperties::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -3278,7 +3269,7 @@ impl ObjectContainingObjectWithOnlyAdditionalProperties { /// Converts the ObjectContainingObjectWithOnlyAdditionalProperties value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for ObjectContainingObjectWithOnlyAdditionalProperties { +impl std::string::ToString for ObjectContainingObjectWithOnlyAdditionalProperties { fn to_string(&self) -> String { let mut params: Vec = vec![]; // Skipping inner in query parameter serialization @@ -3290,10 +3281,10 @@ impl ::std::string::ToString for ObjectContainingObjectWithOnlyAdditionalPropert /// Converts Query Parameters representation (style=form, explode=false) to a ObjectContainingObjectWithOnlyAdditionalProperties value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for ObjectContainingObjectWithOnlyAdditionalProperties { +impl std::str::FromStr for ObjectContainingObjectWithOnlyAdditionalProperties { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -3309,13 +3300,13 @@ impl ::std::str::FromStr for ObjectContainingObjectWithOnlyAdditionalProperties while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing ObjectContainingObjectWithOnlyAdditionalProperties".to_string()) + None => return std::result::Result::Err("Missing value while parsing ObjectContainingObjectWithOnlyAdditionalProperties".to_string()) }; if let Some(key) = key_result { match key { "inner" => intermediate_rep.inner.push(models::ObjectWithOnlyAdditionalProperties::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing ObjectContainingObjectWithOnlyAdditionalProperties".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing ObjectContainingObjectWithOnlyAdditionalProperties".to_string()) } } @@ -3324,7 +3315,7 @@ impl ::std::str::FromStr for ObjectContainingObjectWithOnlyAdditionalProperties } // Use the intermediate representation to return the struct - Ok(ObjectContainingObjectWithOnlyAdditionalProperties { + std::result::Result::Ok(ObjectContainingObjectWithOnlyAdditionalProperties { inner: intermediate_rep.inner.into_iter().next(), }) } @@ -3342,30 +3333,30 @@ impl ObjectContainingObjectWithOnlyAdditionalProperties { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "conversion", derive(LabelledGeneric))] -pub struct ObjectWithOnlyAdditionalProperties(HashMap); +pub struct ObjectWithOnlyAdditionalProperties(std::collections::HashMap); -impl ::std::convert::From> for ObjectWithOnlyAdditionalProperties { - fn from(x: HashMap) -> Self { +impl std::convert::From> for ObjectWithOnlyAdditionalProperties { + fn from(x: std::collections::HashMap) -> Self { ObjectWithOnlyAdditionalProperties(x) } } -impl ::std::convert::From for HashMap { +impl std::convert::From for std::collections::HashMap { fn from(x: ObjectWithOnlyAdditionalProperties) -> Self { x.0 } } -impl ::std::ops::Deref for ObjectWithOnlyAdditionalProperties { - type Target = HashMap; - fn deref(&self) -> &HashMap { +impl std::ops::Deref for ObjectWithOnlyAdditionalProperties { + type Target = std::collections::HashMap; + fn deref(&self) -> &std::collections::HashMap { &self.0 } } -impl ::std::ops::DerefMut for ObjectWithOnlyAdditionalProperties { - fn deref_mut(&mut self) -> &mut HashMap { +impl std::ops::DerefMut for ObjectWithOnlyAdditionalProperties { + fn deref_mut(&mut self) -> &mut std::collections::HashMap { &mut self.0 } } @@ -3386,8 +3377,8 @@ impl ::std::string::ToString for ObjectWithOnlyAdditionalProperties { impl ::std::str::FromStr for ObjectWithOnlyAdditionalProperties { type Err = &'static str; - fn from_str(s: &str) -> Result { - Err("Parsing additionalProperties for ObjectWithOnlyAdditionalProperties is not supported") + fn from_str(s: &str) -> std::result::Result { + std::result::Result::Err("Parsing additionalProperties for ObjectWithOnlyAdditionalProperties is not supported") } } @@ -3400,17 +3391,17 @@ impl ObjectWithOnlyAdditionalProperties { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(Order::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -3463,7 +3454,7 @@ impl Order { /// Converts the Order value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for Order { +impl std::string::ToString for Order { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -3505,10 +3496,10 @@ impl ::std::string::ToString for Order { /// Converts Query Parameters representation (style=form, explode=false) to a Order value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for Order { +impl std::str::FromStr for Order { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -3529,7 +3520,7 @@ impl ::std::str::FromStr for Order { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing Order".to_string()) + None => return std::result::Result::Err("Missing value while parsing Order".to_string()) }; if let Some(key) = key_result { @@ -3540,7 +3531,7 @@ impl ::std::str::FromStr for Order { "shipDate" => intermediate_rep.ship_date.push(chrono::DateTime::::from_str(val).map_err(|x| format!("{}", x))?), "status" => intermediate_rep.status.push(String::from_str(val).map_err(|x| format!("{}", x))?), "complete" => intermediate_rep.complete.push(bool::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing Order".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing Order".to_string()) } } @@ -3549,7 +3540,7 @@ impl ::std::str::FromStr for Order { } // Use the intermediate representation to return the struct - Ok(Order { + std::result::Result::Ok(Order { id: intermediate_rep.id.into_iter().next(), pet_id: intermediate_rep.pet_id.into_iter().next(), quantity: intermediate_rep.quantity.into_iter().next(), @@ -3574,27 +3565,27 @@ impl Order { #[cfg_attr(feature = "conversion", derive(LabelledGeneric))] pub struct OuterBoolean(bool); -impl ::std::convert::From for OuterBoolean { +impl std::convert::From for OuterBoolean { fn from(x: bool) -> Self { OuterBoolean(x) } } -impl ::std::convert::From for bool { +impl std::convert::From for bool { fn from(x: OuterBoolean) -> Self { x.0 } } -impl ::std::ops::Deref for OuterBoolean { +impl std::ops::Deref for OuterBoolean { type Target = bool; fn deref(&self) -> &bool { &self.0 } } -impl ::std::ops::DerefMut for OuterBoolean { +impl std::ops::DerefMut for OuterBoolean { fn deref_mut(&mut self) -> &mut bool { &mut self.0 } @@ -3610,17 +3601,17 @@ impl OuterBoolean { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(OuterComposite::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -3655,7 +3646,7 @@ impl OuterComposite { /// Converts the OuterComposite value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for OuterComposite { +impl std::string::ToString for OuterComposite { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -3683,10 +3674,10 @@ impl ::std::string::ToString for OuterComposite { /// Converts Query Parameters representation (style=form, explode=false) to a OuterComposite value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for OuterComposite { +impl std::str::FromStr for OuterComposite { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -3704,7 +3695,7 @@ impl ::std::str::FromStr for OuterComposite { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing OuterComposite".to_string()) + None => return std::result::Result::Err("Missing value while parsing OuterComposite".to_string()) }; if let Some(key) = key_result { @@ -3712,7 +3703,7 @@ impl ::std::str::FromStr for OuterComposite { "my_number" => intermediate_rep.my_number.push(f64::from_str(val).map_err(|x| format!("{}", x))?), "my_string" => intermediate_rep.my_string.push(String::from_str(val).map_err(|x| format!("{}", x))?), "my_boolean" => intermediate_rep.my_boolean.push(bool::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing OuterComposite".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing OuterComposite".to_string()) } } @@ -3721,7 +3712,7 @@ impl ::std::str::FromStr for OuterComposite { } // Use the intermediate representation to return the struct - Ok(OuterComposite { + std::result::Result::Ok(OuterComposite { my_number: intermediate_rep.my_number.into_iter().next(), my_string: intermediate_rep.my_string.into_iter().next(), my_boolean: intermediate_rep.my_boolean.into_iter().next(), @@ -3755,8 +3746,8 @@ pub enum OuterEnum { DELIVERED, } -impl ::std::fmt::Display for OuterEnum { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { +impl std::fmt::Display for OuterEnum { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match *self { OuterEnum::PLACED => write!(f, "{}", "placed"), OuterEnum::APPROVED => write!(f, "{}", "approved"), @@ -3765,15 +3756,15 @@ impl ::std::fmt::Display for OuterEnum { } } -impl ::std::str::FromStr for OuterEnum { +impl std::str::FromStr for OuterEnum { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { match s { - "placed" => Ok(OuterEnum::PLACED), - "approved" => Ok(OuterEnum::APPROVED), - "delivered" => Ok(OuterEnum::DELIVERED), - _ => Err(format!("Value not valid: {}", s)), + "placed" => std::result::Result::Ok(OuterEnum::PLACED), + "approved" => std::result::Result::Ok(OuterEnum::APPROVED), + "delivered" => std::result::Result::Ok(OuterEnum::DELIVERED), + _ => std::result::Result::Err(format!("Value not valid: {}", s)), } } } @@ -3791,27 +3782,27 @@ impl OuterEnum { #[cfg_attr(feature = "conversion", derive(LabelledGeneric))] pub struct OuterNumber(f64); -impl ::std::convert::From for OuterNumber { +impl std::convert::From for OuterNumber { fn from(x: f64) -> Self { OuterNumber(x) } } -impl ::std::convert::From for f64 { +impl std::convert::From for f64 { fn from(x: OuterNumber) -> Self { x.0 } } -impl ::std::ops::Deref for OuterNumber { +impl std::ops::Deref for OuterNumber { type Target = f64; fn deref(&self) -> &f64 { &self.0 } } -impl ::std::ops::DerefMut for OuterNumber { +impl std::ops::DerefMut for OuterNumber { fn deref_mut(&mut self) -> &mut f64 { &mut self.0 } @@ -3831,33 +3822,33 @@ impl OuterNumber { #[cfg_attr(feature = "conversion", derive(LabelledGeneric))] pub struct OuterString(String); -impl ::std::convert::From for OuterString { +impl std::convert::From for OuterString { fn from(x: String) -> Self { OuterString(x) } } impl std::str::FromStr for OuterString { - type Err = ParseError; - fn from_str(x: &str) -> Result { - Ok(OuterString(x.to_string())) + type Err = std::string::ParseError; + fn from_str(x: &str) -> std::result::Result { + std::result::Result::Ok(OuterString(x.to_string())) } } -impl ::std::convert::From for String { +impl std::convert::From for String { fn from(x: OuterString) -> Self { x.0 } } -impl ::std::ops::Deref for OuterString { +impl std::ops::Deref for OuterString { type Target = String; fn deref(&self) -> &String { &self.0 } } -impl ::std::ops::DerefMut for OuterString { +impl std::ops::DerefMut for OuterString { fn deref_mut(&mut self) -> &mut String { &mut self.0 } @@ -3873,17 +3864,17 @@ impl OuterString { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(Pet::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -3934,7 +3925,7 @@ impl Pet { /// Converts the Pet value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for Pet { +impl std::string::ToString for Pet { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -3968,10 +3959,10 @@ impl ::std::string::ToString for Pet { /// Converts Query Parameters representation (style=form, explode=false) to a Pet value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for Pet { +impl std::str::FromStr for Pet { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -3992,7 +3983,7 @@ impl ::std::str::FromStr for Pet { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing Pet".to_string()) + None => return std::result::Result::Err("Missing value while parsing Pet".to_string()) }; if let Some(key) = key_result { @@ -4000,10 +3991,10 @@ impl ::std::str::FromStr for Pet { "id" => intermediate_rep.id.push(i64::from_str(val).map_err(|x| format!("{}", x))?), "category" => intermediate_rep.category.push(models::Category::from_str(val).map_err(|x| format!("{}", x))?), "name" => intermediate_rep.name.push(String::from_str(val).map_err(|x| format!("{}", x))?), - "photoUrls" => return Err("Parsing a container in this style is not supported in Pet".to_string()), - "tags" => return Err("Parsing a container in this style is not supported in Pet".to_string()), + "photoUrls" => return std::result::Result::Err("Parsing a container in this style is not supported in Pet".to_string()), + "tags" => return std::result::Result::Err("Parsing a container in this style is not supported in Pet".to_string()), "status" => intermediate_rep.status.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing Pet".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing Pet".to_string()) } } @@ -4012,7 +4003,7 @@ impl ::std::str::FromStr for Pet { } // Use the intermediate representation to return the struct - Ok(Pet { + std::result::Result::Ok(Pet { id: intermediate_rep.id.into_iter().next(), category: intermediate_rep.category.into_iter().next(), name: intermediate_rep.name.into_iter().next().ok_or("name missing in Pet".to_string())?, @@ -4033,17 +4024,17 @@ impl Pet { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(ReadOnlyFirst::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -4073,7 +4064,7 @@ impl ReadOnlyFirst { /// Converts the ReadOnlyFirst value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for ReadOnlyFirst { +impl std::string::ToString for ReadOnlyFirst { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -4095,10 +4086,10 @@ impl ::std::string::ToString for ReadOnlyFirst { /// Converts Query Parameters representation (style=form, explode=false) to a ReadOnlyFirst value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for ReadOnlyFirst { +impl std::str::FromStr for ReadOnlyFirst { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -4115,14 +4106,14 @@ impl ::std::str::FromStr for ReadOnlyFirst { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing ReadOnlyFirst".to_string()) + None => return std::result::Result::Err("Missing value while parsing ReadOnlyFirst".to_string()) }; if let Some(key) = key_result { match key { "bar" => intermediate_rep.bar.push(String::from_str(val).map_err(|x| format!("{}", x))?), "baz" => intermediate_rep.baz.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing ReadOnlyFirst".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing ReadOnlyFirst".to_string()) } } @@ -4131,7 +4122,7 @@ impl ::std::str::FromStr for ReadOnlyFirst { } // Use the intermediate representation to return the struct - Ok(ReadOnlyFirst { + std::result::Result::Ok(ReadOnlyFirst { bar: intermediate_rep.bar.into_iter().next(), baz: intermediate_rep.baz.into_iter().next(), }) @@ -4148,17 +4139,17 @@ impl ReadOnlyFirst { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(SpecialModelName::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -4184,7 +4175,7 @@ impl SpecialModelName { /// Converts the SpecialModelName value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for SpecialModelName { +impl std::string::ToString for SpecialModelName { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -4200,10 +4191,10 @@ impl ::std::string::ToString for SpecialModelName { /// Converts Query Parameters representation (style=form, explode=false) to a SpecialModelName value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for SpecialModelName { +impl std::str::FromStr for SpecialModelName { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -4219,13 +4210,13 @@ impl ::std::str::FromStr for SpecialModelName { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing SpecialModelName".to_string()) + None => return std::result::Result::Err("Missing value while parsing SpecialModelName".to_string()) }; if let Some(key) = key_result { match key { "$special[property.name]" => intermediate_rep.special_property_name.push(i64::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing SpecialModelName".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing SpecialModelName".to_string()) } } @@ -4234,7 +4225,7 @@ impl ::std::str::FromStr for SpecialModelName { } // Use the intermediate representation to return the struct - Ok(SpecialModelName { + std::result::Result::Ok(SpecialModelName { special_property_name: intermediate_rep.special_property_name.into_iter().next(), }) } @@ -4250,17 +4241,17 @@ impl SpecialModelName { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(Tag::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -4291,7 +4282,7 @@ impl Tag { /// Converts the Tag value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for Tag { +impl std::string::ToString for Tag { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -4313,10 +4304,10 @@ impl ::std::string::ToString for Tag { /// Converts Query Parameters representation (style=form, explode=false) to a Tag value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for Tag { +impl std::str::FromStr for Tag { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -4333,14 +4324,14 @@ impl ::std::str::FromStr for Tag { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing Tag".to_string()) + None => return std::result::Result::Err("Missing value while parsing Tag".to_string()) }; if let Some(key) = key_result { match key { "id" => intermediate_rep.id.push(i64::from_str(val).map_err(|x| format!("{}", x))?), "name" => intermediate_rep.name.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing Tag".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing Tag".to_string()) } } @@ -4349,7 +4340,7 @@ impl ::std::str::FromStr for Tag { } // Use the intermediate representation to return the struct - Ok(Tag { + std::result::Result::Ok(Tag { id: intermediate_rep.id.into_iter().next(), name: intermediate_rep.name.into_iter().next(), }) @@ -4366,17 +4357,17 @@ impl Tag { } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(User::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -4438,7 +4429,7 @@ impl User { /// Converts the User value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for User { +impl std::string::ToString for User { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -4496,10 +4487,10 @@ impl ::std::string::ToString for User { /// Converts Query Parameters representation (style=form, explode=false) to a User value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for User { +impl std::str::FromStr for User { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -4522,7 +4513,7 @@ impl ::std::str::FromStr for User { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing User".to_string()) + None => return std::result::Result::Err("Missing value while parsing User".to_string()) }; if let Some(key) = key_result { @@ -4535,7 +4526,7 @@ impl ::std::str::FromStr for User { "password" => intermediate_rep.password.push(String::from_str(val).map_err(|x| format!("{}", x))?), "phone" => intermediate_rep.phone.push(String::from_str(val).map_err(|x| format!("{}", x))?), "userStatus" => intermediate_rep.user_status.push(i32::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing User".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing User".to_string()) } } @@ -4544,7 +4535,7 @@ impl ::std::str::FromStr for User { } // Use the intermediate representation to return the struct - Ok(User { + std::result::Result::Ok(User { id: intermediate_rep.id.into_iter().next(), username: intermediate_rep.username.into_iter().next(), first_name: intermediate_rep.first_name.into_iter().next(), diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs index 9951ed4ad05..653d141c281 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs @@ -1,5 +1,3 @@ -#[allow(unused_imports)] -use std::collections::{HashMap, BTreeMap, BTreeSet}; use std::marker::PhantomData; use futures::{Future, future, Stream, stream}; use hyper; @@ -1114,7 +1112,7 @@ where match result { Ok(body) => { let mut unused_elements = Vec::new(); - let param_param: Option> = if !body.is_empty() { + let param_param: Option> = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&*body); match serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); @@ -1334,7 +1332,7 @@ where // Authorization if let Scopes::Some(ref scopes) = authorization.scopes { - let required_scopes: BTreeSet = vec![ + let required_scopes: std::collections::BTreeSet = vec![ "write:pets".to_string(), // modify pets in your account "read:pets".to_string(), // read your pets ].into_iter().collect(); @@ -1443,7 +1441,7 @@ where // Authorization if let Scopes::Some(ref scopes) = authorization.scopes { - let required_scopes: BTreeSet = vec![ + let required_scopes: std::collections::BTreeSet = vec![ "write:pets".to_string(), // modify pets in your account "read:pets".to_string(), // read your pets ].into_iter().collect(); @@ -1541,7 +1539,7 @@ where // Authorization if let Scopes::Some(ref scopes) = authorization.scopes { - let required_scopes: BTreeSet = vec![ + let required_scopes: std::collections::BTreeSet = vec![ "write:pets".to_string(), // modify pets in your account "read:pets".to_string(), // read your pets ].into_iter().collect(); @@ -1625,7 +1623,7 @@ where // Authorization if let Scopes::Some(ref scopes) = authorization.scopes { - let required_scopes: BTreeSet = vec![ + let required_scopes: std::collections::BTreeSet = vec![ "write:pets".to_string(), // modify pets in your account "read:pets".to_string(), // read your pets ].into_iter().collect(); @@ -1794,7 +1792,7 @@ where // Authorization if let Scopes::Some(ref scopes) = authorization.scopes { - let required_scopes: BTreeSet = vec![ + let required_scopes: std::collections::BTreeSet = vec![ "write:pets".to_string(), // modify pets in your account "read:pets".to_string(), // read your pets ].into_iter().collect(); @@ -1911,7 +1909,7 @@ where // Authorization if let Scopes::Some(ref scopes) = authorization.scopes { - let required_scopes: BTreeSet = vec![ + let required_scopes: std::collections::BTreeSet = vec![ "write:pets".to_string(), // modify pets in your account "read:pets".to_string(), // read your pets ].into_iter().collect(); @@ -2007,7 +2005,7 @@ where // Authorization if let Scopes::Some(ref scopes) = authorization.scopes { - let required_scopes: BTreeSet = vec![ + let required_scopes: std::collections::BTreeSet = vec![ "write:pets".to_string(), // modify pets in your account "read:pets".to_string(), // read your pets ].into_iter().collect(); diff --git a/samples/server/petstore/rust-server/output/rust-server-test/examples/server/server.rs b/samples/server/petstore/rust-server/output/rust-server-test/examples/server/server.rs index f7a1796d28b..858ad8a3c24 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/examples/server/server.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/examples/server/server.rs @@ -13,7 +13,6 @@ use futures::{future, Future, Stream}; use hyper::server::conn::Http; use hyper::service::MakeService as _; use openssl::ssl::SslAcceptorBuilder; -use std::collections::HashMap; use std::marker::PhantomData; use std::net::SocketAddr; use std::sync::{Arc, Mutex}; diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs index 6910c25ed22..4aa77d09e2d 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs @@ -8,8 +8,6 @@ use hyper::{Body, Uri, Response}; use hyper_openssl::HttpsConnector; use serde_json; use std::borrow::Cow; -#[allow(unused_imports)] -use std::collections::{HashMap, BTreeMap}; use std::io::{Read, Error, ErrorKind}; use std::error; use std::fmt; diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs index e99ca3e563d..df41a0f9567 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs @@ -56,9 +56,6 @@ use hyper::header::HeaderValue; use futures::Stream; use std::io::Error; -#[allow(unused_imports)] -use std::collections::HashMap; - #[deprecated(note = "Import swagger-rs directly")] pub use swagger::{ApiError, ContextWrapper}; #[deprecated(note = "Import futures directly")] diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/models.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/models.rs index 58f1387e08a..c3ae7c3437d 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/models.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/models.rs @@ -1,27 +1,20 @@ -#![allow(unused_imports, unused_qualifications)] +#![allow(unused_qualifications)] -use serde::ser::Serializer; - -use std::collections::HashMap; use models; -use swagger; -use hyper::header::HeaderValue; -use std::string::ParseError; -use std::str::FromStr; -use header::IntoHeaderValue; +use header; -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(ANullableContainer::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -52,7 +45,7 @@ impl ANullableContainer { /// Converts the ANullableContainer value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for ANullableContainer { +impl std::string::ToString for ANullableContainer { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -72,10 +65,10 @@ impl ::std::string::ToString for ANullableContainer { /// Converts Query Parameters representation (style=form, explode=false) to a ANullableContainer value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for ANullableContainer { +impl std::str::FromStr for ANullableContainer { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -92,14 +85,14 @@ impl ::std::str::FromStr for ANullableContainer { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing ANullableContainer".to_string()) + None => return std::result::Result::Err("Missing value while parsing ANullableContainer".to_string()) }; if let Some(key) = key_result { match key { - "NullableThing" => return Err("Parsing a nullable type in this style is not supported in ANullableContainer".to_string()), - "RequiredNullableThing" => return Err("Parsing a nullable type in this style is not supported in ANullableContainer".to_string()), - _ => return Err("Unexpected key while parsing ANullableContainer".to_string()) + "NullableThing" => return std::result::Result::Err("Parsing a nullable type in this style is not supported in ANullableContainer".to_string()), + "RequiredNullableThing" => return std::result::Result::Err("Parsing a nullable type in this style is not supported in ANullableContainer".to_string()), + _ => return std::result::Result::Err("Unexpected key while parsing ANullableContainer".to_string()) } } @@ -108,9 +101,9 @@ impl ::std::str::FromStr for ANullableContainer { } // Use the intermediate representation to return the struct - Ok(ANullableContainer { - nullable_thing: Err("Nullable types not supported in ANullableContainer".to_string())?, - required_nullable_thing: Err("Nullable types not supported in ANullableContainer".to_string())?, + std::result::Result::Ok(ANullableContainer { + nullable_thing: std::result::Result::Err("Nullable types not supported in ANullableContainer".to_string())?, + required_nullable_thing: std::result::Result::Err("Nullable types not supported in ANullableContainer".to_string())?, }) } } @@ -120,30 +113,30 @@ impl ::std::str::FromStr for ANullableContainer { /// An additionalPropertiesObject #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "conversion", derive(LabelledGeneric))] -pub struct AdditionalPropertiesObject(HashMap); +pub struct AdditionalPropertiesObject(std::collections::HashMap); -impl ::std::convert::From> for AdditionalPropertiesObject { - fn from(x: HashMap) -> Self { +impl std::convert::From> for AdditionalPropertiesObject { + fn from(x: std::collections::HashMap) -> Self { AdditionalPropertiesObject(x) } } -impl ::std::convert::From for HashMap { +impl std::convert::From for std::collections::HashMap { fn from(x: AdditionalPropertiesObject) -> Self { x.0 } } -impl ::std::ops::Deref for AdditionalPropertiesObject { - type Target = HashMap; - fn deref(&self) -> &HashMap { +impl std::ops::Deref for AdditionalPropertiesObject { + type Target = std::collections::HashMap; + fn deref(&self) -> &std::collections::HashMap { &self.0 } } -impl ::std::ops::DerefMut for AdditionalPropertiesObject { - fn deref_mut(&mut self) -> &mut HashMap { +impl std::ops::DerefMut for AdditionalPropertiesObject { + fn deref_mut(&mut self) -> &mut std::collections::HashMap { &mut self.0 } } @@ -164,23 +157,23 @@ impl ::std::string::ToString for AdditionalPropertiesObject { impl ::std::str::FromStr for AdditionalPropertiesObject { type Err = &'static str; - fn from_str(s: &str) -> Result { - Err("Parsing additionalProperties for AdditionalPropertiesObject is not supported") + fn from_str(s: &str) -> std::result::Result { + std::result::Result::Err("Parsing additionalProperties for AdditionalPropertiesObject is not supported") } } -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(AllOfObject::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -210,7 +203,7 @@ impl AllOfObject { /// Converts the AllOfObject value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for AllOfObject { +impl std::string::ToString for AllOfObject { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -232,10 +225,10 @@ impl ::std::string::ToString for AllOfObject { /// Converts Query Parameters representation (style=form, explode=false) to a AllOfObject value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for AllOfObject { +impl std::str::FromStr for AllOfObject { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -252,14 +245,14 @@ impl ::std::str::FromStr for AllOfObject { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing AllOfObject".to_string()) + None => return std::result::Result::Err("Missing value while parsing AllOfObject".to_string()) }; if let Some(key) = key_result { match key { "sampleProperty" => intermediate_rep.sample_property.push(String::from_str(val).map_err(|x| format!("{}", x))?), "sampleBasePropery" => intermediate_rep.sample_base_propery.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing AllOfObject".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing AllOfObject".to_string()) } } @@ -268,7 +261,7 @@ impl ::std::str::FromStr for AllOfObject { } // Use the intermediate representation to return the struct - Ok(AllOfObject { + std::result::Result::Ok(AllOfObject { sample_property: intermediate_rep.sample_property.into_iter().next(), sample_base_propery: intermediate_rep.sample_base_propery.into_iter().next(), }) @@ -277,17 +270,17 @@ impl ::std::str::FromStr for AllOfObject { -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(BaseAllOf::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -312,7 +305,7 @@ impl BaseAllOf { /// Converts the BaseAllOf value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for BaseAllOf { +impl std::string::ToString for BaseAllOf { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -328,10 +321,10 @@ impl ::std::string::ToString for BaseAllOf { /// Converts Query Parameters representation (style=form, explode=false) to a BaseAllOf value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for BaseAllOf { +impl std::str::FromStr for BaseAllOf { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -347,13 +340,13 @@ impl ::std::str::FromStr for BaseAllOf { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing BaseAllOf".to_string()) + None => return std::result::Result::Err("Missing value while parsing BaseAllOf".to_string()) }; if let Some(key) = key_result { match key { "sampleBasePropery" => intermediate_rep.sample_base_propery.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing BaseAllOf".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing BaseAllOf".to_string()) } } @@ -362,7 +355,7 @@ impl ::std::str::FromStr for BaseAllOf { } // Use the intermediate representation to return the struct - Ok(BaseAllOf { + std::result::Result::Ok(BaseAllOf { sample_base_propery: intermediate_rep.sample_base_propery.into_iter().next(), }) } @@ -371,17 +364,17 @@ impl ::std::str::FromStr for BaseAllOf { /// structured response -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(GetYamlResponse::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -407,7 +400,7 @@ impl GetYamlResponse { /// Converts the GetYamlResponse value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for GetYamlResponse { +impl std::string::ToString for GetYamlResponse { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -423,10 +416,10 @@ impl ::std::string::ToString for GetYamlResponse { /// Converts Query Parameters representation (style=form, explode=false) to a GetYamlResponse value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for GetYamlResponse { +impl std::str::FromStr for GetYamlResponse { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -442,13 +435,13 @@ impl ::std::str::FromStr for GetYamlResponse { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing GetYamlResponse".to_string()) + None => return std::result::Result::Err("Missing value while parsing GetYamlResponse".to_string()) }; if let Some(key) = key_result { match key { "value" => intermediate_rep.value.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing GetYamlResponse".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing GetYamlResponse".to_string()) } } @@ -457,7 +450,7 @@ impl ::std::str::FromStr for GetYamlResponse { } // Use the intermediate representation to return the struct - Ok(GetYamlResponse { + std::result::Result::Ok(GetYamlResponse { value: intermediate_rep.value.into_iter().next(), }) } @@ -465,17 +458,17 @@ impl ::std::str::FromStr for GetYamlResponse { -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(InlineObject::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -504,7 +497,7 @@ impl InlineObject { /// Converts the InlineObject value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for InlineObject { +impl std::string::ToString for InlineObject { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -524,10 +517,10 @@ impl ::std::string::ToString for InlineObject { /// Converts Query Parameters representation (style=form, explode=false) to a InlineObject value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for InlineObject { +impl std::str::FromStr for InlineObject { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -544,14 +537,14 @@ impl ::std::str::FromStr for InlineObject { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing InlineObject".to_string()) + None => return std::result::Result::Err("Missing value while parsing InlineObject".to_string()) }; if let Some(key) = key_result { match key { "id" => intermediate_rep.id.push(String::from_str(val).map_err(|x| format!("{}", x))?), "password" => intermediate_rep.password.push(String::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing InlineObject".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing InlineObject".to_string()) } } @@ -560,7 +553,7 @@ impl ::std::str::FromStr for InlineObject { } // Use the intermediate representation to return the struct - Ok(InlineObject { + std::result::Result::Ok(InlineObject { id: intermediate_rep.id.into_iter().next().ok_or("id missing in InlineObject".to_string())?, password: intermediate_rep.password.into_iter().next(), }) @@ -570,17 +563,17 @@ impl ::std::str::FromStr for InlineObject { /// An object of objects -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(ObjectOfObjects::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -605,7 +598,7 @@ impl ObjectOfObjects { /// Converts the ObjectOfObjects value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for ObjectOfObjects { +impl std::string::ToString for ObjectOfObjects { fn to_string(&self) -> String { let mut params: Vec = vec![]; // Skipping inner in query parameter serialization @@ -617,10 +610,10 @@ impl ::std::string::ToString for ObjectOfObjects { /// Converts Query Parameters representation (style=form, explode=false) to a ObjectOfObjects value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for ObjectOfObjects { +impl std::str::FromStr for ObjectOfObjects { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -636,13 +629,13 @@ impl ::std::str::FromStr for ObjectOfObjects { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing ObjectOfObjects".to_string()) + None => return std::result::Result::Err("Missing value while parsing ObjectOfObjects".to_string()) }; if let Some(key) = key_result { match key { "inner" => intermediate_rep.inner.push(models::ObjectOfObjectsInner::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing ObjectOfObjects".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing ObjectOfObjects".to_string()) } } @@ -651,7 +644,7 @@ impl ::std::str::FromStr for ObjectOfObjects { } // Use the intermediate representation to return the struct - Ok(ObjectOfObjects { + std::result::Result::Ok(ObjectOfObjects { inner: intermediate_rep.inner.into_iter().next(), }) } @@ -659,17 +652,17 @@ impl ::std::str::FromStr for ObjectOfObjects { -// Methods for converting between IntoHeaderValue and HeaderValue +// Methods for converting between header::IntoHeaderValue and hyper::header::HeaderValue -impl From> for HeaderValue { - fn from(hdr_value: IntoHeaderValue) -> Self { - HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl From> for hyper::header::HeaderValue { + fn from(hdr_value: header::IntoHeaderValue) -> Self { + hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() } } -impl From for IntoHeaderValue { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(ObjectOfObjectsInner::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl From for header::IntoHeaderValue { + fn from(hdr_value: hyper::header::HeaderValue) -> Self { + header::IntoHeaderValue(::from_str(hdr_value.to_str().unwrap()).unwrap()) } } @@ -698,7 +691,7 @@ impl ObjectOfObjectsInner { /// Converts the ObjectOfObjectsInner value to the Query Parameters representation (style=form, explode=false) /// specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde serializer -impl ::std::string::ToString for ObjectOfObjectsInner { +impl std::string::ToString for ObjectOfObjectsInner { fn to_string(&self) -> String { let mut params: Vec = vec![]; @@ -718,10 +711,10 @@ impl ::std::string::ToString for ObjectOfObjectsInner { /// Converts Query Parameters representation (style=form, explode=false) to a ObjectOfObjectsInner value /// as specified in https://swagger.io/docs/specification/serialization/ /// Should be implemented in a serde deserializer -impl ::std::str::FromStr for ObjectOfObjectsInner { +impl std::str::FromStr for ObjectOfObjectsInner { type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> std::result::Result { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { @@ -738,14 +731,14 @@ impl ::std::str::FromStr for ObjectOfObjectsInner { while key_result.is_some() { let val = match string_iter.next() { Some(x) => x, - None => return Err("Missing value while parsing ObjectOfObjectsInner".to_string()) + None => return std::result::Result::Err("Missing value while parsing ObjectOfObjectsInner".to_string()) }; if let Some(key) = key_result { match key { "required_thing" => intermediate_rep.required_thing.push(String::from_str(val).map_err(|x| format!("{}", x))?), "optional_thing" => intermediate_rep.optional_thing.push(isize::from_str(val).map_err(|x| format!("{}", x))?), - _ => return Err("Unexpected key while parsing ObjectOfObjectsInner".to_string()) + _ => return std::result::Result::Err("Unexpected key while parsing ObjectOfObjectsInner".to_string()) } } @@ -754,7 +747,7 @@ impl ::std::str::FromStr for ObjectOfObjectsInner { } // Use the intermediate representation to return the struct - Ok(ObjectOfObjectsInner { + std::result::Result::Ok(ObjectOfObjectsInner { required_thing: intermediate_rep.required_thing.into_iter().next().ok_or("required_thing missing in ObjectOfObjectsInner".to_string())?, optional_thing: intermediate_rep.optional_thing.into_iter().next(), }) diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs index 56c2050b8f1..29500c0fff6 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs @@ -1,5 +1,3 @@ -#[allow(unused_imports)] -use std::collections::{HashMap, BTreeMap, BTreeSet}; use std::marker::PhantomData; use futures::{Future, future, Stream, stream}; use hyper;