forked from loafle/openapi-generator-original
[Rust-Server] use status codes as the variants of the response enums instead of descriptions (#7125)
* use status codes in the variants of the responses instead of message * samples * add missing {{code}} * use human friendly idents if possible * generate samples * salvage an oversight
This commit is contained in:
parent
dc69138de5
commit
7d96f61e5d
@ -622,9 +622,18 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
param.vendorExtensions.put("typeName", toModelName(param.baseName));
|
||||
}
|
||||
for (CodegenResponse rsp : op.responses) {
|
||||
rsp.message = camelize(rsp.message.split("[^A-Za-z ]")[0].replace(" ", "_"));
|
||||
String[] words = rsp.message.split("[^A-Za-z ]");
|
||||
String responseId;
|
||||
if (rsp.vendorExtensions.containsKey("x-responseId")) {
|
||||
responseId = (String)rsp.vendorExtensions.get("x-responseId");
|
||||
} else if (words.length != 0) {
|
||||
responseId = camelize(words[0].replace(" ", "_"));
|
||||
} else {
|
||||
responseId = "Status" + rsp.code;
|
||||
}
|
||||
rsp.vendorExtensions.put("x-responseId", responseId);
|
||||
rsp.vendorExtensions.put("x-uppercaseResponseId", underscore(responseId).toUpperCase());
|
||||
rsp.vendorExtensions.put("uppercase_operation_id", underscore(op.operationId).toUpperCase());
|
||||
rsp.vendorExtensions.put("uppercase_message", underscore(rsp.message).toUpperCase());
|
||||
if (rsp.dataType != null) {
|
||||
rsp.vendorExtensions.put("uppercase_data_type", (rsp.dataType.replace("models::", "")).toUpperCase());
|
||||
|
||||
|
@ -269,8 +269,8 @@ impl Api for Client {
|
||||
let response_{{name}} = response.headers.get::<Response{{nameInCamelCase}}>().ok_or_else(|| "Required response header {{baseName}} for response {{code}} was not found.")?;
|
||||
{{/headers}}
|
||||
|
||||
{{#dataType}} Ok({{operationId}}Response::{{message}}{{^headers}}(body){{/headers}}{{#headers}}{{#-first}}{ body: body, {{/-first}}{{name}}: response_{{name}}.0.clone(){{^-last}}, {{/-last}}{{#-last}} }{{/-last}}{{/headers}})
|
||||
{{/dataType}}{{^dataType}} Ok({{operationId}}Response::{{message}}{{#headers}}{{#-first}}{ {{/-first}}{{^-first}}, {{/-first}}{{name}}: response_{{name}}.0.clone(){{#-last}} }{{/-last}}{{/headers}})
|
||||
{{#dataType}} Ok({{operationId}}Response::{{#vendorExtensions}}{{x-responseId}}{{/vendorExtensions}}{{^headers}}(body){{/headers}}{{#headers}}{{#-first}}{ body: body, {{/-first}}{{name}}: response_{{name}}.0.clone(){{^-last}}, {{/-last}}{{#-last}} }{{/-last}}{{/headers}})
|
||||
{{/dataType}}{{^dataType}} Ok({{operationId}}Response::{{#vendorExtensions}}{{x-responseId}}{{/vendorExtensions}}{{#headers}}{{#-first}}{ {{/-first}}{{^-first}}, {{/-first}}{{name}}: response_{{name}}.0.clone(){{#-last}} }{{/-last}}{{/headers}})
|
||||
{{/dataType}}
|
||||
},
|
||||
{{/responses}}
|
||||
|
@ -37,7 +37,9 @@ pub use swagger::{ApiError, Context, ContextWrapper};
|
||||
#[derive(Debug, PartialEq)]
|
||||
{{/isResponseFile}}
|
||||
pub enum {{operationId}}Response {
|
||||
{{#responses}} {{message}} {{#dataType}}{{^headers}}( {{{dataType}}} ) {{/headers}}{{#headers}}{{#-first}}{ body: {{{dataType}}}{{/-first}}{{/headers}}{{/dataType}}{{#headers}}{{#-first}}{{^dataType}} { {{/dataType}}{{#dataType}}, {{/dataType}}{{/-first}}{{^-first}}, {{/-first}}{{name}}: {{{datatype}}}{{#-last}} } {{/-last}}{{/headers}},
|
||||
{{#responses}}
|
||||
{{#message}} /// {{message}}{{/message}}
|
||||
{{#vendorExtensions}}{{x-responseId}}{{/vendorExtensions}} {{#dataType}}{{^headers}}( {{{dataType}}} ) {{/headers}}{{#headers}}{{#-first}}{ body: {{{dataType}}}{{/-first}}{{/headers}}{{/dataType}}{{#headers}}{{#-first}}{{^dataType}} { {{/dataType}}{{#dataType}}, {{/dataType}}{{/-first}}{{^-first}}, {{/-first}}{{name}}: {{{datatype}}}{{#-last}} } {{/-last}}{{/headers}},
|
||||
{{/responses}}
|
||||
}
|
||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
|
@ -6,7 +6,7 @@ pub mod responses {
|
||||
// The macro is called per-operation to beat the recursion limit
|
||||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}{{#responses}}{{#produces}}{{#-first}}{{#dataType}} /// Create Mime objects for the response content types for {{operationId}}
|
||||
lazy_static! {
|
||||
pub static ref {{#vendorExtensions}}{{uppercase_operation_id}}_{{uppercase_message}}{{/vendorExtensions}}: Mime = mime!({{{mediaType}}});
|
||||
pub static ref {{#vendorExtensions}}{{uppercase_operation_id}}_{{x-uppercaseResponseId}}{{/vendorExtensions}}: Mime = mime!({{{mediaType}}});
|
||||
}
|
||||
{{/dataType}}{{/-first}}{{/produces}}{{/responses}}{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ fn add_routes<T>(router: &mut Router, api: T) where T: Api + Send + Sync + Clone
|
||||
match api.{{#vendorExtensions}}{{operation_id}}{{/vendorExtensions}}({{#allParams}}param_{{paramName}}{{#isListContainer}}.as_ref(){{/isListContainer}}, {{/allParams}}context).wait() {
|
||||
Ok(rsp) => match rsp {
|
||||
{{#responses}}
|
||||
{{operationId}}Response::{{message}}{{#dataType}}{{^headers}}(body){{/headers}}{{#headers}}{{#-first}}{ body{{/-first}}{{/headers}}{{/dataType}}{{#headers}}{{#-first}}{{^dataType}}{ {{/dataType}}{{#dataType}}, {{/dataType}}{{/-first}}{{^-first}}, {{/-first}}{{name}}{{#-last}} }{{/-last}}{{/headers}} => {
|
||||
{{operationId}}Response::{{#vendorExtensions}}{{x-responseId}}{{/vendorExtensions}}{{#dataType}}{{^headers}}(body){{/headers}}{{#headers}}{{#-first}}{ body{{/-first}}{{/headers}}{{/dataType}}{{#headers}}{{#-first}}{{^dataType}}{ {{/dataType}}{{#dataType}}, {{/dataType}}{{/-first}}{{^-first}}, {{/-first}}{{name}}{{#-last}} }{{/-last}}{{/headers}} => {
|
||||
{{^isFile}}
|
||||
{{#dataType}}{{#vendorExtensions}}{{#producesPlainText}} let body_string = body;
|
||||
{{/producesPlainText}}{{#producesXml}}
|
||||
@ -256,7 +256,7 @@ fn add_routes<T>(router: &mut Router, api: T) where T: Api + Send + Sync + Clone
|
||||
{{#isFile}} {{/isFile}} response.headers.set(Response{{nameInCamelCase}}({{name}}));
|
||||
{{/headers}}
|
||||
{{#produces}}{{#-first}}
|
||||
{{#dataType}}{{#isFile}} {{/isFile}} response.headers.set(ContentType(mimetypes::responses::{{#vendorExtensions}}{{uppercase_operation_id}}_{{uppercase_message}}{{/vendorExtensions}}.clone()));{{/dataType}}
|
||||
{{#dataType}}{{#isFile}} {{/isFile}} response.headers.set(ContentType(mimetypes::responses::{{#vendorExtensions}}{{uppercase_operation_id}}_{{x-uppercaseResponseId}}{{/vendorExtensions}}.clone()));{{/dataType}}
|
||||
{{/-first}}{{/produces}}
|
||||
{{#isFile}} {{/isFile}} context.x_span_id.as_ref().map(|header| response.headers.set(XSpanId(header.clone())));
|
||||
{{#bodyParams}}{{#vendorExtensions}}{{^consumesPlainText}} if !unused_elements.is_empty() {
|
||||
|
@ -13,7 +13,7 @@ To see how to make this your own, look here:
|
||||
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)
|
||||
|
||||
- API version: 1.0.0
|
||||
- Build date: 2017-12-07T17:18:10.454Z
|
||||
- Build date: 2017-12-14T14:31:31.219+09:00
|
||||
|
||||
This autogenerated project defines an API crate `petstore_api` which contains:
|
||||
* An `Api` trait defining the API in Rust.
|
||||
|
@ -60,8 +60,9 @@ paths:
|
||||
responses:
|
||||
405:
|
||||
description: "Invalid input"
|
||||
x-responseId: "InvalidInput"
|
||||
x-uppercaseResponseId: "INVALID_INPUT"
|
||||
uppercase_operation_id: "ADD_PET"
|
||||
uppercase_message: "INVALID_INPUT"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
@ -101,16 +102,19 @@ paths:
|
||||
responses:
|
||||
400:
|
||||
description: "Invalid ID supplied"
|
||||
x-responseId: "InvalidIDSupplied"
|
||||
x-uppercaseResponseId: "INVALID_ID_SUPPLIED"
|
||||
uppercase_operation_id: "UPDATE_PET"
|
||||
uppercase_message: "INVALID_ID_SUPPLIED"
|
||||
404:
|
||||
description: "Pet not found"
|
||||
x-responseId: "PetNotFound"
|
||||
x-uppercaseResponseId: "PET_NOT_FOUND"
|
||||
uppercase_operation_id: "UPDATE_PET"
|
||||
uppercase_message: "PET_NOT_FOUND"
|
||||
405:
|
||||
description: "Validation exception"
|
||||
x-responseId: "ValidationException"
|
||||
x-uppercaseResponseId: "VALIDATION_EXCEPTION"
|
||||
uppercase_operation_id: "UPDATE_PET"
|
||||
uppercase_message: "VALIDATION_EXCEPTION"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
@ -154,14 +158,16 @@ paths:
|
||||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/Pet"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "FIND_PETS_BY_STATUS"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
uppercase_data_type: "VEC<PET>"
|
||||
producesXml: true
|
||||
400:
|
||||
description: "Invalid status value"
|
||||
x-responseId: "InvalidStatusValue"
|
||||
x-uppercaseResponseId: "INVALID_STATUS_VALUE"
|
||||
uppercase_operation_id: "FIND_PETS_BY_STATUS"
|
||||
uppercase_message: "INVALID_STATUS_VALUE"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
@ -200,14 +206,16 @@ paths:
|
||||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/Pet"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "FIND_PETS_BY_TAGS"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
uppercase_data_type: "VEC<PET>"
|
||||
producesXml: true
|
||||
400:
|
||||
description: "Invalid tag value"
|
||||
x-responseId: "InvalidTagValue"
|
||||
x-uppercaseResponseId: "INVALID_TAG_VALUE"
|
||||
uppercase_operation_id: "FIND_PETS_BY_TAGS"
|
||||
uppercase_message: "INVALID_TAG_VALUE"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
@ -242,18 +250,21 @@ paths:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
$ref: "#/definitions/Pet"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "GET_PET_BY_ID"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
uppercase_data_type: "PET"
|
||||
producesXml: true
|
||||
400:
|
||||
description: "Invalid ID supplied"
|
||||
x-responseId: "InvalidIDSupplied"
|
||||
x-uppercaseResponseId: "INVALID_ID_SUPPLIED"
|
||||
uppercase_operation_id: "GET_PET_BY_ID"
|
||||
uppercase_message: "INVALID_ID_SUPPLIED"
|
||||
404:
|
||||
description: "Pet not found"
|
||||
x-responseId: "PetNotFound"
|
||||
x-uppercaseResponseId: "PET_NOT_FOUND"
|
||||
uppercase_operation_id: "GET_PET_BY_ID"
|
||||
uppercase_message: "PET_NOT_FOUND"
|
||||
security:
|
||||
- api_key: []
|
||||
operation_id: "get_pet_by_id"
|
||||
@ -298,8 +309,9 @@ paths:
|
||||
responses:
|
||||
405:
|
||||
description: "Invalid input"
|
||||
x-responseId: "InvalidInput"
|
||||
x-uppercaseResponseId: "INVALID_INPUT"
|
||||
uppercase_operation_id: "UPDATE_PET_WITH_FORM"
|
||||
uppercase_message: "INVALID_INPUT"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
@ -336,8 +348,9 @@ paths:
|
||||
responses:
|
||||
400:
|
||||
description: "Invalid pet value"
|
||||
x-responseId: "InvalidPetValue"
|
||||
x-uppercaseResponseId: "INVALID_PET_VALUE"
|
||||
uppercase_operation_id: "DELETE_PET"
|
||||
uppercase_message: "INVALID_PET_VALUE"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
@ -388,8 +401,9 @@ paths:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
$ref: "#/definitions/ApiResponse"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "UPLOAD_FILE"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
uppercase_data_type: "APIRESPONSE"
|
||||
producesJson: true
|
||||
security:
|
||||
@ -420,8 +434,9 @@ paths:
|
||||
additionalProperties:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "GET_INVENTORY"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
uppercase_data_type: "HASHMAP<STRING, I32>"
|
||||
producesJson: true
|
||||
security:
|
||||
@ -460,14 +475,16 @@ paths:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
$ref: "#/definitions/Order"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "PLACE_ORDER"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
uppercase_data_type: "ORDER"
|
||||
producesXml: true
|
||||
400:
|
||||
description: "Invalid Order"
|
||||
x-responseId: "InvalidOrder"
|
||||
x-uppercaseResponseId: "INVALID_ORDER"
|
||||
uppercase_operation_id: "PLACE_ORDER"
|
||||
uppercase_message: "INVALID_ORDER"
|
||||
operation_id: "place_order"
|
||||
uppercase_operation_id: "PLACE_ORDER"
|
||||
path: "/store/order"
|
||||
@ -501,18 +518,21 @@ paths:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
$ref: "#/definitions/Order"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "GET_ORDER_BY_ID"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
uppercase_data_type: "ORDER"
|
||||
producesXml: true
|
||||
400:
|
||||
description: "Invalid ID supplied"
|
||||
x-responseId: "InvalidIDSupplied"
|
||||
x-uppercaseResponseId: "INVALID_ID_SUPPLIED"
|
||||
uppercase_operation_id: "GET_ORDER_BY_ID"
|
||||
uppercase_message: "INVALID_ID_SUPPLIED"
|
||||
404:
|
||||
description: "Order not found"
|
||||
x-responseId: "OrderNotFound"
|
||||
x-uppercaseResponseId: "ORDER_NOT_FOUND"
|
||||
uppercase_operation_id: "GET_ORDER_BY_ID"
|
||||
uppercase_message: "ORDER_NOT_FOUND"
|
||||
operation_id: "get_order_by_id"
|
||||
uppercase_operation_id: "GET_ORDER_BY_ID"
|
||||
path: "/store/order/:order_id"
|
||||
@ -539,12 +559,14 @@ paths:
|
||||
responses:
|
||||
400:
|
||||
description: "Invalid ID supplied"
|
||||
x-responseId: "InvalidIDSupplied"
|
||||
x-uppercaseResponseId: "INVALID_ID_SUPPLIED"
|
||||
uppercase_operation_id: "DELETE_ORDER"
|
||||
uppercase_message: "INVALID_ID_SUPPLIED"
|
||||
404:
|
||||
description: "Order not found"
|
||||
x-responseId: "OrderNotFound"
|
||||
x-uppercaseResponseId: "ORDER_NOT_FOUND"
|
||||
uppercase_operation_id: "DELETE_ORDER"
|
||||
uppercase_message: "ORDER_NOT_FOUND"
|
||||
operation_id: "delete_order"
|
||||
uppercase_operation_id: "DELETE_ORDER"
|
||||
path: "/store/order/:order_id"
|
||||
@ -577,8 +599,9 @@ paths:
|
||||
responses:
|
||||
default:
|
||||
description: "successful operation"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "CREATE_USER"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
operation_id: "create_user"
|
||||
uppercase_operation_id: "CREATE_USER"
|
||||
path: "/user"
|
||||
@ -612,8 +635,9 @@ paths:
|
||||
responses:
|
||||
default:
|
||||
description: "successful operation"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "CREATE_USERS_WITH_ARRAY_INPUT"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
operation_id: "create_users_with_array_input"
|
||||
uppercase_operation_id: "CREATE_USERS_WITH_ARRAY_INPUT"
|
||||
path: "/user/createWithArray"
|
||||
@ -646,8 +670,9 @@ paths:
|
||||
responses:
|
||||
default:
|
||||
description: "successful operation"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "CREATE_USERS_WITH_LIST_INPUT"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
operation_id: "create_users_with_list_input"
|
||||
uppercase_operation_id: "CREATE_USERS_WITH_LIST_INPUT"
|
||||
path: "/user/createWithList"
|
||||
@ -692,14 +717,16 @@ paths:
|
||||
type: "string"
|
||||
format: "date-time"
|
||||
description: "date in UTC when toekn expires"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "LOGIN_USER"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
uppercase_data_type: "STRING"
|
||||
producesXml: true
|
||||
400:
|
||||
description: "Invalid username/password supplied"
|
||||
x-responseId: "InvalidUsername"
|
||||
x-uppercaseResponseId: "INVALID_USERNAME"
|
||||
uppercase_operation_id: "LOGIN_USER"
|
||||
uppercase_message: "INVALID_USERNAME"
|
||||
operation_id: "login_user"
|
||||
uppercase_operation_id: "LOGIN_USER"
|
||||
path: "/user/login"
|
||||
@ -719,8 +746,9 @@ paths:
|
||||
responses:
|
||||
default:
|
||||
description: "successful operation"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "LOGOUT_USER"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
operation_id: "logout_user"
|
||||
uppercase_operation_id: "LOGOUT_USER"
|
||||
path: "/user/logout"
|
||||
@ -749,18 +777,21 @@ paths:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
$ref: "#/definitions/User"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "GET_USER_BY_NAME"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
uppercase_data_type: "USER"
|
||||
producesXml: true
|
||||
400:
|
||||
description: "Invalid username supplied"
|
||||
x-responseId: "InvalidUsernameSupplied"
|
||||
x-uppercaseResponseId: "INVALID_USERNAME_SUPPLIED"
|
||||
uppercase_operation_id: "GET_USER_BY_NAME"
|
||||
uppercase_message: "INVALID_USERNAME_SUPPLIED"
|
||||
404:
|
||||
description: "User not found"
|
||||
x-responseId: "UserNotFound"
|
||||
x-uppercaseResponseId: "USER_NOT_FOUND"
|
||||
uppercase_operation_id: "GET_USER_BY_NAME"
|
||||
uppercase_message: "USER_NOT_FOUND"
|
||||
operation_id: "get_user_by_name"
|
||||
uppercase_operation_id: "GET_USER_BY_NAME"
|
||||
path: "/user/:username"
|
||||
@ -799,12 +830,14 @@ paths:
|
||||
responses:
|
||||
400:
|
||||
description: "Invalid user supplied"
|
||||
x-responseId: "InvalidUserSupplied"
|
||||
x-uppercaseResponseId: "INVALID_USER_SUPPLIED"
|
||||
uppercase_operation_id: "UPDATE_USER"
|
||||
uppercase_message: "INVALID_USER_SUPPLIED"
|
||||
404:
|
||||
description: "User not found"
|
||||
x-responseId: "UserNotFound"
|
||||
x-uppercaseResponseId: "USER_NOT_FOUND"
|
||||
uppercase_operation_id: "UPDATE_USER"
|
||||
uppercase_message: "USER_NOT_FOUND"
|
||||
operation_id: "update_user"
|
||||
uppercase_operation_id: "UPDATE_USER"
|
||||
path: "/user/:username"
|
||||
@ -831,12 +864,14 @@ paths:
|
||||
responses:
|
||||
400:
|
||||
description: "Invalid username supplied"
|
||||
x-responseId: "InvalidUsernameSupplied"
|
||||
x-uppercaseResponseId: "INVALID_USERNAME_SUPPLIED"
|
||||
uppercase_operation_id: "DELETE_USER"
|
||||
uppercase_message: "INVALID_USERNAME_SUPPLIED"
|
||||
404:
|
||||
description: "User not found"
|
||||
x-responseId: "UserNotFound"
|
||||
x-uppercaseResponseId: "USER_NOT_FOUND"
|
||||
uppercase_operation_id: "DELETE_USER"
|
||||
uppercase_message: "USER_NOT_FOUND"
|
||||
operation_id: "delete_user"
|
||||
uppercase_operation_id: "DELETE_USER"
|
||||
path: "/user/:username"
|
||||
@ -871,8 +906,9 @@ paths:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
$ref: "#/definitions/Client"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "TEST_CLASSNAME"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
uppercase_data_type: "CLIENT"
|
||||
producesJson: true
|
||||
security:
|
||||
@ -995,12 +1031,14 @@ paths:
|
||||
responses:
|
||||
400:
|
||||
description: "Invalid request"
|
||||
x-responseId: "InvalidRequest"
|
||||
x-uppercaseResponseId: "INVALID_REQUEST"
|
||||
uppercase_operation_id: "TEST_ENUM_PARAMETERS"
|
||||
uppercase_message: "INVALID_REQUEST"
|
||||
404:
|
||||
description: "Not found"
|
||||
x-responseId: "NotFound"
|
||||
x-uppercaseResponseId: "NOT_FOUND"
|
||||
uppercase_operation_id: "TEST_ENUM_PARAMETERS"
|
||||
uppercase_message: "NOT_FOUND"
|
||||
operation_id: "test_enum_parameters"
|
||||
uppercase_operation_id: "TEST_ENUM_PARAMETERS"
|
||||
path: "/fake"
|
||||
@ -1144,12 +1182,14 @@ paths:
|
||||
responses:
|
||||
400:
|
||||
description: "Invalid username supplied"
|
||||
x-responseId: "InvalidUsernameSupplied"
|
||||
x-uppercaseResponseId: "INVALID_USERNAME_SUPPLIED"
|
||||
uppercase_operation_id: "TEST_ENDPOINT_PARAMETERS"
|
||||
uppercase_message: "INVALID_USERNAME_SUPPLIED"
|
||||
404:
|
||||
description: "User not found"
|
||||
x-responseId: "UserNotFound"
|
||||
x-uppercaseResponseId: "USER_NOT_FOUND"
|
||||
uppercase_operation_id: "TEST_ENDPOINT_PARAMETERS"
|
||||
uppercase_message: "USER_NOT_FOUND"
|
||||
security:
|
||||
- http_basic_test: []
|
||||
operation_id: "test_endpoint_parameters"
|
||||
@ -1186,8 +1226,9 @@ paths:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
$ref: "#/definitions/Client"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "TEST_CLIENT_MODEL"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
uppercase_data_type: "CLIENT"
|
||||
producesJson: true
|
||||
operation_id: "test_client_model"
|
||||
@ -1221,8 +1262,9 @@ paths:
|
||||
description: "Output number"
|
||||
schema:
|
||||
$ref: "#/definitions/OuterNumber"
|
||||
x-responseId: "OutputNumber"
|
||||
x-uppercaseResponseId: "OUTPUT_NUMBER"
|
||||
uppercase_operation_id: "FAKE_OUTER_NUMBER_SERIALIZE"
|
||||
uppercase_message: "OUTPUT_NUMBER"
|
||||
uppercase_data_type: "OUTERNUMBER"
|
||||
producesJson: true
|
||||
operation_id: "fake_outer_number_serialize"
|
||||
@ -1255,8 +1297,9 @@ paths:
|
||||
description: "Output string"
|
||||
schema:
|
||||
$ref: "#/definitions/OuterString"
|
||||
x-responseId: "OutputString"
|
||||
x-uppercaseResponseId: "OUTPUT_STRING"
|
||||
uppercase_operation_id: "FAKE_OUTER_STRING_SERIALIZE"
|
||||
uppercase_message: "OUTPUT_STRING"
|
||||
uppercase_data_type: "OUTERSTRING"
|
||||
producesJson: true
|
||||
operation_id: "fake_outer_string_serialize"
|
||||
@ -1289,8 +1332,9 @@ paths:
|
||||
description: "Output boolean"
|
||||
schema:
|
||||
$ref: "#/definitions/OuterBoolean"
|
||||
x-responseId: "OutputBoolean"
|
||||
x-uppercaseResponseId: "OUTPUT_BOOLEAN"
|
||||
uppercase_operation_id: "FAKE_OUTER_BOOLEAN_SERIALIZE"
|
||||
uppercase_message: "OUTPUT_BOOLEAN"
|
||||
uppercase_data_type: "OUTERBOOLEAN"
|
||||
producesJson: true
|
||||
operation_id: "fake_outer_boolean_serialize"
|
||||
@ -1323,8 +1367,9 @@ paths:
|
||||
description: "Output composite"
|
||||
schema:
|
||||
$ref: "#/definitions/OuterComposite"
|
||||
x-responseId: "OutputComposite"
|
||||
x-uppercaseResponseId: "OUTPUT_COMPOSITE"
|
||||
uppercase_operation_id: "FAKE_OUTER_COMPOSITE_SERIALIZE"
|
||||
uppercase_message: "OUTPUT_COMPOSITE"
|
||||
uppercase_data_type: "OUTERCOMPOSITE"
|
||||
producesJson: true
|
||||
operation_id: "fake_outer_composite_serialize"
|
||||
@ -1359,8 +1404,9 @@ paths:
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "TEST_JSON_FORM_DATA"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
operation_id: "test_json_form_data"
|
||||
uppercase_operation_id: "TEST_JSON_FORM_DATA"
|
||||
path: "/fake/jsonFormData"
|
||||
@ -1394,8 +1440,9 @@ paths:
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "TEST_INLINE_ADDITIONAL_PROPERTIES"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
operation_id: "test_inline_additional_properties"
|
||||
uppercase_operation_id: "TEST_INLINE_ADDITIONAL_PROPERTIES"
|
||||
path: "/fake/inline-additionalProperties"
|
||||
@ -1432,8 +1479,9 @@ paths:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
$ref: "#/definitions/Client"
|
||||
x-responseId: "SuccessfulOperation"
|
||||
x-uppercaseResponseId: "SUCCESSFUL_OPERATION"
|
||||
uppercase_operation_id: "TEST_SPECIAL_TAGS"
|
||||
uppercase_message: "SUCCESSFUL_OPERATION"
|
||||
uppercase_data_type: "CLIENT"
|
||||
producesJson: true
|
||||
operation_id: "test_special_tags"
|
||||
@ -1487,12 +1535,12 @@ definitions:
|
||||
type: "boolean"
|
||||
default: false
|
||||
example:
|
||||
id: 0
|
||||
petId: 6
|
||||
quantity: 1
|
||||
id: 0
|
||||
shipDate: "2000-01-23T04:56:07.000+00:00"
|
||||
complete: false
|
||||
status: "placed"
|
||||
quantity: 1
|
||||
shipDate: "2000-01-23T04:56:07.000+00:00"
|
||||
xml:
|
||||
name: "Order"
|
||||
upperCaseName: "ORDER"
|
||||
@ -1505,8 +1553,8 @@ definitions:
|
||||
name:
|
||||
type: "string"
|
||||
example:
|
||||
id: 6
|
||||
name: "name"
|
||||
id: 6
|
||||
xml:
|
||||
name: "Category"
|
||||
upperCaseName: "CATEGORY"
|
||||
@ -1534,14 +1582,14 @@ definitions:
|
||||
format: "int32"
|
||||
description: "User Status"
|
||||
example:
|
||||
id: 0
|
||||
lastName: "lastName"
|
||||
phone: "phone"
|
||||
username: "username"
|
||||
email: "email"
|
||||
userStatus: 6
|
||||
firstName: "firstName"
|
||||
lastName: "lastName"
|
||||
password: "password"
|
||||
userStatus: 6
|
||||
phone: "phone"
|
||||
id: 0
|
||||
email: "email"
|
||||
username: "username"
|
||||
xml:
|
||||
name: "User"
|
||||
upperCaseName: "USER"
|
||||
@ -1554,8 +1602,8 @@ definitions:
|
||||
name:
|
||||
type: "string"
|
||||
example:
|
||||
id: 1
|
||||
name: "name"
|
||||
id: 1
|
||||
xml:
|
||||
name: "Tag"
|
||||
upperCaseName: "TAG"
|
||||
@ -1596,20 +1644,20 @@ definitions:
|
||||
- "pending"
|
||||
- "sold"
|
||||
example:
|
||||
tags:
|
||||
- id: 1
|
||||
name: "name"
|
||||
- id: 1
|
||||
name: "name"
|
||||
id: 0
|
||||
category:
|
||||
id: 6
|
||||
name: "name"
|
||||
status: "available"
|
||||
name: "doggie"
|
||||
photoUrls:
|
||||
- "photoUrls"
|
||||
- "photoUrls"
|
||||
name: "doggie"
|
||||
id: 0
|
||||
category:
|
||||
name: "name"
|
||||
id: 6
|
||||
tags:
|
||||
- name: "name"
|
||||
id: 1
|
||||
- name: "name"
|
||||
id: 1
|
||||
status: "available"
|
||||
xml:
|
||||
name: "Pet"
|
||||
upperCaseName: "PET"
|
||||
@ -1624,9 +1672,9 @@ definitions:
|
||||
message:
|
||||
type: "string"
|
||||
example:
|
||||
message: "message"
|
||||
code: 0
|
||||
type: "type"
|
||||
message: "message"
|
||||
upperCaseName: "APIRESPONSE"
|
||||
$special[model.name]:
|
||||
properties:
|
||||
@ -1979,8 +2027,8 @@ definitions:
|
||||
my_boolean:
|
||||
$ref: "#/definitions/OuterBoolean"
|
||||
example:
|
||||
my_number: {}
|
||||
my_string: {}
|
||||
my_number: {}
|
||||
my_boolean: {}
|
||||
upperCaseName: "OUTERCOMPOSITE"
|
||||
OuterNumber:
|
||||
|
@ -35,173 +35,221 @@ pub use swagger::{ApiError, Context, ContextWrapper};
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum TestSpecialTagsResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ( models::Client ) ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum FakeOuterBooleanSerializeResponse {
|
||||
/// Output boolean
|
||||
OutputBoolean ( models::OuterBoolean ) ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum FakeOuterCompositeSerializeResponse {
|
||||
/// Output composite
|
||||
OutputComposite ( models::OuterComposite ) ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum FakeOuterNumberSerializeResponse {
|
||||
/// Output number
|
||||
OutputNumber ( models::OuterNumber ) ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum FakeOuterStringSerializeResponse {
|
||||
/// Output string
|
||||
OutputString ( models::OuterString ) ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum TestClientModelResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ( models::Client ) ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum TestEndpointParametersResponse {
|
||||
/// Invalid username supplied
|
||||
InvalidUsernameSupplied ,
|
||||
/// User not found
|
||||
UserNotFound ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum TestEnumParametersResponse {
|
||||
/// Invalid request
|
||||
InvalidRequest ,
|
||||
/// Not found
|
||||
NotFound ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum TestInlineAdditionalPropertiesResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum TestJsonFormDataResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum TestClassnameResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ( models::Client ) ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum AddPetResponse {
|
||||
/// Invalid input
|
||||
InvalidInput ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum DeletePetResponse {
|
||||
/// Invalid pet value
|
||||
InvalidPetValue ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum FindPetsByStatusResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ( Vec<models::Pet> ) ,
|
||||
/// Invalid status value
|
||||
InvalidStatusValue ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum FindPetsByTagsResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ( Vec<models::Pet> ) ,
|
||||
/// Invalid tag value
|
||||
InvalidTagValue ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum GetPetByIdResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ( models::Pet ) ,
|
||||
/// Invalid ID supplied
|
||||
InvalidIDSupplied ,
|
||||
/// Pet not found
|
||||
PetNotFound ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum UpdatePetResponse {
|
||||
/// Invalid ID supplied
|
||||
InvalidIDSupplied ,
|
||||
/// Pet not found
|
||||
PetNotFound ,
|
||||
/// Validation exception
|
||||
ValidationException ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum UpdatePetWithFormResponse {
|
||||
/// Invalid input
|
||||
InvalidInput ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum UploadFileResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ( models::ApiResponse ) ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum DeleteOrderResponse {
|
||||
/// Invalid ID supplied
|
||||
InvalidIDSupplied ,
|
||||
/// Order not found
|
||||
OrderNotFound ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum GetInventoryResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ( HashMap<String, i32> ) ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum GetOrderByIdResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ( models::Order ) ,
|
||||
/// Invalid ID supplied
|
||||
InvalidIDSupplied ,
|
||||
/// Order not found
|
||||
OrderNotFound ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum PlaceOrderResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ( models::Order ) ,
|
||||
/// Invalid Order
|
||||
InvalidOrder ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum CreateUserResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum CreateUsersWithArrayInputResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum CreateUsersWithListInputResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum DeleteUserResponse {
|
||||
/// Invalid username supplied
|
||||
InvalidUsernameSupplied ,
|
||||
/// User not found
|
||||
UserNotFound ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum GetUserByNameResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ( models::User ) ,
|
||||
/// Invalid username supplied
|
||||
InvalidUsernameSupplied ,
|
||||
/// User not found
|
||||
UserNotFound ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum LoginUserResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation { body: String, x_rate_limit: i32, x_expires_after: chrono::DateTime<chrono::Utc> } ,
|
||||
/// Invalid username/password supplied
|
||||
InvalidUsername ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum LogoutUserResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation ,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum UpdateUserResponse {
|
||||
/// Invalid user supplied
|
||||
InvalidUserSupplied ,
|
||||
/// User not found
|
||||
UserNotFound ,
|
||||
}
|
||||
|
||||
|
@ -392,11 +392,11 @@ impl EnumTest {
|
||||
pub struct FormatTest {
|
||||
#[serde(rename = "integer")]
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
pub integer: Option<i32>,
|
||||
pub integer: Option<u8>,
|
||||
|
||||
#[serde(rename = "int32")]
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
pub int32: Option<i32>,
|
||||
pub int32: Option<u32>,
|
||||
|
||||
#[serde(rename = "int64")]
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
@ -603,7 +603,7 @@ pub struct Name {
|
||||
|
||||
#[serde(rename = "123Number")]
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
pub _123_number: Option<i32>,
|
||||
pub _123_number: Option<isize>,
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user