forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 5.0-sync-master
This commit is contained in:
@@ -1 +1,5 @@
|
||||
5.0.0-SNAPSHOT
|
||||
<<<<<<< HEAD
|
||||
5.0.0-SNAPSHOT
|
||||
=======
|
||||
4.3.1-SNAPSHOT
|
||||
>>>>>>> origin/master
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
5.0.0-SNAPSHOT
|
||||
<<<<<<< HEAD
|
||||
5.0.0-SNAPSHOT
|
||||
=======
|
||||
4.3.1-SNAPSHOT
|
||||
>>>>>>> origin/master
|
||||
|
||||
@@ -116,11 +116,15 @@ paths:
|
||||
post:
|
||||
requestBody:
|
||||
content:
|
||||
application/xml:
|
||||
text/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/anotherXmlObject'
|
||||
responses:
|
||||
"201":
|
||||
content:
|
||||
text/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/anotherXmlObject'
|
||||
description: OK
|
||||
"400":
|
||||
description: Bad Request
|
||||
|
||||
@@ -459,7 +459,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)
|
||||
|
||||
# ****
|
||||
> (optional)
|
||||
> models::AnotherXmlObject (optional)
|
||||
|
||||
|
||||
### Required Parameters
|
||||
@@ -477,7 +477,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
[**models::AnotherXmlObject**](anotherXmlObject.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
@@ -485,8 +485,8 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/xml
|
||||
- **Accept**: Not defined
|
||||
- **Content-Type**: text/xml
|
||||
- **Accept**: text/xml,
|
||||
|
||||
[[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)
|
||||
|
||||
@@ -505,7 +505,7 @@ Optional parameters are passed through a map[string]interface{}.
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**string** | [**string**](string.md)| |
|
||||
**another_xml_array** | [**AnotherXmlArray**](AnotherXmlArray.md)| |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -537,7 +537,7 @@ Optional parameters are passed through a map[string]interface{}.
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**string** | [**string**](string.md)| |
|
||||
**xml_array** | [**XmlArray**](XmlArray.md)| |
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
//! Server implementation of openapi_v3.
|
||||
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use futures::{self, Future};
|
||||
use chrono;
|
||||
use std::collections::HashMap;
|
||||
use std::marker::PhantomData;
|
||||
use swagger;
|
||||
use swagger::{Has, XSpanIdString};
|
||||
use uuid;
|
||||
|
||||
use openapi_v3::{Api, ApiError,
|
||||
MultigetGetResponse,
|
||||
MultipleAuthSchemeGetResponse,
|
||||
ReadonlyAuthSchemeGetResponse,
|
||||
RequiredOctetStreamPutResponse,
|
||||
ResponsesWithHeadersGetResponse,
|
||||
UuidGetResponse,
|
||||
XmlExtraPostResponse,
|
||||
XmlOtherPostResponse,
|
||||
XmlOtherPutResponse,
|
||||
XmlPostResponse,
|
||||
XmlPutResponse
|
||||
};
|
||||
use openapi_v3::models;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Server<C> {
|
||||
marker: PhantomData<C>,
|
||||
}
|
||||
|
||||
impl<C> Server<C> {
|
||||
pub fn new() -> Self {
|
||||
Server{marker: PhantomData}
|
||||
}
|
||||
}
|
||||
|
||||
impl<C> Api<C> for Server<C> where C: Has<XSpanIdString>{
|
||||
|
||||
/// Get some stuff.
|
||||
fn multiget_get(&self, context: &C) -> Box<dyn Future<Item=MultigetGetResponse, Error=ApiError>> {
|
||||
let context = context.clone();
|
||||
println!("multiget_get() - X-Span-ID: {:?}", context.get().0.clone());
|
||||
Box::new(futures::failed("Generic failure".into()))
|
||||
}
|
||||
|
||||
|
||||
fn multiple_auth_scheme_get(&self, context: &C) -> Box<dyn Future<Item=MultipleAuthSchemeGetResponse, Error=ApiError>> {
|
||||
let context = context.clone();
|
||||
println!("multiple_auth_scheme_get() - X-Span-ID: {:?}", context.get().0.clone());
|
||||
Box::new(futures::failed("Generic failure".into()))
|
||||
}
|
||||
|
||||
|
||||
fn readonly_auth_scheme_get(&self, context: &C) -> Box<dyn Future<Item=ReadonlyAuthSchemeGetResponse, Error=ApiError>> {
|
||||
let context = context.clone();
|
||||
println!("readonly_auth_scheme_get() - X-Span-ID: {:?}", context.get().0.clone());
|
||||
Box::new(futures::failed("Generic failure".into()))
|
||||
}
|
||||
|
||||
|
||||
fn required_octet_stream_put(&self, body: swagger::ByteArray, context: &C) -> Box<dyn Future<Item=RequiredOctetStreamPutResponse, Error=ApiError>> {
|
||||
let context = context.clone();
|
||||
println!("required_octet_stream_put({:?}) - X-Span-ID: {:?}", body, context.get().0.clone());
|
||||
Box::new(futures::failed("Generic failure".into()))
|
||||
}
|
||||
|
||||
|
||||
fn responses_with_headers_get(&self, context: &C) -> Box<dyn Future<Item=ResponsesWithHeadersGetResponse, Error=ApiError>> {
|
||||
let context = context.clone();
|
||||
println!("responses_with_headers_get() - X-Span-ID: {:?}", context.get().0.clone());
|
||||
Box::new(futures::failed("Generic failure".into()))
|
||||
}
|
||||
|
||||
|
||||
fn uuid_get(&self, context: &C) -> Box<dyn Future<Item=UuidGetResponse, Error=ApiError>> {
|
||||
let context = context.clone();
|
||||
println!("uuid_get() - X-Span-ID: {:?}", context.get().0.clone());
|
||||
Box::new(futures::failed("Generic failure".into()))
|
||||
}
|
||||
|
||||
|
||||
fn xml_extra_post(&self, duplicate_xml_object: Option<models::DuplicateXmlObject>, context: &C) -> Box<dyn Future<Item=XmlExtraPostResponse, Error=ApiError>> {
|
||||
let context = context.clone();
|
||||
println!("xml_extra_post({:?}) - X-Span-ID: {:?}", duplicate_xml_object, context.get().0.clone());
|
||||
Box::new(futures::failed("Generic failure".into()))
|
||||
}
|
||||
|
||||
|
||||
fn xml_other_post(&self, another_xml_object: Option<models::AnotherXmlObject>, context: &C) -> Box<dyn Future<Item=XmlOtherPostResponse, Error=ApiError>> {
|
||||
let context = context.clone();
|
||||
println!("xml_other_post({:?}) - X-Span-ID: {:?}", another_xml_object, context.get().0.clone());
|
||||
Box::new(futures::failed("Generic failure".into()))
|
||||
}
|
||||
|
||||
|
||||
fn xml_other_put(&self, another_xml_array: Option<models::AnotherXmlArray>, context: &C) -> Box<dyn Future<Item=XmlOtherPutResponse, Error=ApiError>> {
|
||||
let context = context.clone();
|
||||
println!("xml_other_put({:?}) - X-Span-ID: {:?}", another_xml_array, context.get().0.clone());
|
||||
Box::new(futures::failed("Generic failure".into()))
|
||||
}
|
||||
|
||||
/// Post an array
|
||||
fn xml_post(&self, xml_array: Option<models::XmlArray>, context: &C) -> Box<dyn Future<Item=XmlPostResponse, Error=ApiError>> {
|
||||
let context = context.clone();
|
||||
println!("xml_post({:?}) - X-Span-ID: {:?}", xml_array, context.get().0.clone());
|
||||
Box::new(futures::failed("Generic failure".into()))
|
||||
}
|
||||
|
||||
|
||||
fn xml_put(&self, xml_object: Option<models::XmlObject>, context: &C) -> Box<dyn Future<Item=XmlPutResponse, Error=ApiError>> {
|
||||
let context = context.clone();
|
||||
println!("xml_put({:?}) - X-Span-ID: {:?}", xml_object, context.get().0.clone());
|
||||
Box::new(futures::failed("Generic failure".into()))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1905,10 +1905,30 @@ impl<C, F> Api<C> for Client<F> where
|
||||
201 => {
|
||||
let body = response.into_body();
|
||||
Box::new(
|
||||
<<<<<<< HEAD
|
||||
future::ok(
|
||||
XmlOtherPostResponse::OK
|
||||
)
|
||||
) as Box<dyn Future<Item=_, Error=_> + Send>
|
||||
=======
|
||||
body
|
||||
.concat2()
|
||||
.map_err(|e| ApiError(format!("Failed to read response: {}", e)))
|
||||
.and_then(|body|
|
||||
str::from_utf8(&body)
|
||||
.map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))
|
||||
.and_then(|body|
|
||||
// ToDo: this will move to swagger-rs and become a standard From conversion trait
|
||||
// once https://github.com/RReverser/serde-xml-rs/pull/45 is accepted upstream
|
||||
serde_xml_rs::from_str::<models::AnotherXmlObject>(body)
|
||||
.map_err(|e| ApiError(format!("Response body did not match the schema: {}", e)))
|
||||
)
|
||||
)
|
||||
.map(move |body| {
|
||||
XmlOtherPostResponse::OK(body)
|
||||
})
|
||||
) as Box<dyn Future<Item=_, Error=_>>
|
||||
>>>>>>> origin/master
|
||||
},
|
||||
400 => {
|
||||
let body = response.into_body();
|
||||
@@ -1941,11 +1961,15 @@ impl<C, F> Api<C> for Client<F> where
|
||||
}))
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
fn xml_other_put(
|
||||
&self,
|
||||
param_string: Option<models::AnotherXmlArray>,
|
||||
context: &C) -> Box<dyn Future<Item=XmlOtherPutResponse, Error=ApiError> + Send>
|
||||
{
|
||||
=======
|
||||
fn xml_other_put(&self, param_another_xml_array: Option<models::AnotherXmlArray>, context: &C) -> Box<dyn Future<Item=XmlOtherPutResponse, Error=ApiError>> {
|
||||
>>>>>>> origin/master
|
||||
let mut uri = format!(
|
||||
"{}/xml_other",
|
||||
self.base_path
|
||||
@@ -1972,7 +1996,7 @@ impl<C, F> Api<C> for Client<F> where
|
||||
Err(e) => return Box::new(future::err(ApiError(format!("Unable to create request: {}", e))))
|
||||
};
|
||||
|
||||
let body = param_string.map(|ref body| {
|
||||
let body = param_another_xml_array.map(|ref body| {
|
||||
body.to_xml()
|
||||
});
|
||||
if let Some(body) = body {
|
||||
@@ -2033,11 +2057,15 @@ impl<C, F> Api<C> for Client<F> where
|
||||
}))
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
fn xml_post(
|
||||
&self,
|
||||
param_string: Option<models::XmlArray>,
|
||||
context: &C) -> Box<dyn Future<Item=XmlPostResponse, Error=ApiError> + Send>
|
||||
{
|
||||
=======
|
||||
fn xml_post(&self, param_xml_array: Option<models::XmlArray>, context: &C) -> Box<dyn Future<Item=XmlPostResponse, Error=ApiError>> {
|
||||
>>>>>>> origin/master
|
||||
let mut uri = format!(
|
||||
"{}/xml",
|
||||
self.base_path
|
||||
@@ -2064,7 +2092,7 @@ impl<C, F> Api<C> for Client<F> where
|
||||
Err(e) => return Box::new(future::err(ApiError(format!("Unable to create request: {}", e))))
|
||||
};
|
||||
|
||||
let body = param_string.map(|ref body| {
|
||||
let body = param_xml_array.map(|ref body| {
|
||||
body.to_xml()
|
||||
});
|
||||
if let Some(body) = body {
|
||||
|
||||
@@ -223,6 +223,7 @@ pub enum XmlExtraPostResponse {
|
||||
pub enum XmlOtherPostResponse {
|
||||
/// OK
|
||||
OK
|
||||
(models::AnotherXmlObject)
|
||||
,
|
||||
/// Bad Request
|
||||
BadRequest
|
||||
@@ -292,6 +293,7 @@ pub trait Api<C> {
|
||||
context: &C) -> Box<dyn Future<Item=MergePatchJsonGetResponse, Error=ApiError> + Send>;
|
||||
|
||||
/// Get some stuff.
|
||||
<<<<<<< HEAD
|
||||
fn multiget_get(
|
||||
&self,
|
||||
context: &C) -> Box<dyn Future<Item=MultigetGetResponse, Error=ApiError> + Send>;
|
||||
@@ -363,6 +365,36 @@ pub trait Api<C> {
|
||||
&self,
|
||||
string: Option<models::XmlArray>,
|
||||
context: &C) -> Box<dyn Future<Item=XmlPostResponse, Error=ApiError> + Send>;
|
||||
=======
|
||||
fn multiget_get(&self, context: &C) -> Box<dyn Future<Item=MultigetGetResponse, Error=ApiError>>;
|
||||
|
||||
|
||||
fn multiple_auth_scheme_get(&self, context: &C) -> Box<dyn Future<Item=MultipleAuthSchemeGetResponse, Error=ApiError>>;
|
||||
|
||||
|
||||
fn readonly_auth_scheme_get(&self, context: &C) -> Box<dyn Future<Item=ReadonlyAuthSchemeGetResponse, Error=ApiError>>;
|
||||
|
||||
|
||||
fn required_octet_stream_put(&self, body: swagger::ByteArray, context: &C) -> Box<dyn Future<Item=RequiredOctetStreamPutResponse, Error=ApiError>>;
|
||||
|
||||
|
||||
fn responses_with_headers_get(&self, context: &C) -> Box<dyn Future<Item=ResponsesWithHeadersGetResponse, Error=ApiError>>;
|
||||
|
||||
|
||||
fn uuid_get(&self, context: &C) -> Box<dyn Future<Item=UuidGetResponse, Error=ApiError>>;
|
||||
|
||||
|
||||
fn xml_extra_post(&self, duplicate_xml_object: Option<models::DuplicateXmlObject>, context: &C) -> Box<dyn Future<Item=XmlExtraPostResponse, Error=ApiError>>;
|
||||
|
||||
|
||||
fn xml_other_post(&self, another_xml_object: Option<models::AnotherXmlObject>, context: &C) -> Box<dyn Future<Item=XmlOtherPostResponse, Error=ApiError>>;
|
||||
|
||||
|
||||
fn xml_other_put(&self, another_xml_array: Option<models::AnotherXmlArray>, context: &C) -> Box<dyn Future<Item=XmlOtherPutResponse, Error=ApiError>>;
|
||||
|
||||
/// Post an array
|
||||
fn xml_post(&self, xml_array: Option<models::XmlArray>, context: &C) -> Box<dyn Future<Item=XmlPostResponse, Error=ApiError>>;
|
||||
>>>>>>> origin/master
|
||||
|
||||
fn xml_put(
|
||||
&self,
|
||||
@@ -403,6 +435,7 @@ pub trait ApiNoContext {
|
||||
) -> Box<dyn Future<Item=MergePatchJsonGetResponse, Error=ApiError> + Send>;
|
||||
|
||||
/// Get some stuff.
|
||||
<<<<<<< HEAD
|
||||
fn multiget_get(
|
||||
&self,
|
||||
) -> Box<dyn Future<Item=MultigetGetResponse, Error=ApiError> + Send>;
|
||||
@@ -474,6 +507,36 @@ pub trait ApiNoContext {
|
||||
&self,
|
||||
string: Option<models::XmlArray>,
|
||||
) -> Box<dyn Future<Item=XmlPostResponse, Error=ApiError> + Send>;
|
||||
=======
|
||||
fn multiget_get(&self) -> Box<dyn Future<Item=MultigetGetResponse, Error=ApiError>>;
|
||||
|
||||
|
||||
fn multiple_auth_scheme_get(&self) -> Box<dyn Future<Item=MultipleAuthSchemeGetResponse, Error=ApiError>>;
|
||||
|
||||
|
||||
fn readonly_auth_scheme_get(&self) -> Box<dyn Future<Item=ReadonlyAuthSchemeGetResponse, Error=ApiError>>;
|
||||
|
||||
|
||||
fn required_octet_stream_put(&self, body: swagger::ByteArray) -> Box<dyn Future<Item=RequiredOctetStreamPutResponse, Error=ApiError>>;
|
||||
|
||||
|
||||
fn responses_with_headers_get(&self) -> Box<dyn Future<Item=ResponsesWithHeadersGetResponse, Error=ApiError>>;
|
||||
|
||||
|
||||
fn uuid_get(&self) -> Box<dyn Future<Item=UuidGetResponse, Error=ApiError>>;
|
||||
|
||||
|
||||
fn xml_extra_post(&self, duplicate_xml_object: Option<models::DuplicateXmlObject>) -> Box<dyn Future<Item=XmlExtraPostResponse, Error=ApiError>>;
|
||||
|
||||
|
||||
fn xml_other_post(&self, another_xml_object: Option<models::AnotherXmlObject>) -> Box<dyn Future<Item=XmlOtherPostResponse, Error=ApiError>>;
|
||||
|
||||
|
||||
fn xml_other_put(&self, another_xml_array: Option<models::AnotherXmlArray>) -> Box<dyn Future<Item=XmlOtherPutResponse, Error=ApiError>>;
|
||||
|
||||
/// Post an array
|
||||
fn xml_post(&self, xml_array: Option<models::XmlArray>) -> Box<dyn Future<Item=XmlPostResponse, Error=ApiError>>;
|
||||
>>>>>>> origin/master
|
||||
|
||||
fn xml_put(
|
||||
&self,
|
||||
@@ -640,6 +703,7 @@ impl<'a, T: Api<C>, C> ApiNoContext for ContextWrapper<'a, T, C> {
|
||||
self.api().xml_other_post(another_xml_object, &self.context())
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
fn xml_other_put(
|
||||
&self,
|
||||
string: Option<models::AnotherXmlArray>,
|
||||
@@ -655,6 +719,16 @@ impl<'a, T: Api<C>, C> ApiNoContext for ContextWrapper<'a, T, C> {
|
||||
) -> Box<dyn Future<Item=XmlPostResponse, Error=ApiError> + Send>
|
||||
{
|
||||
self.api().xml_post(string, &self.context())
|
||||
=======
|
||||
|
||||
fn xml_other_put(&self, another_xml_array: Option<models::AnotherXmlArray>) -> Box<dyn Future<Item=XmlOtherPutResponse, Error=ApiError>> {
|
||||
self.api().xml_other_put(another_xml_array, &self.context())
|
||||
}
|
||||
|
||||
/// Post an array
|
||||
fn xml_post(&self, xml_array: Option<models::XmlArray>) -> Box<dyn Future<Item=XmlPostResponse, Error=ApiError>> {
|
||||
self.api().xml_post(xml_array, &self.context())
|
||||
>>>>>>> origin/master
|
||||
}
|
||||
|
||||
fn xml_put(
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/// mime types for requests and responses
|
||||
|
||||
pub mod responses {
|
||||
use hyper::mime::*;
|
||||
|
||||
// The macro is called per-operation to beat the recursion limit
|
||||
|
||||
lazy_static! {
|
||||
/// Create Mime objects for the response content types for MultigetGet
|
||||
pub static ref MULTIGET_GET_JSON_RSP: Mime = "application/json".parse().unwrap();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Create Mime objects for the response content types for MultigetGet
|
||||
pub static ref MULTIGET_GET_XML_RSP: Mime = "application/xml".parse().unwrap();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Create Mime objects for the response content types for MultigetGet
|
||||
pub static ref MULTIGET_GET_OCTET_RSP: Mime = "application/octet-stream".parse().unwrap();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Create Mime objects for the response content types for MultigetGet
|
||||
pub static ref MULTIGET_GET_STRING_RSP: Mime = "text/plain".parse().unwrap();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Create Mime objects for the response content types for MultigetGet
|
||||
pub static ref MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT: Mime = "application/json".parse().unwrap();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Create Mime objects for the response content types for MultigetGet
|
||||
pub static ref MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT_2: Mime = "application/json".parse().unwrap();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Create Mime objects for the response content types for MultigetGet
|
||||
pub static ref MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT_3: Mime = "application/json".parse().unwrap();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Create Mime objects for the response content types for ResponsesWithHeadersGet
|
||||
pub static ref RESPONSES_WITH_HEADERS_GET_SUCCESS: Mime = "application/json".parse().unwrap();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Create Mime objects for the response content types for UuidGet
|
||||
pub static ref UUID_GET_DUPLICATE_RESPONSE_LONG_TEXT: Mime = "application/json".parse().unwrap();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Create Mime objects for the response content types for XmlOtherPost
|
||||
pub static ref XML_OTHER_POST_OK: Mime = "text/xml".parse().unwrap();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pub mod requests {
|
||||
use hyper::mime::*;
|
||||
|
||||
lazy_static! {
|
||||
/// Create Mime objects for the request content types for RequiredOctetStreamPut
|
||||
pub static ref REQUIRED_OCTET_STREAM_PUT: Mime = "application/octet-stream".parse().unwrap();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Create Mime objects for the request content types for XmlExtraPost
|
||||
pub static ref XML_EXTRA_POST: Mime = "application/xml".parse().unwrap();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Create Mime objects for the request content types for XmlOtherPost
|
||||
pub static ref XML_OTHER_POST: Mime = "text/xml".parse().unwrap();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Create Mime objects for the request content types for XmlOtherPut
|
||||
pub static ref XML_OTHER_PUT: Mime = "application/xml".parse().unwrap();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Create Mime objects for the request content types for XmlPost
|
||||
pub static ref XML_POST: Mime = "application/xml".parse().unwrap();
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Create Mime objects for the request content types for XmlPut
|
||||
pub static ref XML_PUT: Mime = "application/xml".parse().unwrap();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1261,8 +1261,25 @@ where
|
||||
match result {
|
||||
Ok(rsp) => match rsp {
|
||||
XmlOtherPostResponse::OK
|
||||
<<<<<<< HEAD
|
||||
=> {
|
||||
*response.status_mut() = StatusCode::from_u16(201).expect("Unable to turn 201 into a StatusCode");
|
||||
=======
|
||||
|
||||
(body)
|
||||
|
||||
|
||||
=> {
|
||||
response.set_status(StatusCode::try_from(201).unwrap());
|
||||
|
||||
response.headers_mut().set(ContentType(mimetypes::responses::XML_OTHER_POST_OK.clone()));
|
||||
|
||||
let mut namespaces = BTreeMap::new();
|
||||
// An empty string is used to indicate a global namespace in xmltree.
|
||||
namespaces.insert("".to_string(), models::AnotherXmlObject::NAMESPACE.to_string());
|
||||
let body = serde_xml_rs::to_string_with_namespaces(&body, namespaces).expect("impossible to fail to serialize");
|
||||
response.set_body(body);
|
||||
>>>>>>> origin/master
|
||||
},
|
||||
XmlOtherPostResponse::BadRequest
|
||||
=> {
|
||||
@@ -1300,18 +1317,19 @@ where
|
||||
match result {
|
||||
Ok(body) => {
|
||||
let mut unused_elements = Vec::new();
|
||||
let param_string: Option<models::AnotherXmlArray> = if !body.is_empty() {
|
||||
let param_another_xml_array: Option<models::AnotherXmlArray> = if !body.is_empty() {
|
||||
let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body);
|
||||
match serde_ignored::deserialize(deserializer, |path| {
|
||||
warn!("Ignoring unknown field in body: {}", path);
|
||||
unused_elements.push(path.to_string());
|
||||
}) {
|
||||
Ok(param_string) => param_string,
|
||||
Ok(param_another_xml_array) => param_another_xml_array,
|
||||
Err(_) => None,
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
<<<<<<< HEAD
|
||||
|
||||
Box::new(
|
||||
api_impl.xml_other_put(
|
||||
@@ -1323,6 +1341,12 @@ where
|
||||
HeaderName::from_static("x-span-id"),
|
||||
HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().to_string().as_str())
|
||||
.expect("Unable to create X-Span-ID header value"));
|
||||
=======
|
||||
Box::new(api_impl.xml_other_put(param_another_xml_array, &context)
|
||||
.then(move |result| {
|
||||
let mut response = Response::new();
|
||||
response.headers_mut().set(XSpanId((&context as &dyn Has<XSpanIdString>).get().0.to_string()));
|
||||
>>>>>>> origin/master
|
||||
|
||||
if !unused_elements.is_empty() {
|
||||
response.headers_mut().insert(
|
||||
@@ -1354,10 +1378,14 @@ where
|
||||
}
|
||||
))
|
||||
},
|
||||
<<<<<<< HEAD
|
||||
Err(e) => Box::new(future::ok(Response::builder()
|
||||
.status(StatusCode::BAD_REQUEST)
|
||||
.body(Body::from(format!("Couldn't read body parameter string: {}", e)))
|
||||
.expect("Unable to create Bad Request response due to unable to read body parameter string"))),
|
||||
=======
|
||||
Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter AnotherXmlArray: {}", e)))),
|
||||
>>>>>>> origin/master
|
||||
}
|
||||
})
|
||||
) as Self::Future
|
||||
@@ -1373,18 +1401,19 @@ where
|
||||
match result {
|
||||
Ok(body) => {
|
||||
let mut unused_elements = Vec::new();
|
||||
let param_string: Option<models::XmlArray> = if !body.is_empty() {
|
||||
let param_xml_array: Option<models::XmlArray> = if !body.is_empty() {
|
||||
let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body);
|
||||
match serde_ignored::deserialize(deserializer, |path| {
|
||||
warn!("Ignoring unknown field in body: {}", path);
|
||||
unused_elements.push(path.to_string());
|
||||
}) {
|
||||
Ok(param_string) => param_string,
|
||||
Ok(param_xml_array) => param_xml_array,
|
||||
Err(_) => None,
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
<<<<<<< HEAD
|
||||
|
||||
Box::new(
|
||||
api_impl.xml_post(
|
||||
@@ -1396,6 +1425,12 @@ where
|
||||
HeaderName::from_static("x-span-id"),
|
||||
HeaderValue::from_str((&context as &dyn Has<XSpanIdString>).get().0.clone().to_string().as_str())
|
||||
.expect("Unable to create X-Span-ID header value"));
|
||||
=======
|
||||
Box::new(api_impl.xml_post(param_xml_array, &context)
|
||||
.then(move |result| {
|
||||
let mut response = Response::new();
|
||||
response.headers_mut().set(XSpanId((&context as &dyn Has<XSpanIdString>).get().0.to_string()));
|
||||
>>>>>>> origin/master
|
||||
|
||||
if !unused_elements.is_empty() {
|
||||
response.headers_mut().insert(
|
||||
@@ -1427,10 +1462,14 @@ where
|
||||
}
|
||||
))
|
||||
},
|
||||
<<<<<<< HEAD
|
||||
Err(e) => Box::new(future::ok(Response::builder()
|
||||
.status(StatusCode::BAD_REQUEST)
|
||||
.body(Body::from(format!("Couldn't read body parameter string: {}", e)))
|
||||
.expect("Unable to create Bad Request response due to unable to read body parameter string"))),
|
||||
=======
|
||||
Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter XmlArray: {}", e)))),
|
||||
>>>>>>> origin/master
|
||||
}
|
||||
})
|
||||
) as Self::Future
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
5.0.0-SNAPSHOT
|
||||
<<<<<<< HEAD
|
||||
5.0.0-SNAPSHOT
|
||||
=======
|
||||
4.3.1-SNAPSHOT
|
||||
>>>>>>> origin/master
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
5.0.0-SNAPSHOT
|
||||
<<<<<<< HEAD
|
||||
5.0.0-SNAPSHOT
|
||||
=======
|
||||
4.3.1-SNAPSHOT
|
||||
>>>>>>> origin/master
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
5.0.0-SNAPSHOT
|
||||
<<<<<<< HEAD
|
||||
5.0.0-SNAPSHOT
|
||||
=======
|
||||
4.3.1-SNAPSHOT
|
||||
>>>>>>> origin/master
|
||||
|
||||
Reference in New Issue
Block a user