forked from loafle/openapi-generator-original
Update samples
This commit is contained in:
@@ -1,5 +1 @@
|
||||
<<<<<<< HEAD
|
||||
5.0.0-SNAPSHOT
|
||||
=======
|
||||
4.3.1-SNAPSHOT
|
||||
>>>>>>> origin/master
|
||||
5.0.0-SNAPSHOT
|
||||
@@ -1,5 +1 @@
|
||||
<<<<<<< HEAD
|
||||
5.0.0-SNAPSHOT
|
||||
=======
|
||||
4.3.1-SNAPSHOT
|
||||
>>>>>>> origin/master
|
||||
5.0.0-SNAPSHOT
|
||||
@@ -81,6 +81,7 @@ cargo run --example client XmlOtherPost
|
||||
cargo run --example client XmlOtherPut
|
||||
cargo run --example client XmlPost
|
||||
cargo run --example client XmlPut
|
||||
cargo run --example client GetRepoInfo
|
||||
```
|
||||
|
||||
### HTTPS
|
||||
@@ -135,6 +136,7 @@ Method | HTTP request | Description
|
||||
[****](docs/default_api.md#) | **PUT** /xml_other |
|
||||
[****](docs/default_api.md#) | **POST** /xml | Post an array
|
||||
[****](docs/default_api.md#) | **PUT** /xml |
|
||||
[**GetRepoInfo**](docs/repo_api.md#GetRepoInfo) | **GET** /repos/{repoId} |
|
||||
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# repo_api
|
||||
|
||||
All URIs are relative to *http://localhost*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
**GetRepoInfo**](repo_api.md#GetRepoInfo) | **GET** /repos/{repoId} |
|
||||
|
||||
|
||||
# **GetRepoInfo**
|
||||
> String GetRepoInfo(repo_id)
|
||||
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**repo_id** | **String**| |
|
||||
|
||||
### Return type
|
||||
|
||||
[**String**](string.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json
|
||||
|
||||
[[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)
|
||||
|
||||
@@ -309,22 +309,22 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString>{
|
||||
|
||||
fn xml_other_put(
|
||||
&self,
|
||||
string: Option<models::AnotherXmlArray>,
|
||||
another_xml_array: Option<models::AnotherXmlArray>,
|
||||
context: &C) -> Box<dyn Future<Item=XmlOtherPutResponse, Error=ApiError> + Send>
|
||||
{
|
||||
let context = context.clone();
|
||||
info!("xml_other_put({:?}) - X-Span-ID: {:?}", string, context.get().0.clone());
|
||||
info!("xml_other_put({:?}) - X-Span-ID: {:?}", another_xml_array, context.get().0.clone());
|
||||
Box::new(future::err("Generic failure".into()))
|
||||
}
|
||||
|
||||
/// Post an array
|
||||
fn xml_post(
|
||||
&self,
|
||||
string: Option<models::XmlArray>,
|
||||
xml_array: Option<models::XmlArray>,
|
||||
context: &C) -> Box<dyn Future<Item=XmlPostResponse, Error=ApiError> + Send>
|
||||
{
|
||||
let context = context.clone();
|
||||
info!("xml_post({:?}) - X-Span-ID: {:?}", string, context.get().0.clone());
|
||||
info!("xml_post({:?}) - X-Span-ID: {:?}", xml_array, context.get().0.clone());
|
||||
Box::new(future::err("Generic failure".into()))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
//! 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()))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1887,7 +1887,7 @@ impl<C, F> Api<C> for Client<F> where
|
||||
*request.body_mut() = Body::from(body);
|
||||
}
|
||||
|
||||
let header = "application/xml";
|
||||
let header = "text/xml";
|
||||
request.headers_mut().insert(CONTENT_TYPE, match HeaderValue::from_str(header) {
|
||||
Ok(h) => h,
|
||||
Err(e) => return Box::new(future::err(ApiError(format!("Unable to create header: {} - {}", header, e))))
|
||||
@@ -1905,30 +1905,24 @@ 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)))
|
||||
)
|
||||
)
|
||||
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)
|
||||
XmlOtherPostResponse::OK
|
||||
(body)
|
||||
})
|
||||
) as Box<dyn Future<Item=_, Error=_>>
|
||||
>>>>>>> origin/master
|
||||
) as Box<dyn Future<Item=_, Error=_> + Send>
|
||||
},
|
||||
400 => {
|
||||
let body = response.into_body();
|
||||
@@ -1961,15 +1955,11 @@ impl<C, F> Api<C> for Client<F> where
|
||||
}))
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
fn xml_other_put(
|
||||
&self,
|
||||
param_string: Option<models::AnotherXmlArray>,
|
||||
param_another_xml_array: 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
|
||||
@@ -2057,15 +2047,11 @@ impl<C, F> Api<C> for Client<F> where
|
||||
}))
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
fn xml_post(
|
||||
&self,
|
||||
param_string: Option<models::XmlArray>,
|
||||
param_xml_array: 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
|
||||
|
||||
@@ -293,7 +293,6 @@ 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>;
|
||||
@@ -357,44 +356,14 @@ pub trait Api<C> {
|
||||
|
||||
fn xml_other_put(
|
||||
&self,
|
||||
string: Option<models::AnotherXmlArray>,
|
||||
another_xml_array: Option<models::AnotherXmlArray>,
|
||||
context: &C) -> Box<dyn Future<Item=XmlOtherPutResponse, Error=ApiError> + Send>;
|
||||
|
||||
/// Post an array
|
||||
fn xml_post(
|
||||
&self,
|
||||
string: Option<models::XmlArray>,
|
||||
xml_array: 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,
|
||||
@@ -435,7 +404,6 @@ 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>;
|
||||
@@ -499,44 +467,14 @@ pub trait ApiNoContext {
|
||||
|
||||
fn xml_other_put(
|
||||
&self,
|
||||
string: Option<models::AnotherXmlArray>,
|
||||
another_xml_array: Option<models::AnotherXmlArray>,
|
||||
) -> Box<dyn Future<Item=XmlOtherPutResponse, Error=ApiError> + Send>;
|
||||
|
||||
/// Post an array
|
||||
fn xml_post(
|
||||
&self,
|
||||
string: Option<models::XmlArray>,
|
||||
xml_array: 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,
|
||||
@@ -703,32 +641,21 @@ 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>,
|
||||
another_xml_array: Option<models::AnotherXmlArray>,
|
||||
) -> Box<dyn Future<Item=XmlOtherPutResponse, Error=ApiError> + Send>
|
||||
{
|
||||
self.api().xml_other_put(string, &self.context())
|
||||
self.api().xml_other_put(another_xml_array, &self.context())
|
||||
}
|
||||
|
||||
/// Post an array
|
||||
fn xml_post(
|
||||
&self,
|
||||
string: Option<models::XmlArray>,
|
||||
xml_array: Option<models::XmlArray>,
|
||||
) -> 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(
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
/// 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,25 +1261,19 @@ where
|
||||
match result {
|
||||
Ok(rsp) => match rsp {
|
||||
XmlOtherPostResponse::OK
|
||||
<<<<<<< HEAD
|
||||
(body)
|
||||
=> {
|
||||
*response.status_mut() = StatusCode::from_u16(201).expect("Unable to turn 201 into a StatusCode");
|
||||
=======
|
||||
response.headers_mut().insert(
|
||||
CONTENT_TYPE,
|
||||
HeaderValue::from_str("text/xml")
|
||||
.expect("Unable to create Content-Type header for XML_OTHER_POST_OK"));
|
||||
let mut namespaces = std::collections::BTreeMap::new();
|
||||
|
||||
(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
|
||||
*response.body_mut() = Body::from(body);
|
||||
},
|
||||
XmlOtherPostResponse::BadRequest
|
||||
=> {
|
||||
@@ -1329,11 +1323,10 @@ where
|
||||
} else {
|
||||
None
|
||||
};
|
||||
<<<<<<< HEAD
|
||||
|
||||
Box::new(
|
||||
api_impl.xml_other_put(
|
||||
param_string,
|
||||
param_another_xml_array,
|
||||
&context
|
||||
).then(move |result| {
|
||||
let mut response = Response::new(Body::empty());
|
||||
@@ -1341,12 +1334,6 @@ 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(
|
||||
@@ -1378,14 +1365,10 @@ 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
|
||||
.body(Body::from(format!("Couldn't read body parameter AnotherXmlArray: {}", e)))
|
||||
.expect("Unable to create Bad Request response due to unable to read body parameter AnotherXmlArray"))),
|
||||
}
|
||||
})
|
||||
) as Self::Future
|
||||
@@ -1413,11 +1396,10 @@ where
|
||||
} else {
|
||||
None
|
||||
};
|
||||
<<<<<<< HEAD
|
||||
|
||||
Box::new(
|
||||
api_impl.xml_post(
|
||||
param_string,
|
||||
param_xml_array,
|
||||
&context
|
||||
).then(move |result| {
|
||||
let mut response = Response::new(Body::empty());
|
||||
@@ -1425,12 +1407,6 @@ 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(
|
||||
@@ -1462,14 +1438,10 @@ 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
|
||||
.body(Body::from(format!("Couldn't read body parameter XmlArray: {}", e)))
|
||||
.expect("Unable to create Bad Request response due to unable to read body parameter XmlArray"))),
|
||||
}
|
||||
})
|
||||
) as Self::Future
|
||||
|
||||
@@ -1,5 +1 @@
|
||||
<<<<<<< HEAD
|
||||
5.0.0-SNAPSHOT
|
||||
=======
|
||||
4.3.1-SNAPSHOT
|
||||
>>>>>>> origin/master
|
||||
5.0.0-SNAPSHOT
|
||||
+1
-5
@@ -1,5 +1 @@
|
||||
<<<<<<< HEAD
|
||||
5.0.0-SNAPSHOT
|
||||
=======
|
||||
4.3.1-SNAPSHOT
|
||||
>>>>>>> origin/master
|
||||
5.0.0-SNAPSHOT
|
||||
+1
-5
@@ -1,5 +1 @@
|
||||
<<<<<<< HEAD
|
||||
5.0.0-SNAPSHOT
|
||||
=======
|
||||
4.3.1-SNAPSHOT
|
||||
>>>>>>> origin/master
|
||||
5.0.0-SNAPSHOT
|
||||
Reference in New Issue
Block a user