[Rust-Server] Use string literal based mime initialization (#7212)

* Use string literal based mime initialization to avoid invalid token error

* canonicalize mimetypes before checking
This commit is contained in:
Sunrin SHIMURA
2018-01-08 01:00:12 +09:00
committed by William Cheng
parent e51223eef1
commit f5adbec1ff
4 changed files with 44 additions and 91 deletions

View File

@@ -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-14T14:31:31.219+09:00
- Build date: 2017-12-20T15:51:59.221+09:00
This autogenerated project defines an API crate `petstore_api` which contains:
* An `Api` trait defining the API in Rust.

View File

@@ -6,51 +6,51 @@ pub mod responses {
// The macro is called per-operation to beat the recursion limit
/// Create Mime objects for the response content types for TestSpecialTags
lazy_static! {
pub static ref TEST_SPECIAL_TAGS_SUCCESSFUL_OPERATION: Mime = mime!(Application/Json);
pub static ref TEST_SPECIAL_TAGS_SUCCESSFUL_OPERATION: Mime = "application/json".parse().unwrap();
}
/// Create Mime objects for the response content types for TestClientModel
lazy_static! {
pub static ref TEST_CLIENT_MODEL_SUCCESSFUL_OPERATION: Mime = mime!(Application/Json);
pub static ref TEST_CLIENT_MODEL_SUCCESSFUL_OPERATION: Mime = "application/json".parse().unwrap();
}
/// Create Mime objects for the response content types for TestClassname
lazy_static! {
pub static ref TEST_CLASSNAME_SUCCESSFUL_OPERATION: Mime = mime!(Application/Json);
pub static ref TEST_CLASSNAME_SUCCESSFUL_OPERATION: Mime = "application/json".parse().unwrap();
}
/// Create Mime objects for the response content types for FindPetsByStatus
lazy_static! {
pub static ref FIND_PETS_BY_STATUS_SUCCESSFUL_OPERATION: Mime = mime!(Application/Xml);
pub static ref FIND_PETS_BY_STATUS_SUCCESSFUL_OPERATION: Mime = "application/xml".parse().unwrap();
}
/// Create Mime objects for the response content types for FindPetsByTags
lazy_static! {
pub static ref FIND_PETS_BY_TAGS_SUCCESSFUL_OPERATION: Mime = mime!(Application/Xml);
pub static ref FIND_PETS_BY_TAGS_SUCCESSFUL_OPERATION: Mime = "application/xml".parse().unwrap();
}
/// Create Mime objects for the response content types for GetPetById
lazy_static! {
pub static ref GET_PET_BY_ID_SUCCESSFUL_OPERATION: Mime = mime!(Application/Xml);
pub static ref GET_PET_BY_ID_SUCCESSFUL_OPERATION: Mime = "application/xml".parse().unwrap();
}
/// Create Mime objects for the response content types for UploadFile
lazy_static! {
pub static ref UPLOAD_FILE_SUCCESSFUL_OPERATION: Mime = mime!(Application/Json);
pub static ref UPLOAD_FILE_SUCCESSFUL_OPERATION: Mime = "application/json".parse().unwrap();
}
/// Create Mime objects for the response content types for GetInventory
lazy_static! {
pub static ref GET_INVENTORY_SUCCESSFUL_OPERATION: Mime = mime!(Application/Json);
pub static ref GET_INVENTORY_SUCCESSFUL_OPERATION: Mime = "application/json".parse().unwrap();
}
/// Create Mime objects for the response content types for GetOrderById
lazy_static! {
pub static ref GET_ORDER_BY_ID_SUCCESSFUL_OPERATION: Mime = mime!(Application/Xml);
pub static ref GET_ORDER_BY_ID_SUCCESSFUL_OPERATION: Mime = "application/xml".parse().unwrap();
}
/// Create Mime objects for the response content types for PlaceOrder
lazy_static! {
pub static ref PLACE_ORDER_SUCCESSFUL_OPERATION: Mime = mime!(Application/Xml);
pub static ref PLACE_ORDER_SUCCESSFUL_OPERATION: Mime = "application/xml".parse().unwrap();
}
/// Create Mime objects for the response content types for GetUserByName
lazy_static! {
pub static ref GET_USER_BY_NAME_SUCCESSFUL_OPERATION: Mime = mime!(Application/Xml);
pub static ref GET_USER_BY_NAME_SUCCESSFUL_OPERATION: Mime = "application/xml".parse().unwrap();
}
/// Create Mime objects for the response content types for LoginUser
lazy_static! {
pub static ref LOGIN_USER_SUCCESSFUL_OPERATION: Mime = mime!(Application/Xml);
pub static ref LOGIN_USER_SUCCESSFUL_OPERATION: Mime = "application/xml".parse().unwrap();
}
}
@@ -59,63 +59,63 @@ pub mod requests {
use hyper::mime::*;
/// Create Mime objects for the request content types for TestSpecialTags
lazy_static! {
pub static ref TEST_SPECIAL_TAGS: Mime = mime!(Application/Json);
pub static ref TEST_SPECIAL_TAGS: Mime = "application/json".parse().unwrap();
}
/// Create Mime objects for the request content types for FakeOuterBooleanSerialize
lazy_static! {
pub static ref FAKE_OUTER_BOOLEAN_SERIALIZE: Mime = mime!(Application/Json);
pub static ref FAKE_OUTER_BOOLEAN_SERIALIZE: Mime = "Application/Json".parse().unwrap();
}
/// Create Mime objects for the request content types for FakeOuterCompositeSerialize
lazy_static! {
pub static ref FAKE_OUTER_COMPOSITE_SERIALIZE: Mime = mime!(Application/Json);
pub static ref FAKE_OUTER_COMPOSITE_SERIALIZE: Mime = "Application/Json".parse().unwrap();
}
/// Create Mime objects for the request content types for FakeOuterNumberSerialize
lazy_static! {
pub static ref FAKE_OUTER_NUMBER_SERIALIZE: Mime = mime!(Application/Json);
pub static ref FAKE_OUTER_NUMBER_SERIALIZE: Mime = "Application/Json".parse().unwrap();
}
/// Create Mime objects for the request content types for FakeOuterStringSerialize
lazy_static! {
pub static ref FAKE_OUTER_STRING_SERIALIZE: Mime = mime!(Application/Json);
pub static ref FAKE_OUTER_STRING_SERIALIZE: Mime = "Application/Json".parse().unwrap();
}
/// Create Mime objects for the request content types for TestClientModel
lazy_static! {
pub static ref TEST_CLIENT_MODEL: Mime = mime!(Application/Json);
pub static ref TEST_CLIENT_MODEL: Mime = "application/json".parse().unwrap();
}
/// Create Mime objects for the request content types for TestInlineAdditionalProperties
lazy_static! {
pub static ref TEST_INLINE_ADDITIONAL_PROPERTIES: Mime = mime!(Application/Json);
pub static ref TEST_INLINE_ADDITIONAL_PROPERTIES: Mime = "application/json".parse().unwrap();
}
/// Create Mime objects for the request content types for TestClassname
lazy_static! {
pub static ref TEST_CLASSNAME: Mime = mime!(Application/Json);
pub static ref TEST_CLASSNAME: Mime = "application/json".parse().unwrap();
}
/// Create Mime objects for the request content types for AddPet
lazy_static! {
pub static ref ADD_PET: Mime = mime!(Application/Json);
pub static ref ADD_PET: Mime = "application/json".parse().unwrap();
}
/// Create Mime objects for the request content types for UpdatePet
lazy_static! {
pub static ref UPDATE_PET: Mime = mime!(Application/Json);
pub static ref UPDATE_PET: Mime = "application/json".parse().unwrap();
}
/// Create Mime objects for the request content types for PlaceOrder
lazy_static! {
pub static ref PLACE_ORDER: Mime = mime!(Application/Json);
pub static ref PLACE_ORDER: Mime = "Application/Json".parse().unwrap();
}
/// Create Mime objects for the request content types for CreateUser
lazy_static! {
pub static ref CREATE_USER: Mime = mime!(Application/Json);
pub static ref CREATE_USER: Mime = "Application/Json".parse().unwrap();
}
/// Create Mime objects for the request content types for CreateUsersWithArrayInput
lazy_static! {
pub static ref CREATE_USERS_WITH_ARRAY_INPUT: Mime = mime!(Application/Json);
pub static ref CREATE_USERS_WITH_ARRAY_INPUT: Mime = "Application/Json".parse().unwrap();
}
/// Create Mime objects for the request content types for CreateUsersWithListInput
lazy_static! {
pub static ref CREATE_USERS_WITH_LIST_INPUT: Mime = mime!(Application/Json);
pub static ref CREATE_USERS_WITH_LIST_INPUT: Mime = "Application/Json".parse().unwrap();
}
/// Create Mime objects for the request content types for UpdateUser
lazy_static! {
pub static ref UPDATE_USER: Mime = mime!(Application/Json);
pub static ref UPDATE_USER: Mime = "Application/Json".parse().unwrap();
}
}