mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 14:40:53 +00:00
update rust server samples
This commit is contained in:
parent
8408e0235b
commit
c4563009c7
@ -122,9 +122,11 @@ Method | HTTP request | Description
|
|||||||
|
|
||||||
## Documentation For Models
|
## Documentation For Models
|
||||||
|
|
||||||
|
- [AnotherXmlArray](docs/AnotherXmlArray.md)
|
||||||
- [AnotherXmlInner](docs/AnotherXmlInner.md)
|
- [AnotherXmlInner](docs/AnotherXmlInner.md)
|
||||||
- [AnotherXmlObject](docs/AnotherXmlObject.md)
|
- [AnotherXmlObject](docs/AnotherXmlObject.md)
|
||||||
- [DuplicateXmlObject](docs/DuplicateXmlObject.md)
|
- [DuplicateXmlObject](docs/DuplicateXmlObject.md)
|
||||||
|
- [XmlArray](docs/XmlArray.md)
|
||||||
- [XmlInner](docs/XmlInner.md)
|
- [XmlInner](docs/XmlInner.md)
|
||||||
- [XmlObject](docs/XmlObject.md)
|
- [XmlObject](docs/XmlObject.md)
|
||||||
|
|
||||||
|
@ -96,12 +96,7 @@ components:
|
|||||||
inner_string:
|
inner_string:
|
||||||
type: string
|
type: string
|
||||||
inner_array:
|
inner_array:
|
||||||
items:
|
$ref: '#/components/schemas/xml_array'
|
||||||
$ref: '#/components/schemas/xml_inner'
|
|
||||||
type: array
|
|
||||||
xml:
|
|
||||||
name: CamelXmlArray
|
|
||||||
wrapped: true
|
|
||||||
required:
|
required:
|
||||||
- inner_array
|
- inner_array
|
||||||
type: object
|
type: object
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
**inner_string** | **String** | | [optional] [default to None]
|
**inner_string** | **String** | | [optional] [default to None]
|
||||||
**inner_array** | **Vec<models::XmlInner>** | |
|
**inner_array** | [***models::XmlArray**](xml_array.md) | |
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
@ -88,12 +88,12 @@ fn main() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
Some("XmlOtherPut") => {
|
Some("XmlOtherPut") => {
|
||||||
let result = core.run(client.xml_other_put(Some(&Vec::new())));
|
let result = core.run(client.xml_other_put(None));
|
||||||
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
|
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
|
||||||
},
|
},
|
||||||
|
|
||||||
Some("XmlPost") => {
|
Some("XmlPost") => {
|
||||||
let result = core.run(client.xml_post(Some(&Vec::new())));
|
let result = core.run(client.xml_post(None));
|
||||||
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
|
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -47,14 +47,14 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn xml_other_put(&self, string: Option<&Vec<models::AnotherXmlInner>>, context: &C) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>> {
|
fn xml_other_put(&self, string: Option<models::AnotherXmlArray>, context: &C) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>> {
|
||||||
let context = context.clone();
|
let context = context.clone();
|
||||||
println!("xml_other_put({:?}) - X-Span-ID: {:?}", string, context.get().0.clone());
|
println!("xml_other_put({:?}) - X-Span-ID: {:?}", string, context.get().0.clone());
|
||||||
Box::new(futures::failed("Generic failure".into()))
|
Box::new(futures::failed("Generic failure".into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Post an array
|
/// Post an array
|
||||||
fn xml_post(&self, string: Option<&Vec<models::XmlInner>>, context: &C) -> Box<Future<Item=XmlPostResponse, Error=ApiError>> {
|
fn xml_post(&self, string: Option<models::XmlArray>, context: &C) -> Box<Future<Item=XmlPostResponse, Error=ApiError>> {
|
||||||
let context = context.clone();
|
let context = context.clone();
|
||||||
println!("xml_post({:?}) - X-Span-ID: {:?}", string, context.get().0.clone());
|
println!("xml_post({:?}) - X-Span-ID: {:?}", string, context.get().0.clone());
|
||||||
Box::new(futures::failed("Generic failure".into()))
|
Box::new(futures::failed("Generic failure".into()))
|
||||||
|
@ -412,7 +412,7 @@ if let Some(body) = body {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn xml_other_put(&self, param_string: Option<&Vec<models::AnotherXmlInner>>, context: &C) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>> {
|
fn xml_other_put(&self, param_string: Option<models::AnotherXmlArray>, context: &C) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>> {
|
||||||
let mut uri = format!(
|
let mut uri = format!(
|
||||||
"{}/xml_other",
|
"{}/xml_other",
|
||||||
self.base_path
|
self.base_path
|
||||||
@ -492,7 +492,7 @@ if let Some(body) = body {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn xml_post(&self, param_string: Option<&Vec<models::XmlInner>>, context: &C) -> Box<Future<Item=XmlPostResponse, Error=ApiError>> {
|
fn xml_post(&self, param_string: Option<models::XmlArray>, context: &C) -> Box<Future<Item=XmlPostResponse, Error=ApiError>> {
|
||||||
let mut uri = format!(
|
let mut uri = format!(
|
||||||
"{}/xml",
|
"{}/xml",
|
||||||
self.base_path
|
self.base_path
|
||||||
|
@ -90,10 +90,10 @@ pub trait Api<C> {
|
|||||||
fn xml_other_post(&self, another_xml_object: Option<models::AnotherXmlObject>, context: &C) -> Box<Future<Item=XmlOtherPostResponse, Error=ApiError>>;
|
fn xml_other_post(&self, another_xml_object: Option<models::AnotherXmlObject>, context: &C) -> Box<Future<Item=XmlOtherPostResponse, Error=ApiError>>;
|
||||||
|
|
||||||
|
|
||||||
fn xml_other_put(&self, string: Option<&Vec<models::AnotherXmlInner>>, context: &C) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>>;
|
fn xml_other_put(&self, string: Option<models::AnotherXmlArray>, context: &C) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>>;
|
||||||
|
|
||||||
/// Post an array
|
/// Post an array
|
||||||
fn xml_post(&self, string: Option<&Vec<models::XmlInner>>, context: &C) -> Box<Future<Item=XmlPostResponse, Error=ApiError>>;
|
fn xml_post(&self, string: Option<models::XmlArray>, context: &C) -> Box<Future<Item=XmlPostResponse, Error=ApiError>>;
|
||||||
|
|
||||||
|
|
||||||
fn xml_put(&self, xml_object: Option<models::XmlObject>, context: &C) -> Box<Future<Item=XmlPutResponse, Error=ApiError>>;
|
fn xml_put(&self, xml_object: Option<models::XmlObject>, context: &C) -> Box<Future<Item=XmlPutResponse, Error=ApiError>>;
|
||||||
@ -110,10 +110,10 @@ pub trait ApiNoContext {
|
|||||||
fn xml_other_post(&self, another_xml_object: Option<models::AnotherXmlObject>) -> Box<Future<Item=XmlOtherPostResponse, Error=ApiError>>;
|
fn xml_other_post(&self, another_xml_object: Option<models::AnotherXmlObject>) -> Box<Future<Item=XmlOtherPostResponse, Error=ApiError>>;
|
||||||
|
|
||||||
|
|
||||||
fn xml_other_put(&self, string: Option<&Vec<models::AnotherXmlInner>>) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>>;
|
fn xml_other_put(&self, string: Option<models::AnotherXmlArray>) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>>;
|
||||||
|
|
||||||
/// Post an array
|
/// Post an array
|
||||||
fn xml_post(&self, string: Option<&Vec<models::XmlInner>>) -> Box<Future<Item=XmlPostResponse, Error=ApiError>>;
|
fn xml_post(&self, string: Option<models::XmlArray>) -> Box<Future<Item=XmlPostResponse, Error=ApiError>>;
|
||||||
|
|
||||||
|
|
||||||
fn xml_put(&self, xml_object: Option<models::XmlObject>) -> Box<Future<Item=XmlPutResponse, Error=ApiError>>;
|
fn xml_put(&self, xml_object: Option<models::XmlObject>) -> Box<Future<Item=XmlPutResponse, Error=ApiError>>;
|
||||||
@ -145,12 +145,12 @@ impl<'a, T: Api<C>, C> ApiNoContext for ContextWrapper<'a, T, C> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn xml_other_put(&self, string: Option<&Vec<models::AnotherXmlInner>>) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>> {
|
fn xml_other_put(&self, string: Option<models::AnotherXmlArray>) -> Box<Future<Item=XmlOtherPutResponse, Error=ApiError>> {
|
||||||
self.api().xml_other_put(string, &self.context())
|
self.api().xml_other_put(string, &self.context())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Post an array
|
/// Post an array
|
||||||
fn xml_post(&self, string: Option<&Vec<models::XmlInner>>) -> Box<Future<Item=XmlPostResponse, Error=ApiError>> {
|
fn xml_post(&self, string: Option<models::XmlArray>) -> Box<Future<Item=XmlPostResponse, Error=ApiError>> {
|
||||||
self.api().xml_post(string, &self.context())
|
self.api().xml_post(string, &self.context())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,86 @@ use models;
|
|||||||
use swagger;
|
use swagger;
|
||||||
|
|
||||||
|
|
||||||
|
// Utility function for wrapping list elements when serializing xml
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
fn wrap_in_snake_another_xml_inner<S>(item: &Vec<String>, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
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_in_snake_another_xml_inner")]Vec<String>);
|
||||||
|
|
||||||
|
impl ::std::convert::From<Vec<String>> for AnotherXmlArray {
|
||||||
|
fn from(x: Vec<String>) -> Self {
|
||||||
|
AnotherXmlArray(x)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::std::convert::From<AnotherXmlArray> for Vec<String> {
|
||||||
|
fn from(x: AnotherXmlArray) -> Self {
|
||||||
|
x.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::std::iter::FromIterator<String> for AnotherXmlArray {
|
||||||
|
fn from_iter<U: IntoIterator<Item=String>>(u: U) -> Self {
|
||||||
|
AnotherXmlArray(Vec::<String>::from_iter(u))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::std::iter::IntoIterator for AnotherXmlArray {
|
||||||
|
type Item = String;
|
||||||
|
type IntoIter = ::std::vec::IntoIter<String>;
|
||||||
|
|
||||||
|
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<String>;
|
||||||
|
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)]
|
#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
#[serde(rename = "snake_another_xml_inner")]
|
#[serde(rename = "snake_another_xml_inner")]
|
||||||
pub struct AnotherXmlInner(String);
|
pub struct AnotherXmlInner(String);
|
||||||
@ -94,12 +174,13 @@ pub struct DuplicateXmlObject {
|
|||||||
pub inner_string: Option<String>,
|
pub inner_string: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "inner_array")]
|
#[serde(rename = "inner_array")]
|
||||||
pub inner_array: Vec<models::XmlInner>,
|
#[serde(serialize_with = "wrap_in_camelXmlInner")]
|
||||||
|
pub inner_array: models::XmlArray,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DuplicateXmlObject {
|
impl DuplicateXmlObject {
|
||||||
pub fn new(inner_array: Vec<models::XmlInner>, ) -> DuplicateXmlObject {
|
pub fn new(inner_array: models::XmlArray, ) -> DuplicateXmlObject {
|
||||||
DuplicateXmlObject {
|
DuplicateXmlObject {
|
||||||
inner_string: None,
|
inner_string: None,
|
||||||
inner_array: inner_array,
|
inner_array: inner_array,
|
||||||
@ -125,6 +206,86 @@ impl DuplicateXmlObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Utility function for wrapping list elements when serializing xml
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
fn wrap_in_camelXmlInner<S>(item: &Vec<String>, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
S: Serializer,
|
||||||
|
{
|
||||||
|
serde_xml_rs::wrap_primitives(item, serializer, "camelXmlInner")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
|
pub struct XmlArray(#[serde(serialize_with = "wrap_in_camelXmlInner")]Vec<String>);
|
||||||
|
|
||||||
|
impl ::std::convert::From<Vec<String>> for XmlArray {
|
||||||
|
fn from(x: Vec<String>) -> Self {
|
||||||
|
XmlArray(x)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::std::convert::From<XmlArray> for Vec<String> {
|
||||||
|
fn from(x: XmlArray) -> Self {
|
||||||
|
x.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::std::iter::FromIterator<String> for XmlArray {
|
||||||
|
fn from_iter<U: IntoIterator<Item=String>>(u: U) -> Self {
|
||||||
|
XmlArray(Vec::<String>::from_iter(u))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::std::iter::IntoIterator for XmlArray {
|
||||||
|
type Item = String;
|
||||||
|
type IntoIter = ::std::vec::IntoIter<String>;
|
||||||
|
|
||||||
|
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<String>;
|
||||||
|
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)]
|
#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||||
#[serde(rename = "camelXmlInner")]
|
#[serde(rename = "camelXmlInner")]
|
||||||
pub struct XmlInner(String);
|
pub struct XmlInner(String);
|
||||||
|
@ -309,7 +309,7 @@ where
|
|||||||
Ok(body) => {
|
Ok(body) => {
|
||||||
|
|
||||||
let mut unused_elements = Vec::new();
|
let mut unused_elements = Vec::new();
|
||||||
let param_string: Option<Vec<models::AnotherXmlInner>> = if !body.is_empty() {
|
let param_string: Option<models::AnotherXmlArray> = if !body.is_empty() {
|
||||||
let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body);
|
let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body);
|
||||||
|
|
||||||
match serde_ignored::deserialize(deserializer, |path| {
|
match serde_ignored::deserialize(deserializer, |path| {
|
||||||
@ -326,7 +326,7 @@ where
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Box::new(api_impl.xml_other_put(param_string.as_ref(), &context)
|
Box::new(api_impl.xml_other_put(param_string, &context)
|
||||||
.then(move |result| {
|
.then(move |result| {
|
||||||
let mut response = Response::new();
|
let mut response = Response::new();
|
||||||
response.headers_mut().set(XSpanId((&context as &Has<XSpanIdString>).get().0.to_string()));
|
response.headers_mut().set(XSpanId((&context as &Has<XSpanIdString>).get().0.to_string()));
|
||||||
@ -391,7 +391,7 @@ where
|
|||||||
Ok(body) => {
|
Ok(body) => {
|
||||||
|
|
||||||
let mut unused_elements = Vec::new();
|
let mut unused_elements = Vec::new();
|
||||||
let param_string: Option<Vec<models::XmlInner>> = if !body.is_empty() {
|
let param_string: Option<models::XmlArray> = if !body.is_empty() {
|
||||||
let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body);
|
let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body);
|
||||||
|
|
||||||
match serde_ignored::deserialize(deserializer, |path| {
|
match serde_ignored::deserialize(deserializer, |path| {
|
||||||
@ -408,7 +408,7 @@ where
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Box::new(api_impl.xml_post(param_string.as_ref(), &context)
|
Box::new(api_impl.xml_post(param_string, &context)
|
||||||
.then(move |result| {
|
.then(move |result| {
|
||||||
let mut response = Response::new();
|
let mut response = Response::new();
|
||||||
response.headers_mut().set(XSpanId((&context as &Has<XSpanIdString>).get().0.to_string()));
|
response.headers_mut().set(XSpanId((&context as &Has<XSpanIdString>).get().0.to_string()));
|
||||||
|
@ -178,6 +178,7 @@ Method | HTTP request | Description
|
|||||||
|
|
||||||
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
||||||
- [Animal](docs/Animal.md)
|
- [Animal](docs/Animal.md)
|
||||||
|
- [AnimalFarm](docs/AnimalFarm.md)
|
||||||
- [ApiResponse](docs/ApiResponse.md)
|
- [ApiResponse](docs/ApiResponse.md)
|
||||||
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
||||||
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||||
|
@ -33,7 +33,7 @@ Optional parameters are passed through a map[string]interface{}.
|
|||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**body** | **bool**| Input boolean as post body |
|
**body** | [**boolean**](boolean.md)| Input boolean as post body |
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ Optional parameters are passed through a map[string]interface{}.
|
|||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**body** | **f64**| Input number as post body |
|
**body** | [**number**](number.md)| Input number as post body |
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ Optional parameters are passed through a map[string]interface{}.
|
|||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------- | ------------- | ------------- | -------------
|
------------- | ------------- | ------------- | -------------
|
||||||
**body** | **String**| Input string as post body |
|
**body** | [**string**](string.md)| Input string as post body |
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ fn main() {
|
|||||||
// },
|
// },
|
||||||
|
|
||||||
Some("FakeOuterBooleanSerialize") => {
|
Some("FakeOuterBooleanSerialize") => {
|
||||||
let result = core.run(client.fake_outer_boolean_serialize(Some(true)));
|
let result = core.run(client.fake_outer_boolean_serialize(None));
|
||||||
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
|
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -138,12 +138,12 @@ fn main() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
Some("FakeOuterNumberSerialize") => {
|
Some("FakeOuterNumberSerialize") => {
|
||||||
let result = core.run(client.fake_outer_number_serialize(Some(8.14)));
|
let result = core.run(client.fake_outer_number_serialize(None));
|
||||||
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
|
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
|
||||||
},
|
},
|
||||||
|
|
||||||
Some("FakeOuterStringSerialize") => {
|
Some("FakeOuterStringSerialize") => {
|
||||||
let result = core.run(client.fake_outer_string_serialize(Some("body_example".to_string())));
|
let result = core.run(client.fake_outer_string_serialize(None));
|
||||||
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
|
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn fake_outer_boolean_serialize(&self, body: Option<bool>, context: &C) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>> {
|
fn fake_outer_boolean_serialize(&self, body: Option<models::OuterBoolean>, context: &C) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>> {
|
||||||
let context = context.clone();
|
let context = context.clone();
|
||||||
println!("fake_outer_boolean_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone());
|
println!("fake_outer_boolean_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone());
|
||||||
Box::new(futures::failed("Generic failure".into()))
|
Box::new(futures::failed("Generic failure".into()))
|
||||||
@ -81,14 +81,14 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn fake_outer_number_serialize(&self, body: Option<f64>, context: &C) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>> {
|
fn fake_outer_number_serialize(&self, body: Option<models::OuterNumber>, context: &C) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>> {
|
||||||
let context = context.clone();
|
let context = context.clone();
|
||||||
println!("fake_outer_number_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone());
|
println!("fake_outer_number_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone());
|
||||||
Box::new(futures::failed("Generic failure".into()))
|
Box::new(futures::failed("Generic failure".into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn fake_outer_string_serialize(&self, body: Option<String>, context: &C) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>> {
|
fn fake_outer_string_serialize(&self, body: Option<models::OuterString>, context: &C) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>> {
|
||||||
let context = context.clone();
|
let context = context.clone();
|
||||||
println!("fake_outer_string_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone());
|
println!("fake_outer_string_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone());
|
||||||
Box::new(futures::failed("Generic failure".into()))
|
Box::new(futures::failed("Generic failure".into()))
|
||||||
|
@ -357,7 +357,7 @@ impl<F, C> Api<C> for Client<F> where
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fake_outer_boolean_serialize(&self, param_body: Option<bool>, context: &C) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>> {
|
fn fake_outer_boolean_serialize(&self, param_body: Option<models::OuterBoolean>, context: &C) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>> {
|
||||||
let mut uri = format!(
|
let mut uri = format!(
|
||||||
"{}/v2/fake/outer/boolean",
|
"{}/v2/fake/outer/boolean",
|
||||||
self.base_path
|
self.base_path
|
||||||
@ -521,7 +521,7 @@ if let Some(body) = body {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fake_outer_number_serialize(&self, param_body: Option<f64>, context: &C) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>> {
|
fn fake_outer_number_serialize(&self, param_body: Option<models::OuterNumber>, context: &C) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>> {
|
||||||
let mut uri = format!(
|
let mut uri = format!(
|
||||||
"{}/v2/fake/outer/number",
|
"{}/v2/fake/outer/number",
|
||||||
self.base_path
|
self.base_path
|
||||||
@ -602,7 +602,7 @@ if let Some(body) = body {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fake_outer_string_serialize(&self, param_body: Option<String>, context: &C) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>> {
|
fn fake_outer_string_serialize(&self, param_body: Option<models::OuterString>, context: &C) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>> {
|
||||||
let mut uri = format!(
|
let mut uri = format!(
|
||||||
"{}/v2/fake/outer/string",
|
"{}/v2/fake/outer/string",
|
||||||
self.base_path
|
self.base_path
|
||||||
|
@ -273,16 +273,16 @@ pub trait Api<C> {
|
|||||||
fn test_special_tags(&self, body: models::Client, context: &C) -> Box<Future<Item=TestSpecialTagsResponse, Error=ApiError>>;
|
fn test_special_tags(&self, body: models::Client, context: &C) -> Box<Future<Item=TestSpecialTagsResponse, Error=ApiError>>;
|
||||||
|
|
||||||
|
|
||||||
fn fake_outer_boolean_serialize(&self, body: Option<bool>, context: &C) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>>;
|
fn fake_outer_boolean_serialize(&self, body: Option<models::OuterBoolean>, context: &C) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>>;
|
||||||
|
|
||||||
|
|
||||||
fn fake_outer_composite_serialize(&self, body: Option<models::OuterComposite>, context: &C) -> Box<Future<Item=FakeOuterCompositeSerializeResponse, Error=ApiError>>;
|
fn fake_outer_composite_serialize(&self, body: Option<models::OuterComposite>, context: &C) -> Box<Future<Item=FakeOuterCompositeSerializeResponse, Error=ApiError>>;
|
||||||
|
|
||||||
|
|
||||||
fn fake_outer_number_serialize(&self, body: Option<f64>, context: &C) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>>;
|
fn fake_outer_number_serialize(&self, body: Option<models::OuterNumber>, context: &C) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>>;
|
||||||
|
|
||||||
|
|
||||||
fn fake_outer_string_serialize(&self, body: Option<String>, context: &C) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>>;
|
fn fake_outer_string_serialize(&self, body: Option<models::OuterString>, context: &C) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>>;
|
||||||
|
|
||||||
|
|
||||||
fn test_body_with_query_params(&self, query: String, body: models::User, context: &C) -> Box<Future<Item=TestBodyWithQueryParamsResponse, Error=ApiError>>;
|
fn test_body_with_query_params(&self, query: String, body: models::User, context: &C) -> Box<Future<Item=TestBodyWithQueryParamsResponse, Error=ApiError>>;
|
||||||
@ -374,16 +374,16 @@ pub trait ApiNoContext {
|
|||||||
fn test_special_tags(&self, body: models::Client) -> Box<Future<Item=TestSpecialTagsResponse, Error=ApiError>>;
|
fn test_special_tags(&self, body: models::Client) -> Box<Future<Item=TestSpecialTagsResponse, Error=ApiError>>;
|
||||||
|
|
||||||
|
|
||||||
fn fake_outer_boolean_serialize(&self, body: Option<bool>) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>>;
|
fn fake_outer_boolean_serialize(&self, body: Option<models::OuterBoolean>) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>>;
|
||||||
|
|
||||||
|
|
||||||
fn fake_outer_composite_serialize(&self, body: Option<models::OuterComposite>) -> Box<Future<Item=FakeOuterCompositeSerializeResponse, Error=ApiError>>;
|
fn fake_outer_composite_serialize(&self, body: Option<models::OuterComposite>) -> Box<Future<Item=FakeOuterCompositeSerializeResponse, Error=ApiError>>;
|
||||||
|
|
||||||
|
|
||||||
fn fake_outer_number_serialize(&self, body: Option<f64>) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>>;
|
fn fake_outer_number_serialize(&self, body: Option<models::OuterNumber>) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>>;
|
||||||
|
|
||||||
|
|
||||||
fn fake_outer_string_serialize(&self, body: Option<String>) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>>;
|
fn fake_outer_string_serialize(&self, body: Option<models::OuterString>) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>>;
|
||||||
|
|
||||||
|
|
||||||
fn test_body_with_query_params(&self, query: String, body: models::User) -> Box<Future<Item=TestBodyWithQueryParamsResponse, Error=ApiError>>;
|
fn test_body_with_query_params(&self, query: String, body: models::User) -> Box<Future<Item=TestBodyWithQueryParamsResponse, Error=ApiError>>;
|
||||||
@ -488,7 +488,7 @@ impl<'a, T: Api<C>, C> ApiNoContext for ContextWrapper<'a, T, C> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn fake_outer_boolean_serialize(&self, body: Option<bool>) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>> {
|
fn fake_outer_boolean_serialize(&self, body: Option<models::OuterBoolean>) -> Box<Future<Item=FakeOuterBooleanSerializeResponse, Error=ApiError>> {
|
||||||
self.api().fake_outer_boolean_serialize(body, &self.context())
|
self.api().fake_outer_boolean_serialize(body, &self.context())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,12 +498,12 @@ impl<'a, T: Api<C>, C> ApiNoContext for ContextWrapper<'a, T, C> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn fake_outer_number_serialize(&self, body: Option<f64>) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>> {
|
fn fake_outer_number_serialize(&self, body: Option<models::OuterNumber>) -> Box<Future<Item=FakeOuterNumberSerializeResponse, Error=ApiError>> {
|
||||||
self.api().fake_outer_number_serialize(body, &self.context())
|
self.api().fake_outer_number_serialize(body, &self.context())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn fake_outer_string_serialize(&self, body: Option<String>) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>> {
|
fn fake_outer_string_serialize(&self, body: Option<models::OuterString>) -> Box<Future<Item=FakeOuterStringSerializeResponse, Error=ApiError>> {
|
||||||
self.api().fake_outer_string_serialize(body, &self.context())
|
self.api().fake_outer_string_serialize(body, &self.context())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +69,77 @@ impl Animal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
|
pub struct AnimalFarm(Vec<Animal>);
|
||||||
|
|
||||||
|
impl ::std::convert::From<Vec<Animal>> for AnimalFarm {
|
||||||
|
fn from(x: Vec<Animal>) -> Self {
|
||||||
|
AnimalFarm(x)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::std::convert::From<AnimalFarm> for Vec<Animal> {
|
||||||
|
fn from(x: AnimalFarm) -> Self {
|
||||||
|
x.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::std::iter::FromIterator<Animal> for AnimalFarm {
|
||||||
|
fn from_iter<U: IntoIterator<Item=Animal>>(u: U) -> Self {
|
||||||
|
AnimalFarm(Vec::<Animal>::from_iter(u))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ::std::iter::IntoIterator for AnimalFarm {
|
||||||
|
type Item = Animal;
|
||||||
|
type IntoIter = ::std::vec::IntoIter<Animal>;
|
||||||
|
|
||||||
|
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<Animal>;
|
||||||
|
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)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct ApiResponse {
|
pub struct ApiResponse {
|
||||||
#[serde(rename = "code")]
|
#[serde(rename = "code")]
|
||||||
|
@ -313,7 +313,7 @@ where
|
|||||||
Ok(body) => {
|
Ok(body) => {
|
||||||
|
|
||||||
let mut unused_elements = Vec::new();
|
let mut unused_elements = Vec::new();
|
||||||
let param_body: Option<bool> = if !body.is_empty() {
|
let param_body: Option<models::OuterBoolean> = if !body.is_empty() {
|
||||||
|
|
||||||
let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
|
let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
|
||||||
|
|
||||||
@ -481,7 +481,7 @@ where
|
|||||||
Ok(body) => {
|
Ok(body) => {
|
||||||
|
|
||||||
let mut unused_elements = Vec::new();
|
let mut unused_elements = Vec::new();
|
||||||
let param_body: Option<f64> = if !body.is_empty() {
|
let param_body: Option<models::OuterNumber> = if !body.is_empty() {
|
||||||
|
|
||||||
let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
|
let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
|
||||||
|
|
||||||
@ -565,7 +565,7 @@ where
|
|||||||
Ok(body) => {
|
Ok(body) => {
|
||||||
|
|
||||||
let mut unused_elements = Vec::new();
|
let mut unused_elements = Vec::new();
|
||||||
let param_body: Option<String> = if !body.is_empty() {
|
let param_body: Option<models::OuterString> = if !body.is_empty() {
|
||||||
|
|
||||||
let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
|
let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
|
||||||
|
|
||||||
|
@ -123,6 +123,7 @@ Method | HTTP request | Description
|
|||||||
## Documentation For Models
|
## Documentation For Models
|
||||||
|
|
||||||
- [ANullableContainer](docs/ANullableContainer.md)
|
- [ANullableContainer](docs/ANullableContainer.md)
|
||||||
|
- [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md)
|
||||||
- [InlineObject](docs/InlineObject.md)
|
- [InlineObject](docs/InlineObject.md)
|
||||||
- [ObjectOfObjects](docs/ObjectOfObjects.md)
|
- [ObjectOfObjects](docs/ObjectOfObjects.md)
|
||||||
- [ObjectOfObjectsInner](docs/ObjectOfObjectsInner.md)
|
- [ObjectOfObjectsInner](docs/ObjectOfObjectsInner.md)
|
||||||
|
@ -32,6 +32,19 @@ 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)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct InlineObject {
|
pub struct InlineObject {
|
||||||
#[serde(rename = "id")]
|
#[serde(rename = "id")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user