[Rust Server] Support parameters correctly in response headers (#3669)

[Rust Server] Compile responses with headers

* Add test for response with headers

* Update samples
This commit is contained in:
Richard Whitehouse 2019-09-15 15:54:38 +01:00 committed by GitHub
parent 9647416032
commit 4538db92a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 488 additions and 112 deletions

View File

@ -514,7 +514,16 @@ impl<F, C> Api<C> for Client<F> where
})
{{/dataType}}{{^dataType}}
future::ok(
{{{operationId}}}Response::{{#vendorExtensions}}{{x-responseId}}{{/vendorExtensions}}{{#headers}}{{#-first}}{ {{/-first}}{{^-first}}, {{/-first}}{{{name}}}: response_{{{name}}}{{#-last}} }{{/-last}}{{/headers}}
{{{operationId}}}Response::{{#vendorExtensions}}{{x-responseId}}{{/vendorExtensions}}
{{#headers}}
{{#-first}}
{
{{/-first}}
{{{name}}}: response_{{{name}}},
{{#-last}}
}
{{/-last}}
{{/headers}}
)
{{/dataType}}
) as Box<Future<Item=_, Error=_>>

View File

@ -56,9 +56,35 @@ pub const API_VERSION: &'static str = "{{{appVersion}}}";
#[derive(Debug, PartialEq)]
pub enum {{{operationId}}}Response {
{{#responses}}
{{#message}} /// {{{message}}}{{/message}}
{{#vendorExtensions}}{{{x-responseId}}}{{/vendorExtensions}} {{#dataType}}{{^hasHeaders}}( {{{dataType}}} ) {{/hasHeaders}}{{#hasHeaders}}{{#-first}}{ body: {{{dataType}}}{{/-first}}{{/hasHeaders}}{{/dataType}}{{#dataType}}{{#hasHeaders}}, {{/hasHeaders}}{{/dataType}}{{^dataType}}{{#hasHeaders}} { {{/hasHeaders}}{{/dataType}}{{#headers}}{{^-first}}, {{/-first}}{{{name}}}: {{{datatype}}}{{#-last}} } {{/-last}}{{/headers}},
{{/responses}}
{{#message}}
/// {{{message}}}{{/message}}
{{#vendorExtensions}}
{{{x-responseId}}}
{{/vendorExtensions}}
{{^dataType}}
{{#hasHeaders}}
{
{{/hasHeaders}}
{{/dataType}}
{{#dataType}}
{{^hasHeaders}}
({{{dataType}}})
{{/hasHeaders}}
{{#hasHeaders}}
{
body: {{{dataType}}},
{{/hasHeaders}}
{{/dataType}}
{{#headers}}
{{{name}}}: {{{datatype}}},
{{#-last}}
}
{{/-last}}
{{/headers}}
{{^-last}}
,
{{/-last}}
{{/responses}}
}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}

View File

@ -101,6 +101,28 @@ paths:
responses:
'200':
description: 'OK'
/responses_with_headers:
get:
responses:
'200':
description: 'Success'
content:
'application/json':
schema:
type: String
headers:
Success-Info:
schema:
type: String
'412':
description: Precondition Failed
headers:
Further-Info:
schema:
type: String
Failure-Info:
schema:
type: String
components:
schemas:
UuidObject:

View File

@ -53,7 +53,7 @@ pub const API_VERSION: &'static str = "1.0.7";
#[derive(Debug, PartialEq)]
pub enum MultipartRequestPostResponse {
/// OK
OK ,
OK
}

View File

@ -62,6 +62,7 @@ To run a client, follow one of the following simple steps:
```
cargo run --example client RequiredOctetStreamPut
cargo run --example client ResponsesWithHeadersGet
cargo run --example client UuidGet
cargo run --example client XmlExtraPost
cargo run --example client XmlOtherPost
@ -102,6 +103,7 @@ All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
[****](docs/default_api.md#) | **PUT** /required_octet_stream |
[****](docs/default_api.md#) | **GET** /responses_with_headers |
[****](docs/default_api.md#) | **GET** /uuid |
[****](docs/default_api.md#) | **POST** /xml_extra |
[****](docs/default_api.md#) | **POST** /xml_other |

View File

@ -86,6 +86,34 @@ paths:
responses:
200:
description: OK
/responses_with_headers:
get:
responses:
200:
content:
application/json:
schema:
type: String
description: Success
headers:
Success-Info:
explode: false
schema:
type: String
style: simple
412:
description: Precondition Failed
headers:
Further-Info:
explode: false
schema:
type: String
style: simple
Failure-Info:
explode: false
schema:
type: String
style: simple
components:
schemas:
UuidObject:

View File

@ -5,6 +5,7 @@ All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
****](default_api.md#) | **PUT** /required_octet_stream |
****](default_api.md#) | **GET** /responses_with_headers |
****](default_api.md#) | **GET** /uuid |
****](default_api.md#) | **POST** /xml_extra |
****](default_api.md#) | **POST** /xml_other |
@ -38,6 +39,28 @@ 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)
# ****
> String ()
### Required Parameters
This endpoint does not need any parameter.
### Return type
**String**
### 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)
# ****
> uuid::Uuid ()

View File

@ -20,6 +20,7 @@ use tokio_core::reactor;
use openapi_v3::{ApiNoContext, ContextWrapperExt,
ApiError,
RequiredOctetStreamPutResponse,
ResponsesWithHeadersGetResponse,
UuidGetResponse,
XmlExtraPostResponse,
XmlOtherPostResponse,
@ -35,6 +36,7 @@ fn main() {
.help("Sets the operation to run")
.possible_values(&[
"RequiredOctetStreamPut",
"ResponsesWithHeadersGet",
"UuidGet",
"XmlExtraPost",
"XmlOtherPost",
@ -86,6 +88,11 @@ fn main() {
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("ResponsesWithHeadersGet") => {
let result = core.run(client.responses_with_headers_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());
},
Some("UuidGet") => {
let result = core.run(client.uuid_get());
println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has<XSpanIdString>).get().clone());

View File

@ -12,6 +12,7 @@ use uuid;
use openapi_v3::{Api, ApiError,
RequiredOctetStreamPutResponse,
ResponsesWithHeadersGetResponse,
UuidGetResponse,
XmlExtraPostResponse,
XmlOtherPostResponse,
@ -42,6 +43,13 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString>{
}
fn responses_with_headers_get(&self, context: &C) -> Box<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<Future<Item=UuidGetResponse, Error=ApiError>> {
let context = context.clone();
println!("uuid_get() - X-Span-ID: {:?}", context.get().0.clone());

View File

@ -38,6 +38,7 @@ use swagger::{ApiError, XSpanId, XSpanIdString, Has, AuthData};
use {Api,
RequiredOctetStreamPutResponse,
ResponsesWithHeadersGetResponse,
UuidGetResponse,
XmlExtraPostResponse,
XmlOtherPostResponse,
@ -315,6 +316,108 @@ impl<F, C> Api<C> for Client<F> where
}
fn responses_with_headers_get(&self, context: &C) -> Box<Future<Item=ResponsesWithHeadersGetResponse, Error=ApiError>> {
let mut uri = format!(
"{}/responses_with_headers",
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))))),
};
let mut request = hyper::Request::new(hyper::Method::Get, uri);
request.headers_mut().set(XSpanId((context as &Has<XSpanIdString>).get().0.clone()));
Box::new(self.client_service.call(request)
.map_err(|e| ApiError(format!("No response received: {}", e)))
.and_then(|mut response| {
match response.status().as_u16() {
200 => {
header! { (ResponseSuccessInfo, "Success-Info") => [String] }
let response_success_info = match response.headers().get::<ResponseSuccessInfo>() {
Some(response_success_info) => response_success_info.0.clone(),
None => return Box::new(future::err(ApiError(String::from("Required response header Success-Info for response 200 was not found.")))) as Box<Future<Item=_, Error=_>>,
};
let body = response.body();
Box::new(
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|
serde_json::from_str::<String>(body)
.map_err(|e| e.into())
)
)
.map(move |body| {
ResponsesWithHeadersGetResponse::Success{ body: body, success_info: response_success_info }
})
) as Box<Future<Item=_, Error=_>>
},
412 => {
header! { (ResponseFurtherInfo, "Further-Info") => [String] }
let response_further_info = match response.headers().get::<ResponseFurtherInfo>() {
Some(response_further_info) => response_further_info.0.clone(),
None => return Box::new(future::err(ApiError(String::from("Required response header Further-Info for response 412 was not found.")))) as Box<Future<Item=_, Error=_>>,
};
header! { (ResponseFailureInfo, "Failure-Info") => [String] }
let response_failure_info = match response.headers().get::<ResponseFailureInfo>() {
Some(response_failure_info) => response_failure_info.0.clone(),
None => return Box::new(future::err(ApiError(String::from("Required response header Failure-Info for response 412 was not found.")))) as Box<Future<Item=_, Error=_>>,
};
let body = response.body();
Box::new(
future::ok(
ResponsesWithHeadersGetResponse::PreconditionFailed
{
further_info: response_further_info,
failure_info: response_failure_info,
}
)
) as Box<Future<Item=_, Error=_>>
},
code => {
let headers = response.headers().clone();
Box::new(response.body()
.take(100)
.concat2()
.then(move |body|
future::err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}",
code,
headers,
match body {
Ok(ref body) => match str::from_utf8(body) {
Ok(body) => Cow::from(body),
Err(e) => Cow::from(format!("<Body was not UTF8: {:?}>", e)),
},
Err(e) => Cow::from(format!("<Failed to read body: {}>", e)),
})))
)
) as Box<Future<Item=_, Error=_>>
}
}
}))
}
fn uuid_get(&self, context: &C) -> Box<Future<Item=UuidGetResponse, Error=ApiError>> {
let mut uri = format!(
"{}/uuid",

View File

@ -54,53 +54,76 @@ pub const API_VERSION: &'static str = "1.0.7";
#[derive(Debug, PartialEq)]
pub enum RequiredOctetStreamPutResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum ResponsesWithHeadersGetResponse {
/// Success
Success
{
body: String,
success_info: String,
}
,
/// Precondition Failed
PreconditionFailed
{
further_info: String,
failure_info: String,
}
}
#[derive(Debug, PartialEq)]
pub enum UuidGetResponse {
/// Duplicate Response long text. One.
DuplicateResponseLongText ( uuid::Uuid ) ,
DuplicateResponseLongText
(uuid::Uuid)
}
#[derive(Debug, PartialEq)]
pub enum XmlExtraPostResponse {
/// OK
OK ,
OK
,
/// Bad Request
BadRequest ,
BadRequest
}
#[derive(Debug, PartialEq)]
pub enum XmlOtherPostResponse {
/// OK
OK ,
OK
,
/// Bad Request
BadRequest ,
BadRequest
}
#[derive(Debug, PartialEq)]
pub enum XmlOtherPutResponse {
/// OK
OK ,
OK
,
/// Bad Request
BadRequest ,
BadRequest
}
#[derive(Debug, PartialEq)]
pub enum XmlPostResponse {
/// OK
OK ,
OK
,
/// Bad Request
BadRequest ,
BadRequest
}
#[derive(Debug, PartialEq)]
pub enum XmlPutResponse {
/// OK
OK ,
OK
,
/// Bad Request
BadRequest ,
BadRequest
}
@ -111,6 +134,9 @@ pub trait Api<C> {
fn required_octet_stream_put(&self, body: swagger::ByteArray, context: &C) -> Box<Future<Item=RequiredOctetStreamPutResponse, Error=ApiError>>;
fn responses_with_headers_get(&self, context: &C) -> Box<Future<Item=ResponsesWithHeadersGetResponse, Error=ApiError>>;
fn uuid_get(&self, context: &C) -> Box<Future<Item=UuidGetResponse, Error=ApiError>>;
@ -137,6 +163,9 @@ pub trait ApiNoContext {
fn required_octet_stream_put(&self, body: swagger::ByteArray) -> Box<Future<Item=RequiredOctetStreamPutResponse, Error=ApiError>>;
fn responses_with_headers_get(&self) -> Box<Future<Item=ResponsesWithHeadersGetResponse, Error=ApiError>>;
fn uuid_get(&self) -> Box<Future<Item=UuidGetResponse, Error=ApiError>>;
@ -176,6 +205,11 @@ impl<'a, T: Api<C>, C> ApiNoContext for ContextWrapper<'a, T, C> {
}
fn responses_with_headers_get(&self) -> Box<Future<Item=ResponsesWithHeadersGetResponse, Error=ApiError>> {
self.api().responses_with_headers_get(&self.context())
}
fn uuid_get(&self) -> Box<Future<Item=UuidGetResponse, Error=ApiError>> {
self.api().uuid_get(&self.context())
}

View File

@ -5,6 +5,11 @@ pub mod responses {
// The macro is called per-operation to beat the recursion limit
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();

View File

@ -36,6 +36,7 @@ use swagger::auth::Scopes;
use {Api,
RequiredOctetStreamPutResponse,
ResponsesWithHeadersGetResponse,
UuidGetResponse,
XmlExtraPostResponse,
XmlOtherPostResponse,
@ -56,6 +57,7 @@ mod paths {
lazy_static! {
pub static ref GLOBAL_REGEX_SET: regex::RegexSet = regex::RegexSet::new(vec![
r"^/required_octet_stream$",
r"^/responses_with_headers$",
r"^/uuid$",
r"^/xml$",
r"^/xml_extra$",
@ -63,10 +65,11 @@ mod paths {
]).unwrap();
}
pub static ID_REQUIRED_OCTET_STREAM: usize = 0;
pub static ID_UUID: usize = 1;
pub static ID_XML: usize = 2;
pub static ID_XML_EXTRA: usize = 3;
pub static ID_XML_OTHER: usize = 4;
pub static ID_RESPONSES_WITH_HEADERS: usize = 1;
pub static ID_UUID: usize = 2;
pub static ID_XML: usize = 3;
pub static ID_XML_EXTRA: usize = 4;
pub static ID_XML_OTHER: usize = 5;
}
pub struct NewService<T, C> {
@ -183,6 +186,69 @@ where
) as Box<Future<Item=Response, Error=Error>>
},
// ResponsesWithHeadersGet - GET /responses_with_headers
&hyper::Method::Get if path.matched(paths::ID_RESPONSES_WITH_HEADERS) => {
Box::new({
{{
Box::new(api_impl.responses_with_headers_get(&context)
.then(move |result| {
let mut response = Response::new();
response.headers_mut().set(XSpanId((&context as &Has<XSpanIdString>).get().0.to_string()));
match result {
Ok(rsp) => match rsp {
ResponsesWithHeadersGetResponse::Success
{
body,
success_info
}
=> {
response.set_status(StatusCode::try_from(200).unwrap());
header! { (ResponseSuccessInfo, "Success-Info") => [String] }
response.headers_mut().set(ResponseSuccessInfo(success_info));
response.headers_mut().set(ContentType(mimetypes::responses::RESPONSES_WITH_HEADERS_GET_SUCCESS.clone()));
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
response.set_body(body);
},
ResponsesWithHeadersGetResponse::PreconditionFailed
{
further_info,
failure_info
}
=> {
response.set_status(StatusCode::try_from(412).unwrap());
header! { (ResponseFurtherInfo, "Further-Info") => [String] }
response.headers_mut().set(ResponseFurtherInfo(further_info));
header! { (ResponseFailureInfo, "Failure-Info") => [String] }
response.headers_mut().set(ResponseFailureInfo(failure_info));
},
},
Err(_) => {
// Application code returned an error. This should not happen, as the implementation should
// return a valid response.
response.set_status(StatusCode::InternalServerError);
response.set_body("An internal error occurred");
},
}
future::ok(response)
}
))
}}
}) as Box<Future<Item=Response, Error=Error>>
},
// UuidGet - GET /uuid
&hyper::Method::Get if path.matched(paths::ID_UUID) => {
Box::new({
@ -581,6 +647,9 @@ impl RequestParser for ApiRequestParser {
// RequiredOctetStreamPut - PUT /required_octet_stream
&hyper::Method::Put if path.matched(paths::ID_REQUIRED_OCTET_STREAM) => Ok("RequiredOctetStreamPut"),
// ResponsesWithHeadersGet - GET /responses_with_headers
&hyper::Method::Get if path.matched(paths::ID_RESPONSES_WITH_HEADERS) => Ok("ResponsesWithHeadersGet"),
// UuidGet - GET /uuid
&hyper::Method::Get if path.matched(paths::ID_UUID) => Ok("UuidGet"),

View File

@ -53,223 +53,223 @@ pub const API_VERSION: &'static str = "0.0.1";
#[derive(Debug, PartialEq)]
pub enum Op10GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op11GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op12GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op13GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op14GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op15GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op16GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op17GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op18GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op19GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op1GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op20GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op21GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op22GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op23GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op24GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op25GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op26GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op27GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op28GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op29GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op2GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op30GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op31GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op32GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op33GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op34GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op35GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op36GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op37GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op3GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op4GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op5GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op6GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op7GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op8GetResponse {
/// OK
OK ,
OK
}
#[derive(Debug, PartialEq)]
pub enum Op9GetResponse {
/// OK
OK ,
OK
}

View File

@ -54,227 +54,264 @@ pub const API_VERSION: &'static str = "1.0.0";
#[derive(Debug, PartialEq)]
pub enum TestSpecialTagsResponse {
/// successful operation
SuccessfulOperation ( models::Client ) ,
SuccessfulOperation
(models::Client)
}
#[derive(Debug, PartialEq)]
pub enum FakeOuterBooleanSerializeResponse {
/// Output boolean
OutputBoolean ( bool ) ,
OutputBoolean
(bool)
}
#[derive(Debug, PartialEq)]
pub enum FakeOuterCompositeSerializeResponse {
/// Output composite
OutputComposite ( models::OuterComposite ) ,
OutputComposite
(models::OuterComposite)
}
#[derive(Debug, PartialEq)]
pub enum FakeOuterNumberSerializeResponse {
/// Output number
OutputNumber ( f64 ) ,
OutputNumber
(f64)
}
#[derive(Debug, PartialEq)]
pub enum FakeOuterStringSerializeResponse {
/// Output string
OutputString ( String ) ,
OutputString
(String)
}
#[derive(Debug, PartialEq)]
pub enum TestBodyWithQueryParamsResponse {
/// Success
Success ,
Success
}
#[derive(Debug, PartialEq)]
pub enum TestClientModelResponse {
/// successful operation
SuccessfulOperation ( models::Client ) ,
SuccessfulOperation
(models::Client)
}
#[derive(Debug, PartialEq)]
pub enum TestEndpointParametersResponse {
/// Invalid username supplied
InvalidUsernameSupplied ,
InvalidUsernameSupplied
,
/// User not found
UserNotFound ,
UserNotFound
}
#[derive(Debug, PartialEq)]
pub enum TestEnumParametersResponse {
/// Invalid request
InvalidRequest ,
InvalidRequest
,
/// Not found
NotFound ,
NotFound
}
#[derive(Debug, PartialEq)]
pub enum TestInlineAdditionalPropertiesResponse {
/// successful operation
SuccessfulOperation ,
SuccessfulOperation
}
#[derive(Debug, PartialEq)]
pub enum TestJsonFormDataResponse {
/// successful operation
SuccessfulOperation ,
SuccessfulOperation
}
#[derive(Debug, PartialEq)]
pub enum TestClassnameResponse {
/// successful operation
SuccessfulOperation ( models::Client ) ,
SuccessfulOperation
(models::Client)
}
#[derive(Debug, PartialEq)]
pub enum AddPetResponse {
/// Invalid input
InvalidInput ,
InvalidInput
}
#[derive(Debug, PartialEq)]
pub enum DeletePetResponse {
/// Invalid pet value
InvalidPetValue ,
InvalidPetValue
}
#[derive(Debug, PartialEq)]
pub enum FindPetsByStatusResponse {
/// successful operation
SuccessfulOperation ( Vec<models::Pet> ) ,
SuccessfulOperation
(Vec<models::Pet>)
,
/// Invalid status value
InvalidStatusValue ,
InvalidStatusValue
}
#[derive(Debug, PartialEq)]
pub enum FindPetsByTagsResponse {
/// successful operation
SuccessfulOperation ( Vec<models::Pet> ) ,
SuccessfulOperation
(Vec<models::Pet>)
,
/// Invalid tag value
InvalidTagValue ,
InvalidTagValue
}
#[derive(Debug, PartialEq)]
pub enum GetPetByIdResponse {
/// successful operation
SuccessfulOperation ( models::Pet ) ,
SuccessfulOperation
(models::Pet)
,
/// Invalid ID supplied
InvalidIDSupplied ,
InvalidIDSupplied
,
/// Pet not found
PetNotFound ,
PetNotFound
}
#[derive(Debug, PartialEq)]
pub enum UpdatePetResponse {
/// Invalid ID supplied
InvalidIDSupplied ,
InvalidIDSupplied
,
/// Pet not found
PetNotFound ,
PetNotFound
,
/// Validation exception
ValidationException ,
ValidationException
}
#[derive(Debug, PartialEq)]
pub enum UpdatePetWithFormResponse {
/// Invalid input
InvalidInput ,
InvalidInput
}
#[derive(Debug, PartialEq)]
pub enum UploadFileResponse {
/// successful operation
SuccessfulOperation ( models::ApiResponse ) ,
SuccessfulOperation
(models::ApiResponse)
}
#[derive(Debug, PartialEq)]
pub enum DeleteOrderResponse {
/// Invalid ID supplied
InvalidIDSupplied ,
InvalidIDSupplied
,
/// Order not found
OrderNotFound ,
OrderNotFound
}
#[derive(Debug, PartialEq)]
pub enum GetInventoryResponse {
/// successful operation
SuccessfulOperation ( HashMap<String, i32> ) ,
SuccessfulOperation
(HashMap<String, i32>)
}
#[derive(Debug, PartialEq)]
pub enum GetOrderByIdResponse {
/// successful operation
SuccessfulOperation ( models::Order ) ,
SuccessfulOperation
(models::Order)
,
/// Invalid ID supplied
InvalidIDSupplied ,
InvalidIDSupplied
,
/// Order not found
OrderNotFound ,
OrderNotFound
}
#[derive(Debug, PartialEq)]
pub enum PlaceOrderResponse {
/// successful operation
SuccessfulOperation ( models::Order ) ,
SuccessfulOperation
(models::Order)
,
/// Invalid Order
InvalidOrder ,
InvalidOrder
}
#[derive(Debug, PartialEq)]
pub enum CreateUserResponse {
/// successful operation
SuccessfulOperation ,
SuccessfulOperation
}
#[derive(Debug, PartialEq)]
pub enum CreateUsersWithArrayInputResponse {
/// successful operation
SuccessfulOperation ,
SuccessfulOperation
}
#[derive(Debug, PartialEq)]
pub enum CreateUsersWithListInputResponse {
/// successful operation
SuccessfulOperation ,
SuccessfulOperation
}
#[derive(Debug, PartialEq)]
pub enum DeleteUserResponse {
/// Invalid username supplied
InvalidUsernameSupplied ,
InvalidUsernameSupplied
,
/// User not found
UserNotFound ,
UserNotFound
}
#[derive(Debug, PartialEq)]
pub enum GetUserByNameResponse {
/// successful operation
SuccessfulOperation ( models::User ) ,
SuccessfulOperation
(models::User)
,
/// Invalid username supplied
InvalidUsernameSupplied ,
InvalidUsernameSupplied
,
/// User not found
UserNotFound ,
UserNotFound
}
#[derive(Debug, PartialEq)]
pub enum LoginUserResponse {
/// successful operation
SuccessfulOperation { body: String, x_rate_limit: i32, x_expires_after: chrono::DateTime<chrono::Utc> } ,
SuccessfulOperation
{
body: String,
x_rate_limit: i32,
x_expires_after: chrono::DateTime<chrono::Utc>,
}
,
/// Invalid username/password supplied
InvalidUsername ,
InvalidUsername
}
#[derive(Debug, PartialEq)]
pub enum LogoutUserResponse {
/// successful operation
SuccessfulOperation ,
SuccessfulOperation
}
#[derive(Debug, PartialEq)]
pub enum UpdateUserResponse {
/// Invalid user supplied
InvalidUserSupplied ,
InvalidUserSupplied
,
/// User not found
UserNotFound ,
UserNotFound
}

View File

@ -53,31 +53,34 @@ pub const API_VERSION: &'static str = "2.3.4";
#[derive(Debug, PartialEq)]
pub enum DummyGetResponse {
/// Success
Success ,
Success
}
#[derive(Debug, PartialEq)]
pub enum DummyPutResponse {
/// Success
Success ,
Success
}
#[derive(Debug, PartialEq)]
pub enum FileResponseGetResponse {
/// Success
Success ( swagger::ByteArray ) ,
Success
(swagger::ByteArray)
}
#[derive(Debug, PartialEq)]
pub enum HtmlPostResponse {
/// Success
Success ( String ) ,
Success
(String)
}
#[derive(Debug, PartialEq)]
pub enum RawJsonGetResponse {
/// Success
Success ( serde_json::Value ) ,
Success
(serde_json::Value)
}