diff --git a/docs/generators/aspnetcore.md b/docs/generators/aspnetcore.md index 64a0b8d9a3a..fdb73387f3f 100644 --- a/docs/generators/aspnetcore.md +++ b/docs/generators/aspnetcore.md @@ -23,11 +23,7 @@ sidebar_label: aspnetcore |useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false| |returnICollection|Return ICollection<T> instead of the concrete type.| |false| |useSwashbuckle|Uses the Swashbuckle.AspNetCore NuGet package for documentation.| |true| -|isLibrary|Is the build a library| |false| |classModifier|Class Modifier can be empty, abstract| || |operationModifier|Operation Modifier can be virtual, abstract or partial| |virtual| |buildTarget|Target to build an application or library| |program| |generateBody|Generates method body.| |true| -|operationIsAsync|Set methods to async or sync.| |false| -|operationResultTask|Set methods result to Task<>.| |false| -|modelClassModifier|Model Class Modifier can be nothing or partial| |partial| 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 25f25740576..78d035cbf11 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/README.md +++ b/samples/server/petstore/rust-server/output/openapi-v3/README.md @@ -122,11 +122,9 @@ Method | HTTP request | Description ## Documentation For Models - - [AnotherXmlArray](docs/AnotherXmlArray.md) - [AnotherXmlInner](docs/AnotherXmlInner.md) - [AnotherXmlObject](docs/AnotherXmlObject.md) - [DuplicateXmlObject](docs/DuplicateXmlObject.md) - - [XmlArray](docs/XmlArray.md) - [XmlInner](docs/XmlInner.md) - [XmlObject](docs/XmlObject.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 61ba273c4e4..d7f69a18cc4 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 @@ -84,7 +84,6 @@ components: innerString: type: string other_inner_rename: - format: int32 type: integer title: an XML object type: object diff --git a/samples/server/petstore/rust-server/output/openapi-v3/docs/XmlObject.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/XmlObject.md index 49ab2bec0e7..c7f413769b2 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/docs/XmlObject.md +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/XmlObject.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **inner_string** | **String** | | [optional] [default to None] -**other_inner_rename** | **i32** | | [optional] [default to None] +**other_inner_rename** | **isize** | | [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/openapi-v3/examples/client.rs b/samples/server/petstore/rust-server/output/openapi-v3/examples/client.rs index 2d88c04aebe..1dcf0da2241 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/examples/client.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/examples/client.rs @@ -88,12 +88,12 @@ fn main() { }, Some("XmlOtherPut") => { - let result = core.run(client.xml_other_put(None)); + let result = core.run(client.xml_other_put(Some(&Vec::new()))); println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); }, Some("XmlPost") => { - let result = core.run(client.xml_post(None)); + let result = core.run(client.xml_post(Some(&Vec::new()))); println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); }, diff --git a/samples/server/petstore/rust-server/output/openapi-v3/examples/server_lib/server.rs b/samples/server/petstore/rust-server/output/openapi-v3/examples/server_lib/server.rs index 1a2c6ff3821..e0fbbfc49a2 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/examples/server_lib/server.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/examples/server_lib/server.rs @@ -47,14 +47,14 @@ impl Api for Server where C: Has{ } - fn xml_other_put(&self, string: Option, context: &C) -> Box> { + fn xml_other_put(&self, string: Option<&Vec>, context: &C) -> Box> { let context = context.clone(); println!("xml_other_put({:?}) - X-Span-ID: {:?}", string, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Post an array - fn xml_post(&self, string: Option, context: &C) -> Box> { + fn xml_post(&self, string: Option<&Vec>, context: &C) -> Box> { let context = context.clone(); println!("xml_post({:?}) - X-Span-ID: {:?}", string, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) 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 dd266e898f9..68d7bff3cb7 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 @@ -256,6 +256,15 @@ impl Api for Client where self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -329,6 +338,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -394,12 +412,21 @@ if let Some(body) = body { } - fn xml_other_put(&self, param_string: Option, context: &C) -> Box> { + fn xml_other_put(&self, param_string: Option<&Vec>, context: &C) -> Box> { let mut uri = format!( "{}/xml_other", self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -465,12 +492,21 @@ if let Some(body) = body { } - fn xml_post(&self, param_string: Option, context: &C) -> Box> { + fn xml_post(&self, param_string: Option<&Vec>, context: &C) -> Box> { let mut uri = format!( "{}/xml", self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), @@ -542,6 +578,15 @@ if let Some(body) = body { self.base_path ); + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + let uri = match Uri::from_str(&uri) { Ok(uri) => uri, Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), 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 88ecd9b8b44..44d42fba401 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 @@ -90,10 +90,10 @@ pub trait Api { fn xml_other_post(&self, another_xml_object: Option, context: &C) -> Box>; - fn xml_other_put(&self, string: Option, context: &C) -> Box>; + fn xml_other_put(&self, string: Option<&Vec>, context: &C) -> Box>; /// Post an array - fn xml_post(&self, string: Option, context: &C) -> Box>; + fn xml_post(&self, string: Option<&Vec>, context: &C) -> Box>; fn xml_put(&self, xml_object: Option, context: &C) -> Box>; @@ -110,10 +110,10 @@ pub trait ApiNoContext { fn xml_other_post(&self, another_xml_object: Option) -> Box>; - fn xml_other_put(&self, string: Option) -> Box>; + fn xml_other_put(&self, string: Option<&Vec>) -> Box>; /// Post an array - fn xml_post(&self, string: Option) -> Box>; + fn xml_post(&self, string: Option<&Vec>) -> Box>; fn xml_put(&self, xml_object: Option) -> Box>; @@ -145,12 +145,12 @@ impl<'a, T: Api, C> ApiNoContext for ContextWrapper<'a, T, C> { } - fn xml_other_put(&self, string: Option) -> Box> { + fn xml_other_put(&self, string: Option<&Vec>) -> Box> { self.api().xml_other_put(string, &self.context()) } /// Post an array - fn xml_post(&self, string: Option) -> Box> { + fn xml_post(&self, string: Option<&Vec>) -> Box> { self.api().xml_post(string, &self.context()) } 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 37c6e48a860..99d3dc43227 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 @@ -10,85 +10,6 @@ use models; use swagger; -// Utility function for wrapping list elements when serializing xml -fn wrap_another_xml_array_in_xml_name(item: &Vec, serializer: S) -> Result -where - S: Serializer, -{ - serde_xml_rs::wrap_primitives(item, serializer, "snake_another_xml_inner") -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub struct AnotherXmlArray(#[serde(serialize_with = "wrap_another_xml_array_in_xml_name")]Vec); - -impl ::std::convert::From> for AnotherXmlArray { - fn from(x: Vec) -> Self { - AnotherXmlArray(x) - } -} - -impl ::std::convert::From for Vec { - fn from(x: AnotherXmlArray) -> Self { - x.0 - } -} - -impl ::std::iter::FromIterator for AnotherXmlArray { - fn from_iter>(u: U) -> Self { - AnotherXmlArray(Vec::::from_iter(u)) - } -} - -impl ::std::iter::IntoIterator for AnotherXmlArray { - type Item = String; - type IntoIter = ::std::vec::IntoIter; - - fn into_iter(self) -> Self::IntoIter { - self.0.into_iter() - } -} - -impl<'a> ::std::iter::IntoIterator for &'a AnotherXmlArray { - type Item = &'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 { - type Item = &'a mut 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 { - type Target = Vec; - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl ::std::ops::DerefMut for AnotherXmlArray { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - - -impl AnotherXmlArray { - /// 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)] #[serde(rename = "snake_another_xml_inner")] pub struct AnotherXmlInner(String); @@ -204,85 +125,6 @@ impl DuplicateXmlObject { } } -// Utility function for wrapping list elements when serializing xml -fn wrap_xml_array_in_xml_name(item: &Vec, serializer: S) -> Result -where - S: Serializer, -{ - serde_xml_rs::wrap_primitives(item, serializer, "camelXmlInner") -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub struct XmlArray(#[serde(serialize_with = "wrap_xml_array_in_xml_name")]Vec); - -impl ::std::convert::From> for XmlArray { - fn from(x: Vec) -> Self { - XmlArray(x) - } -} - -impl ::std::convert::From for Vec { - fn from(x: XmlArray) -> Self { - x.0 - } -} - -impl ::std::iter::FromIterator for XmlArray { - fn from_iter>(u: U) -> Self { - XmlArray(Vec::::from_iter(u)) - } -} - -impl ::std::iter::IntoIterator for XmlArray { - type Item = String; - type IntoIter = ::std::vec::IntoIter; - - fn into_iter(self) -> Self::IntoIter { - self.0.into_iter() - } -} - -impl<'a> ::std::iter::IntoIterator for &'a XmlArray { - type Item = &'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 { - type Item = &'a mut 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 { - type Target = Vec; - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl ::std::ops::DerefMut for XmlArray { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - - -impl XmlArray { - /// 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)] #[serde(rename = "camelXmlInner")] pub struct XmlInner(String); @@ -332,7 +174,7 @@ pub struct XmlObject { #[serde(rename = "other_inner_rename")] #[serde(skip_serializing_if="Option::is_none")] - pub other_inner_rename: Option, + pub other_inner_rename: Option, } 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 f86af16049b..b31ab07984f 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 @@ -309,7 +309,7 @@ where Ok(body) => { let mut unused_elements = Vec::new(); - let param_string: Option = if !body.is_empty() { + let param_string: Option> = if !body.is_empty() { let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body); match serde_ignored::deserialize(deserializer, |path| { @@ -326,7 +326,7 @@ where }; - Box::new(api_impl.xml_other_put(param_string, &context) + Box::new(api_impl.xml_other_put(param_string.as_ref(), &context) .then(move |result| { let mut response = Response::new(); response.headers_mut().set(XSpanId((&context as &Has).get().0.to_string())); @@ -391,7 +391,7 @@ where Ok(body) => { let mut unused_elements = Vec::new(); - let param_string: Option = if !body.is_empty() { + let param_string: Option> = if !body.is_empty() { let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body); match serde_ignored::deserialize(deserializer, |path| { @@ -408,7 +408,7 @@ where }; - Box::new(api_impl.xml_post(param_string, &context) + Box::new(api_impl.xml_post(param_string.as_ref(), &context) .then(move |result| { let mut response = Response::new(); response.headers_mut().set(XSpanId((&context as &Has).get().0.to_string())); diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/README.md b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/README.md index cf523bfaa75..55b9c86e03b 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/README.md +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/README.md @@ -178,7 +178,6 @@ Method | HTTP request | Description - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) - [Animal](docs/Animal.md) - - [AnimalFarm](docs/AnimalFarm.md) - [ApiResponse](docs/ApiResponse.md) - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/fake_api.md b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/fake_api.md index 372dc14d335..cdeba8866ff 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/fake_api.md +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/fake_api.md @@ -33,7 +33,7 @@ Optional parameters are passed through a map[string]interface{}. Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**boolean**](boolean.md)| Input boolean as post body | + **body** | **bool**| Input boolean as post body | ### Return type @@ -101,7 +101,7 @@ Optional parameters are passed through a map[string]interface{}. Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**number**](number.md)| Input number as post body | + **body** | **f64**| Input number as post body | ### Return type @@ -135,7 +135,7 @@ Optional parameters are passed through a map[string]interface{}. Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**string**](string.md)| Input string as post body | + **body** | **String**| Input string as post body | ### Return type diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/client.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/client.rs index b5803ba34c3..ec92f863613 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/client.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/client.rs @@ -128,7 +128,7 @@ fn main() { // }, Some("FakeOuterBooleanSerialize") => { - let result = core.run(client.fake_outer_boolean_serialize(None)); + let result = core.run(client.fake_outer_boolean_serialize(Some(true))); println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); }, @@ -138,12 +138,12 @@ fn main() { }, Some("FakeOuterNumberSerialize") => { - let result = core.run(client.fake_outer_number_serialize(None)); + let result = core.run(client.fake_outer_number_serialize(Some(8.14))); println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); }, Some("FakeOuterStringSerialize") => { - let result = core.run(client.fake_outer_string_serialize(None)); + let result = core.run(client.fake_outer_string_serialize(Some("body_example".to_string()))); println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); }, diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/server_lib/server.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/server_lib/server.rs index f0ee591cf95..4dc7ac8c862 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/server_lib/server.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/server_lib/server.rs @@ -67,7 +67,7 @@ impl Api for Server where C: Has{ } - fn fake_outer_boolean_serialize(&self, body: Option, context: &C) -> Box> { + fn fake_outer_boolean_serialize(&self, body: Option, context: &C) -> Box> { let context = context.clone(); println!("fake_outer_boolean_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) @@ -81,14 +81,14 @@ impl Api for Server where C: Has{ } - fn fake_outer_number_serialize(&self, body: Option, context: &C) -> Box> { + fn fake_outer_number_serialize(&self, body: Option, context: &C) -> Box> { let context = context.clone(); println!("fake_outer_number_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn fake_outer_string_serialize(&self, body: Option, context: &C) -> Box> { + fn fake_outer_string_serialize(&self, body: Option, context: &C) -> Box> { let context = context.clone(); println!("fake_outer_string_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) 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 a38838b0c6a..6c14ed0f176 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 @@ -357,7 +357,7 @@ impl Api for Client where } - fn fake_outer_boolean_serialize(&self, param_body: Option, context: &C) -> Box> { + fn fake_outer_boolean_serialize(&self, param_body: Option, context: &C) -> Box> { let mut uri = format!( "{}/v2/fake/outer/boolean", self.base_path @@ -521,7 +521,7 @@ if let Some(body) = body { } - fn fake_outer_number_serialize(&self, param_body: Option, context: &C) -> Box> { + fn fake_outer_number_serialize(&self, param_body: Option, context: &C) -> Box> { let mut uri = format!( "{}/v2/fake/outer/number", self.base_path @@ -602,7 +602,7 @@ if let Some(body) = body { } - fn fake_outer_string_serialize(&self, param_body: Option, context: &C) -> Box> { + fn fake_outer_string_serialize(&self, param_body: Option, context: &C) -> Box> { let mut uri = format!( "{}/v2/fake/outer/string", self.base_path 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 026ca6ef5de..2f2b4878e73 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 @@ -273,16 +273,16 @@ pub trait Api { fn test_special_tags(&self, body: models::Client, context: &C) -> Box>; - fn fake_outer_boolean_serialize(&self, body: Option, context: &C) -> Box>; + fn fake_outer_boolean_serialize(&self, body: Option, context: &C) -> Box>; fn fake_outer_composite_serialize(&self, body: Option, context: &C) -> Box>; - fn fake_outer_number_serialize(&self, body: Option, context: &C) -> Box>; + fn fake_outer_number_serialize(&self, body: Option, context: &C) -> Box>; - fn fake_outer_string_serialize(&self, body: Option, context: &C) -> Box>; + fn fake_outer_string_serialize(&self, body: Option, context: &C) -> Box>; fn test_body_with_query_params(&self, query: String, body: models::User, context: &C) -> Box>; @@ -374,16 +374,16 @@ pub trait ApiNoContext { fn test_special_tags(&self, body: models::Client) -> Box>; - fn fake_outer_boolean_serialize(&self, body: Option) -> Box>; + fn fake_outer_boolean_serialize(&self, body: Option) -> Box>; fn fake_outer_composite_serialize(&self, body: Option) -> Box>; - fn fake_outer_number_serialize(&self, body: Option) -> Box>; + fn fake_outer_number_serialize(&self, body: Option) -> Box>; - fn fake_outer_string_serialize(&self, body: Option) -> Box>; + fn fake_outer_string_serialize(&self, body: Option) -> Box>; fn test_body_with_query_params(&self, query: String, body: models::User) -> Box>; @@ -488,7 +488,7 @@ impl<'a, T: Api, C> ApiNoContext for ContextWrapper<'a, T, C> { } - fn fake_outer_boolean_serialize(&self, body: Option) -> Box> { + fn fake_outer_boolean_serialize(&self, body: Option) -> Box> { self.api().fake_outer_boolean_serialize(body, &self.context()) } @@ -498,12 +498,12 @@ impl<'a, T: Api, C> ApiNoContext for ContextWrapper<'a, T, C> { } - fn fake_outer_number_serialize(&self, body: Option) -> Box> { + fn fake_outer_number_serialize(&self, body: Option) -> Box> { self.api().fake_outer_number_serialize(body, &self.context()) } - fn fake_outer_string_serialize(&self, body: Option) -> Box> { + fn fake_outer_string_serialize(&self, body: Option) -> Box> { self.api().fake_outer_string_serialize(body, &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 b04e3de61b1..230c6cef39a 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 @@ -69,77 +69,6 @@ impl Animal { } } -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub struct AnimalFarm(Vec); - -impl ::std::convert::From> for AnimalFarm { - fn from(x: Vec) -> Self { - AnimalFarm(x) - } -} - -impl ::std::convert::From for Vec { - fn from(x: AnimalFarm) -> Self { - x.0 - } -} - -impl ::std::iter::FromIterator for AnimalFarm { - fn from_iter>(u: U) -> Self { - AnimalFarm(Vec::::from_iter(u)) - } -} - -impl ::std::iter::IntoIterator for AnimalFarm { - type Item = Animal; - type IntoIter = ::std::vec::IntoIter; - - fn into_iter(self) -> Self::IntoIter { - self.0.into_iter() - } -} - -impl<'a> ::std::iter::IntoIterator for &'a AnimalFarm { - type Item = &'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 { - type Item = &'a mut 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 { - type Target = Vec; - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl ::std::ops::DerefMut for AnimalFarm { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - - -impl AnimalFarm { - /// 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, Serialize, Deserialize)] pub struct ApiResponse { #[serde(rename = "code")] 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 72694a9cef1..30bd11d25f6 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 @@ -313,7 +313,7 @@ where Ok(body) => { let mut unused_elements = Vec::new(); - let param_body: Option = if !body.is_empty() { + let param_body: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&*body); @@ -481,7 +481,7 @@ where Ok(body) => { let mut unused_elements = Vec::new(); - let param_body: Option = if !body.is_empty() { + let param_body: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&*body); @@ -565,7 +565,7 @@ where Ok(body) => { let mut unused_elements = Vec::new(); - let param_body: Option = if !body.is_empty() { + let param_body: Option = if !body.is_empty() { let deserializer = &mut serde_json::Deserializer::from_slice(&*body); diff --git a/samples/server/petstore/rust-server/output/rust-server-test/README.md b/samples/server/petstore/rust-server/output/rust-server-test/README.md index 7a1e577f2e4..d8012a35b17 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/README.md +++ b/samples/server/petstore/rust-server/output/rust-server-test/README.md @@ -123,7 +123,6 @@ Method | HTTP request | Description ## Documentation For Models - [ANullableContainer](docs/ANullableContainer.md) - - [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md) - [InlineObject](docs/InlineObject.md) - [ObjectOfObjects](docs/ObjectOfObjects.md) - [ObjectOfObjectsInner](docs/ObjectOfObjectsInner.md) 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 36051fd4b7a..9ade781847b 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 @@ -32,19 +32,6 @@ impl ANullableContainer { } -/// An additionalPropertiesObject -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub struct AdditionalPropertiesObject { -} - -impl AdditionalPropertiesObject { - pub fn new() -> AdditionalPropertiesObject { - AdditionalPropertiesObject { - } - } -} - - #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct InlineObject { #[serde(rename = "id")]