Euan Kemp c97b63d2bb [Rust] Implement 'object' type conversion (#6846)
* [Rust] Use serde Value for objects

This hopefully fixes the previous TODO; it at least fixes compilation
errors for the specific swagger model I'm working with.

* [Rust] Update Cargo.toml to specify versions

Letting the version float freely is scary, to say the least.

This gives it a better chance at being future-proof.

When the crate author had a recommended selector I picked that,
otherwise I went semver compatible.

* [Rust] Regenerate the example
2017-11-01 22:00:56 +08:00

1976 lines
53 KiB
YAML

---
swagger: "2.0"
info:
description: "This spec is mainly for testing Petstore server and contains fake\
\ endpoints, models. Please do not use this for any other purpose. Special characters:\
\ \" \\"
version: "1.0.0"
title: "Swagger Petstore"
termsOfService: "http://swagger.io/terms/"
contact:
email: "apiteam@swagger.io"
license:
name: "Apache-2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "petstore.swagger.io:80"
basePath: "/v2"
tags:
- name: "pet"
description: "Everything about your Pets"
externalDocs:
description: "Find out more"
url: "http://swagger.io"
- name: "store"
description: "Access to Petstore orders"
- name: "user"
description: "Operations about user"
externalDocs:
description: "Find out more about our store"
url: "http://swagger.io"
schemes:
- "http"
paths:
/pet:
post:
tags:
- "pet"
summary: "Add a new pet to the store"
description: ""
operationId: "addPet"
consumes:
- "application/json"
- "application/xml"
produces:
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Pet object that needs to be added to the store"
required: true
schema:
$ref: "#/definitions/Pet"
uppercase_data_type: "PET"
refName: "Pet"
formatString: "{:?}"
example: "???"
model_key: "OuterBoolean"
uppercase_operation_id: "ADD_PET"
consumesXml: true
responses:
405:
description: "Invalid input"
uppercase_operation_id: "ADD_PET"
uppercase_message: "INVALID_INPUT"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
operation_id: "add_pet"
uppercase_operation_id: "ADD_PET"
path: "/pet"
HttpMethod: "Post"
httpmethod: "post"
noClientExample: true
put:
tags:
- "pet"
summary: "Update an existing pet"
description: ""
operationId: "updatePet"
consumes:
- "application/json"
- "application/xml"
produces:
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Pet object that needs to be added to the store"
required: true
schema:
$ref: "#/definitions/Pet"
uppercase_data_type: "PET"
refName: "Pet"
formatString: "{:?}"
example: "???"
model_key: "OuterBoolean"
uppercase_operation_id: "UPDATE_PET"
consumesXml: true
responses:
400:
description: "Invalid ID supplied"
uppercase_operation_id: "UPDATE_PET"
uppercase_message: "INVALID_ID_SUPPLIED"
404:
description: "Pet not found"
uppercase_operation_id: "UPDATE_PET"
uppercase_message: "PET_NOT_FOUND"
405:
description: "Validation exception"
uppercase_operation_id: "UPDATE_PET"
uppercase_message: "VALIDATION_EXCEPTION"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
operation_id: "update_pet"
uppercase_operation_id: "UPDATE_PET"
path: "/pet"
HttpMethod: "Put"
httpmethod: "put"
noClientExample: true
/pet/findByStatus:
get:
tags:
- "pet"
summary: "Finds Pets by status"
description: "Multiple status values can be provided with comma separated strings"
operationId: "findPetsByStatus"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "status"
in: "query"
description: "Status values that need to be considered for filter"
required: true
type: "array"
items:
type: "string"
enum:
- "available"
- "pending"
- "sold"
default: "available"
collectionFormat: "csv"
formatString: "{:?}"
example: "&Vec::new()"
responses:
200:
description: "successful operation"
schema:
type: "array"
items:
$ref: "#/definitions/Pet"
uppercase_operation_id: "FIND_PETS_BY_STATUS"
uppercase_message: "SUCCESSFUL_OPERATION"
uppercase_data_type: "VEC<PET>"
producesXml: true
400:
description: "Invalid status value"
uppercase_operation_id: "FIND_PETS_BY_STATUS"
uppercase_message: "INVALID_STATUS_VALUE"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
operation_id: "find_pets_by_status"
uppercase_operation_id: "FIND_PETS_BY_STATUS"
path: "/pet/findByStatus"
HttpMethod: "Get"
httpmethod: "get"
/pet/findByTags:
get:
tags:
- "pet"
summary: "Finds Pets by tags"
description: "Multiple tags can be provided with comma separated strings. Use\
\ tag1, tag2, tag3 for testing."
operationId: "findPetsByTags"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "tags"
in: "query"
description: "Tags to filter by"
required: true
type: "array"
items:
type: "string"
collectionFormat: "csv"
formatString: "{:?}"
example: "&Vec::new()"
responses:
200:
description: "successful operation"
schema:
type: "array"
items:
$ref: "#/definitions/Pet"
uppercase_operation_id: "FIND_PETS_BY_TAGS"
uppercase_message: "SUCCESSFUL_OPERATION"
uppercase_data_type: "VEC<PET>"
producesXml: true
400:
description: "Invalid tag value"
uppercase_operation_id: "FIND_PETS_BY_TAGS"
uppercase_message: "INVALID_TAG_VALUE"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
deprecated: true
operation_id: "find_pets_by_tags"
uppercase_operation_id: "FIND_PETS_BY_TAGS"
path: "/pet/findByTags"
HttpMethod: "Get"
httpmethod: "get"
/pet/{petId}:
get:
tags:
- "pet"
summary: "Find pet by ID"
description: "Returns a single pet"
operationId: "getPetById"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "petId"
in: "path"
description: "ID of pet to return"
required: true
type: "integer"
format: "int64"
formatString: "{}"
example: "789"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Pet"
uppercase_operation_id: "GET_PET_BY_ID"
uppercase_message: "SUCCESSFUL_OPERATION"
uppercase_data_type: "PET"
producesXml: true
400:
description: "Invalid ID supplied"
uppercase_operation_id: "GET_PET_BY_ID"
uppercase_message: "INVALID_ID_SUPPLIED"
404:
description: "Pet not found"
uppercase_operation_id: "GET_PET_BY_ID"
uppercase_message: "PET_NOT_FOUND"
security:
- api_key: []
operation_id: "get_pet_by_id"
uppercase_operation_id: "GET_PET_BY_ID"
path: "/pet/:petId"
HttpMethod: "Get"
httpmethod: "get"
post:
tags:
- "pet"
summary: "Updates a pet in the store with form data"
description: ""
operationId: "updatePetWithForm"
consumes:
- "application/x-www-form-urlencoded"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "petId"
in: "path"
description: "ID of pet that needs to be updated"
required: true
type: "integer"
format: "int64"
formatString: "{}"
example: "789"
- name: "name"
in: "formData"
description: "Updated name of the pet"
required: false
type: "string"
formatString: "{:?}"
example: "Some(\"name_example\".to_string())"
- name: "status"
in: "formData"
description: "Updated status of the pet"
required: false
type: "string"
formatString: "{:?}"
example: "Some(\"status_example\".to_string())"
responses:
405:
description: "Invalid input"
uppercase_operation_id: "UPDATE_PET_WITH_FORM"
uppercase_message: "INVALID_INPUT"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
operation_id: "update_pet_with_form"
uppercase_operation_id: "UPDATE_PET_WITH_FORM"
path: "/pet/:petId"
HttpMethod: "Post"
httpmethod: "post"
delete:
tags:
- "pet"
summary: "Deletes a pet"
description: ""
operationId: "deletePet"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "api_key"
in: "header"
required: false
type: "string"
formatString: "{:?}"
example: "Some(\"api_key_example\".to_string())"
- name: "petId"
in: "path"
description: "Pet id to delete"
required: true
type: "integer"
format: "int64"
formatString: "{}"
example: "789"
responses:
400:
description: "Invalid pet value"
uppercase_operation_id: "DELETE_PET"
uppercase_message: "INVALID_PET_VALUE"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
operation_id: "delete_pet"
uppercase_operation_id: "DELETE_PET"
path: "/pet/:petId"
HttpMethod: "Delete"
httpmethod: "delete"
/pet/{petId}/uploadImage:
post:
tags:
- "pet"
summary: "uploads an image"
description: ""
operationId: "uploadFile"
consumes:
- "multipart/form-data"
produces:
- "application/json"
parameters:
- name: "petId"
in: "path"
description: "ID of pet to update"
required: true
type: "integer"
format: "int64"
formatString: "{}"
example: "789"
- name: "additionalMetadata"
in: "formData"
description: "Additional data to pass to server"
required: false
type: "string"
formatString: "{:?}"
example: "Some(\"additional_metadata_example\".to_string())"
- name: "file"
in: "formData"
description: "file to upload"
required: false
type: "file"
formatString: "{:?}"
example: "Box::new(future::ok(Some(Box::new(stream::once(Ok(b\"hello\".to_vec())))\
\ as Box<Stream<Item=_, Error=_> + Send>))) as Box<Future<Item=_, Error=_>\
\ + Send>"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/ApiResponse"
uppercase_operation_id: "UPLOAD_FILE"
uppercase_message: "SUCCESSFUL_OPERATION"
uppercase_data_type: "APIRESPONSE"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
operation_id: "upload_file"
uppercase_operation_id: "UPLOAD_FILE"
path: "/pet/:petId/uploadImage"
HttpMethod: "Post"
httpmethod: "post"
hasFile: true
/store/inventory:
get:
tags:
- "store"
summary: "Returns pet inventories by status"
description: "Returns a map of status codes to quantities"
operationId: "getInventory"
produces:
- "application/json"
parameters: []
responses:
200:
description: "successful operation"
schema:
type: "object"
additionalProperties:
type: "integer"
format: "int32"
uppercase_operation_id: "GET_INVENTORY"
uppercase_message: "SUCCESSFUL_OPERATION"
uppercase_data_type: "HASHMAP<STRING, I32>"
security:
- api_key: []
operation_id: "get_inventory"
uppercase_operation_id: "GET_INVENTORY"
path: "/store/inventory"
HttpMethod: "Get"
httpmethod: "get"
/store/order:
post:
tags:
- "store"
summary: "Place an order for a pet"
description: ""
operationId: "placeOrder"
produces:
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "order placed for purchasing the pet"
required: true
schema:
$ref: "#/definitions/Order"
uppercase_data_type: "ORDER"
refName: "Order"
formatString: "{:?}"
example: "???"
model_key: "OuterBoolean"
uppercase_operation_id: "PLACE_ORDER"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Order"
uppercase_operation_id: "PLACE_ORDER"
uppercase_message: "SUCCESSFUL_OPERATION"
uppercase_data_type: "ORDER"
producesXml: true
400:
description: "Invalid Order"
uppercase_operation_id: "PLACE_ORDER"
uppercase_message: "INVALID_ORDER"
operation_id: "place_order"
uppercase_operation_id: "PLACE_ORDER"
path: "/store/order"
HttpMethod: "Post"
httpmethod: "post"
noClientExample: true
/store/order/{order_id}:
get:
tags:
- "store"
summary: "Find purchase order by ID"
description: "For valid response try integer IDs with value <= 5 or > 10. Other\
\ values will generated exceptions"
operationId: "getOrderById"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "order_id"
in: "path"
description: "ID of pet that needs to be fetched"
required: true
type: "integer"
maximum: 5
minimum: 1
format: "int64"
formatString: "{}"
example: "789"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Order"
uppercase_operation_id: "GET_ORDER_BY_ID"
uppercase_message: "SUCCESSFUL_OPERATION"
uppercase_data_type: "ORDER"
producesXml: true
400:
description: "Invalid ID supplied"
uppercase_operation_id: "GET_ORDER_BY_ID"
uppercase_message: "INVALID_ID_SUPPLIED"
404:
description: "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"
HttpMethod: "Get"
httpmethod: "get"
delete:
tags:
- "store"
summary: "Delete purchase order by ID"
description: "For valid response try integer IDs with value < 1000. Anything\
\ above 1000 or nonintegers will generate API errors"
operationId: "deleteOrder"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "order_id"
in: "path"
description: "ID of the order that needs to be deleted"
required: true
type: "string"
formatString: "\\\"{}\\\""
example: "\"order_id_example\".to_string()"
responses:
400:
description: "Invalid ID supplied"
uppercase_operation_id: "DELETE_ORDER"
uppercase_message: "INVALID_ID_SUPPLIED"
404:
description: "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"
HttpMethod: "Delete"
httpmethod: "delete"
/user:
post:
tags:
- "user"
summary: "Create user"
description: "This can only be done by the logged in user."
operationId: "createUser"
produces:
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "Created user object"
required: true
schema:
$ref: "#/definitions/User"
uppercase_data_type: "USER"
refName: "User"
formatString: "{:?}"
example: "???"
model_key: "OuterBoolean"
uppercase_operation_id: "CREATE_USER"
responses:
default:
description: "successful operation"
uppercase_operation_id: "CREATE_USER"
uppercase_message: "SUCCESSFUL_OPERATION"
operation_id: "create_user"
uppercase_operation_id: "CREATE_USER"
path: "/user"
HttpMethod: "Post"
httpmethod: "post"
noClientExample: true
/user/createWithArray:
post:
tags:
- "user"
summary: "Creates list of users with given input array"
description: ""
operationId: "createUsersWithArrayInput"
produces:
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "List of user object"
required: true
schema:
type: "array"
items:
$ref: "#/definitions/User"
formatString: "{:?}"
example: "&Vec::new()"
model_key: "OuterBoolean"
uppercase_operation_id: "CREATE_USERS_WITH_ARRAY_INPUT"
responses:
default:
description: "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"
HttpMethod: "Post"
httpmethod: "post"
/user/createWithList:
post:
tags:
- "user"
summary: "Creates list of users with given input array"
description: ""
operationId: "createUsersWithListInput"
produces:
- "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "List of user object"
required: true
schema:
type: "array"
items:
$ref: "#/definitions/User"
formatString: "{:?}"
example: "&Vec::new()"
model_key: "OuterBoolean"
uppercase_operation_id: "CREATE_USERS_WITH_LIST_INPUT"
responses:
default:
description: "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"
HttpMethod: "Post"
httpmethod: "post"
/user/login:
get:
tags:
- "user"
summary: "Logs user into the system"
description: ""
operationId: "loginUser"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "username"
in: "query"
description: "The user name for login"
required: true
type: "string"
formatString: "\\\"{}\\\""
example: "\"username_example\".to_string()"
- name: "password"
in: "query"
description: "The password for login in clear text"
required: true
type: "string"
formatString: "\\\"{}\\\""
example: "\"password_example\".to_string()"
responses:
200:
description: "successful operation"
schema:
type: "string"
headers:
X-Rate-Limit:
type: "integer"
format: "int32"
description: "calls per hour allowed by the user"
X-Expires-After:
type: "string"
format: "date-time"
description: "date in UTC when toekn expires"
uppercase_operation_id: "LOGIN_USER"
uppercase_message: "SUCCESSFUL_OPERATION"
uppercase_data_type: "STRING"
producesXml: true
400:
description: "Invalid username/password supplied"
uppercase_operation_id: "LOGIN_USER"
uppercase_message: "INVALID_USERNAME"
operation_id: "login_user"
uppercase_operation_id: "LOGIN_USER"
path: "/user/login"
HttpMethod: "Get"
httpmethod: "get"
/user/logout:
get:
tags:
- "user"
summary: "Logs out current logged in user session"
description: ""
operationId: "logoutUser"
produces:
- "application/xml"
- "application/json"
parameters: []
responses:
default:
description: "successful operation"
uppercase_operation_id: "LOGOUT_USER"
uppercase_message: "SUCCESSFUL_OPERATION"
operation_id: "logout_user"
uppercase_operation_id: "LOGOUT_USER"
path: "/user/logout"
HttpMethod: "Get"
httpmethod: "get"
/user/{username}:
get:
tags:
- "user"
summary: "Get user by user name"
description: ""
operationId: "getUserByName"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "username"
in: "path"
description: "The name that needs to be fetched. Use user1 for testing. "
required: true
type: "string"
formatString: "\\\"{}\\\""
example: "\"username_example\".to_string()"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/User"
uppercase_operation_id: "GET_USER_BY_NAME"
uppercase_message: "SUCCESSFUL_OPERATION"
uppercase_data_type: "USER"
producesXml: true
400:
description: "Invalid username supplied"
uppercase_operation_id: "GET_USER_BY_NAME"
uppercase_message: "INVALID_USERNAME_SUPPLIED"
404:
description: "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"
HttpMethod: "Get"
httpmethod: "get"
put:
tags:
- "user"
summary: "Updated user"
description: "This can only be done by the logged in user."
operationId: "updateUser"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "username"
in: "path"
description: "name that need to be deleted"
required: true
type: "string"
formatString: "\\\"{}\\\""
example: "\"username_example\".to_string()"
- in: "body"
name: "body"
description: "Updated user object"
required: true
schema:
$ref: "#/definitions/User"
uppercase_data_type: "USER"
refName: "User"
formatString: "{:?}"
example: "???"
model_key: "OuterBoolean"
uppercase_operation_id: "UPDATE_USER"
responses:
400:
description: "Invalid user supplied"
uppercase_operation_id: "UPDATE_USER"
uppercase_message: "INVALID_USER_SUPPLIED"
404:
description: "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"
HttpMethod: "Put"
httpmethod: "put"
noClientExample: true
delete:
tags:
- "user"
summary: "Delete user"
description: "This can only be done by the logged in user."
operationId: "deleteUser"
produces:
- "application/xml"
- "application/json"
parameters:
- name: "username"
in: "path"
description: "The name that needs to be deleted"
required: true
type: "string"
formatString: "\\\"{}\\\""
example: "\"username_example\".to_string()"
responses:
400:
description: "Invalid username supplied"
uppercase_operation_id: "DELETE_USER"
uppercase_message: "INVALID_USERNAME_SUPPLIED"
404:
description: "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"
HttpMethod: "Delete"
httpmethod: "delete"
/fake_classname_test:
patch:
tags:
- "fake_classname_tags 123#$%^"
summary: "To test class name in snake case"
operationId: "testClassname"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "client model"
required: true
schema:
$ref: "#/definitions/Client"
uppercase_data_type: "CLIENT"
refName: "Client"
formatString: "{:?}"
example: "???"
model_key: "OuterBoolean"
uppercase_operation_id: "TEST_CLASSNAME"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Client"
uppercase_operation_id: "TEST_CLASSNAME"
uppercase_message: "SUCCESSFUL_OPERATION"
uppercase_data_type: "CLIENT"
security:
- api_key_query: []
operation_id: "test_classname"
uppercase_operation_id: "TEST_CLASSNAME"
path: "/fake_classname_test"
HttpMethod: "Patch"
httpmethod: "patch"
noClientExample: true
/fake:
get:
tags:
- "fake"
summary: "To test enum parameters"
description: "To test enum parameters"
operationId: "testEnumParameters"
consumes:
- "*/*"
produces:
- "*/*"
parameters:
- name: "enum_form_string_array"
in: "formData"
description: "Form parameter enum test (string array)"
required: false
type: "array"
items:
type: "string"
enum:
- ">"
- "$"
default: "$"
formatString: "{:?}"
example: "Some(&Vec::new())"
- name: "enum_form_string"
in: "formData"
description: "Form parameter enum test (string)"
required: false
type: "string"
default: "-efg"
enum:
- "_abc"
- "-efg"
- "(xyz)"
formatString: "{:?}"
example: "Some(\"enum_form_string_example\".to_string())"
- name: "enum_header_string_array"
in: "header"
description: "Header parameter enum test (string array)"
required: false
type: "array"
items:
type: "string"
enum:
- ">"
- "$"
default: "$"
formatString: "{:?}"
example: "Some(&Vec::new())"
- name: "enum_header_string"
in: "header"
description: "Header parameter enum test (string)"
required: false
type: "string"
default: "-efg"
enum:
- "_abc"
- "-efg"
- "(xyz)"
formatString: "{:?}"
example: "Some(\"enum_header_string_example\".to_string())"
- name: "enum_query_string_array"
in: "query"
description: "Query parameter enum test (string array)"
required: false
type: "array"
items:
type: "string"
enum:
- ">"
- "$"
default: "$"
formatString: "{:?}"
example: "Some(&Vec::new())"
- name: "enum_query_string"
in: "query"
description: "Query parameter enum test (string)"
required: false
type: "string"
default: "-efg"
enum:
- "_abc"
- "-efg"
- "(xyz)"
formatString: "{:?}"
example: "Some(\"enum_query_string_example\".to_string())"
- name: "enum_query_integer"
in: "query"
description: "Query parameter enum test (double)"
required: false
type: "integer"
format: "int32"
enum:
- 1
- -2
formatString: "{:?}"
example: "Some(56)"
- name: "enum_query_double"
in: "formData"
description: "Query parameter enum test (double)"
required: false
type: "number"
format: "double"
enum:
- 1.1
- -1.2
formatString: "{:?}"
example: "Some(1.2)"
responses:
400:
description: "Invalid request"
uppercase_operation_id: "TEST_ENUM_PARAMETERS"
uppercase_message: "INVALID_REQUEST"
404:
description: "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"
HttpMethod: "Get"
httpmethod: "get"
post:
tags:
- "fake"
summary: "Fake endpoint for testing various parameters\n假端點\n偽のエンドポイント\n가짜 엔\
드 포인트\n"
description: "Fake endpoint for testing various parameters\n假端點\n偽のエンドポイント\n\
가짜 엔드 포인트\n"
operationId: "testEndpointParameters"
consumes:
- "application/xml; charset=utf-8"
- "application/json; charset=utf-8"
produces:
- "application/xml; charset=utf-8"
- "application/json; charset=utf-8"
parameters:
- name: "integer"
in: "formData"
description: "None"
required: false
type: "integer"
maximum: 100
minimum: 10
formatString: "{:?}"
example: "Some(56)"
- name: "int32"
in: "formData"
description: "None"
required: false
type: "integer"
maximum: 200
minimum: 20
format: "int32"
formatString: "{:?}"
example: "Some(56)"
- name: "int64"
in: "formData"
description: "None"
required: false
type: "integer"
format: "int64"
formatString: "{:?}"
example: "Some(789)"
- name: "number"
in: "formData"
description: "None"
required: true
type: "number"
maximum: 543.2
minimum: 32.1
formatString: "{}"
example: "3.4"
- name: "float"
in: "formData"
description: "None"
required: false
type: "number"
maximum: 987.6
format: "float"
formatString: "{:?}"
example: "Some(3.4)"
- name: "double"
in: "formData"
description: "None"
required: true
type: "number"
maximum: 123.4
minimum: 67.8
format: "double"
formatString: "{}"
example: "1.2"
- name: "string"
in: "formData"
description: "None"
required: false
type: "string"
pattern: "/[a-z]/i"
formatString: "{:?}"
example: "Some(\"string_example\".to_string())"
- name: "pattern_without_delimiter"
in: "formData"
description: "None"
required: true
type: "string"
pattern: "^[A-Z].*"
formatString: "\\\"{}\\\""
example: "\"pattern_without_delimiter_example\".to_string()"
- name: "byte"
in: "formData"
description: "None"
required: true
type: "string"
format: "byte"
formatString: "\\\"{:?}\\\""
example: "swagger::ByteArray(\"byte_example\".to_string().into_bytes())"
- name: "binary"
in: "formData"
description: "None"
required: false
type: "string"
format: "binary"
formatString: "{:?}"
example: "Some(swagger::ByteArray(Vec::from(\"B\")))"
- name: "date"
in: "formData"
description: "None"
required: false
type: "string"
format: "date"
formatString: "{:?}"
example: "None"
- name: "dateTime"
in: "formData"
description: "None"
required: false
type: "string"
format: "date-time"
formatString: "{:?}"
example: "None"
- name: "password"
in: "formData"
description: "None"
required: false
type: "string"
maxLength: 64
minLength: 10
format: "password"
formatString: "{:?}"
example: "Some(\"password_example\".to_string())"
- name: "callback"
in: "formData"
description: "None"
required: false
type: "string"
formatString: "{:?}"
example: "Some(\"callback_example\".to_string())"
responses:
400:
description: "Invalid username supplied"
uppercase_operation_id: "TEST_ENDPOINT_PARAMETERS"
uppercase_message: "INVALID_USERNAME_SUPPLIED"
404:
description: "User not found"
uppercase_operation_id: "TEST_ENDPOINT_PARAMETERS"
uppercase_message: "USER_NOT_FOUND"
security:
- http_basic_test: []
operation_id: "test_endpoint_parameters"
uppercase_operation_id: "TEST_ENDPOINT_PARAMETERS"
path: "/fake"
HttpMethod: "Post"
httpmethod: "post"
patch:
tags:
- "fake"
summary: "To test \"client\" model"
description: "To test \"client\" model"
operationId: "testClientModel"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "client model"
required: true
schema:
$ref: "#/definitions/Client"
uppercase_data_type: "CLIENT"
refName: "Client"
formatString: "{:?}"
example: "???"
model_key: "OuterBoolean"
uppercase_operation_id: "TEST_CLIENT_MODEL"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Client"
uppercase_operation_id: "TEST_CLIENT_MODEL"
uppercase_message: "SUCCESSFUL_OPERATION"
uppercase_data_type: "CLIENT"
operation_id: "test_client_model"
uppercase_operation_id: "TEST_CLIENT_MODEL"
path: "/fake"
HttpMethod: "Patch"
httpmethod: "patch"
noClientExample: true
/fake/outer/number:
post:
tags:
- "fake"
description: "Test serialization of outer number types"
operationId: "fakeOuterNumberSerialize"
parameters:
- in: "body"
name: "body"
description: "Input number as post body"
required: false
schema:
$ref: "#/definitions/OuterNumber"
uppercase_data_type: "OUTERNUMBER"
refName: "OuterNumber"
formatString: "{:?}"
example: "None"
model_key: "OuterBoolean"
uppercase_operation_id: "FAKE_OUTER_NUMBER_SERIALIZE"
responses:
200:
description: "Output number"
schema:
$ref: "#/definitions/OuterNumber"
uppercase_operation_id: "FAKE_OUTER_NUMBER_SERIALIZE"
uppercase_message: "OUTPUT_NUMBER"
uppercase_data_type: "OUTERNUMBER"
operation_id: "fake_outer_number_serialize"
uppercase_operation_id: "FAKE_OUTER_NUMBER_SERIALIZE"
path: "/fake/outer/number"
HttpMethod: "Post"
httpmethod: "post"
/fake/outer/string:
post:
tags:
- "fake"
description: "Test serialization of outer string types"
operationId: "fakeOuterStringSerialize"
parameters:
- in: "body"
name: "body"
description: "Input string as post body"
required: false
schema:
$ref: "#/definitions/OuterString"
uppercase_data_type: "OUTERSTRING"
refName: "OuterString"
formatString: "{:?}"
example: "None"
model_key: "OuterBoolean"
uppercase_operation_id: "FAKE_OUTER_STRING_SERIALIZE"
responses:
200:
description: "Output string"
schema:
$ref: "#/definitions/OuterString"
uppercase_operation_id: "FAKE_OUTER_STRING_SERIALIZE"
uppercase_message: "OUTPUT_STRING"
uppercase_data_type: "OUTERSTRING"
operation_id: "fake_outer_string_serialize"
uppercase_operation_id: "FAKE_OUTER_STRING_SERIALIZE"
path: "/fake/outer/string"
HttpMethod: "Post"
httpmethod: "post"
/fake/outer/boolean:
post:
tags:
- "fake"
description: "Test serialization of outer boolean types"
operationId: "fakeOuterBooleanSerialize"
parameters:
- in: "body"
name: "body"
description: "Input boolean as post body"
required: false
schema:
$ref: "#/definitions/OuterBoolean"
uppercase_data_type: "OUTERBOOLEAN"
refName: "OuterBoolean"
formatString: "{:?}"
example: "None"
model_key: "OuterBoolean"
uppercase_operation_id: "FAKE_OUTER_BOOLEAN_SERIALIZE"
responses:
200:
description: "Output boolean"
schema:
$ref: "#/definitions/OuterBoolean"
uppercase_operation_id: "FAKE_OUTER_BOOLEAN_SERIALIZE"
uppercase_message: "OUTPUT_BOOLEAN"
uppercase_data_type: "OUTERBOOLEAN"
operation_id: "fake_outer_boolean_serialize"
uppercase_operation_id: "FAKE_OUTER_BOOLEAN_SERIALIZE"
path: "/fake/outer/boolean"
HttpMethod: "Post"
httpmethod: "post"
/fake/outer/composite:
post:
tags:
- "fake"
description: "Test serialization of object with outer number type"
operationId: "fakeOuterCompositeSerialize"
parameters:
- in: "body"
name: "body"
description: "Input composite as post body"
required: false
schema:
$ref: "#/definitions/OuterComposite"
uppercase_data_type: "OUTERCOMPOSITE"
refName: "OuterComposite"
formatString: "{:?}"
example: "None"
model_key: "OuterBoolean"
uppercase_operation_id: "FAKE_OUTER_COMPOSITE_SERIALIZE"
responses:
200:
description: "Output composite"
schema:
$ref: "#/definitions/OuterComposite"
uppercase_operation_id: "FAKE_OUTER_COMPOSITE_SERIALIZE"
uppercase_message: "OUTPUT_COMPOSITE"
uppercase_data_type: "OUTERCOMPOSITE"
operation_id: "fake_outer_composite_serialize"
uppercase_operation_id: "FAKE_OUTER_COMPOSITE_SERIALIZE"
path: "/fake/outer/composite"
HttpMethod: "Post"
httpmethod: "post"
/fake/jsonFormData:
get:
tags:
- "fake"
summary: "test json serialization of form data"
description: ""
operationId: "testJsonFormData"
consumes:
- "application/json"
parameters:
- name: "param"
in: "formData"
description: "field1"
required: true
type: "string"
formatString: "\\\"{}\\\""
example: "\"param_example\".to_string()"
- name: "param2"
in: "formData"
description: "field2"
required: true
type: "string"
formatString: "\\\"{}\\\""
example: "\"param2_example\".to_string()"
responses:
200:
description: "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"
HttpMethod: "Get"
httpmethod: "get"
/fake/inline-additionalProperties:
post:
tags:
- "fake"
summary: "test inline additionalProperties"
description: ""
operationId: "testInlineAdditionalProperties"
consumes:
- "application/json"
parameters:
- in: "body"
name: "param"
description: "request body"
required: true
schema:
type: "object"
additionalProperties:
type: "string"
upperCaseName: "PARAM"
refName: null
formatString: "{:?}"
example: "???"
model_key: "OuterBoolean"
uppercase_operation_id: "TEST_INLINE_ADDITIONAL_PROPERTIES"
responses:
200:
description: "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"
HttpMethod: "Post"
httpmethod: "post"
noClientExample: true
/another-fake/dummy:
patch:
tags:
- "$another-fake?"
summary: "To test special tags"
description: "To test special tags"
operationId: "test_special_tags"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "body"
description: "client model"
required: true
schema:
$ref: "#/definitions/Client"
uppercase_data_type: "CLIENT"
refName: "Client"
formatString: "{:?}"
example: "???"
model_key: "OuterBoolean"
uppercase_operation_id: "TEST_SPECIAL_TAGS"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Client"
uppercase_operation_id: "TEST_SPECIAL_TAGS"
uppercase_message: "SUCCESSFUL_OPERATION"
uppercase_data_type: "CLIENT"
operation_id: "test_special_tags"
uppercase_operation_id: "TEST_SPECIAL_TAGS"
path: "/another-fake/dummy"
HttpMethod: "Patch"
httpmethod: "patch"
noClientExample: true
securityDefinitions:
petstore_auth:
type: "oauth2"
authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog"
flow: "implicit"
scopes:
write:pets: "modify pets in your account"
read:pets: "read your pets"
api_key:
type: "apiKey"
name: "api_key"
in: "header"
api_key_query:
type: "apiKey"
name: "api_key_query"
in: "query"
http_basic_test:
type: "basic"
definitions:
Order:
type: "object"
properties:
id:
type: "integer"
format: "int64"
petId:
type: "integer"
format: "int64"
quantity:
type: "integer"
format: "int32"
shipDate:
type: "string"
format: "date-time"
status:
type: "string"
description: "Order Status"
enum:
- "placed"
- "approved"
- "delivered"
complete:
type: "boolean"
default: false
example:
petId: 6
quantity: 1
id: 0
shipDate: "2000-01-23T04:56:07.000+00:00"
complete: false
status: "placed"
xml:
name: "Order"
upperCaseName: "ORDER"
Category:
type: "object"
properties:
id:
type: "integer"
format: "int64"
name:
type: "string"
example:
name: "name"
id: 6
xml:
name: "Category"
upperCaseName: "CATEGORY"
User:
type: "object"
properties:
id:
type: "integer"
format: "int64"
x-is-unique: true
username:
type: "string"
firstName:
type: "string"
lastName:
type: "string"
email:
type: "string"
password:
type: "string"
phone:
type: "string"
userStatus:
type: "integer"
format: "int32"
description: "User Status"
example:
firstName: "firstName"
lastName: "lastName"
password: "password"
userStatus: 6
phone: "phone"
id: 0
email: "email"
username: "username"
xml:
name: "User"
upperCaseName: "USER"
Tag:
type: "object"
properties:
id:
type: "integer"
format: "int64"
name:
type: "string"
example:
name: "name"
id: 1
xml:
name: "Tag"
upperCaseName: "TAG"
Pet:
type: "object"
required:
- "name"
- "photoUrls"
properties:
id:
type: "integer"
format: "int64"
x-is-unique: true
category:
$ref: "#/definitions/Category"
name:
type: "string"
example: "doggie"
photoUrls:
type: "array"
xml:
name: "photoUrl"
wrapped: true
items:
type: "string"
tags:
type: "array"
xml:
name: "tag"
wrapped: true
items:
$ref: "#/definitions/Tag"
status:
type: "string"
description: "pet status in the store"
enum:
- "available"
- "pending"
- "sold"
example:
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"
ApiResponse:
type: "object"
properties:
code:
type: "integer"
format: "int32"
type:
type: "string"
message:
type: "string"
example:
code: 0
type: "type"
message: "message"
upperCaseName: "APIRESPONSE"
$special[model.name]:
properties:
$special[property.name]:
type: "integer"
format: "int64"
xml:
name: "$special[model.name]"
upperCaseName: "$SPECIAL[MODEL.NAME]"
Return:
properties:
return:
type: "integer"
format: "int32"
description: "Model for testing reserved words"
xml:
name: "Return"
upperCaseName: "RETURN"
Name:
required:
- "name"
properties:
name:
type: "integer"
format: "int32"
snake_case:
type: "integer"
format: "int32"
readOnly: true
property:
type: "string"
123Number:
type: "integer"
readOnly: true
description: "Model for testing model name same as property name"
xml:
name: "Name"
upperCaseName: "NAME"
200_response:
properties:
name:
type: "integer"
format: "int32"
class:
type: "string"
description: "Model for testing model name starting with number"
xml:
name: "Name"
upperCaseName: "200_RESPONSE"
ClassModel:
properties:
_class:
type: "string"
description: "Model for testing model with \"_class\" property"
upperCaseName: "CLASSMODEL"
Dog:
allOf:
- $ref: "#/definitions/Animal"
- type: "object"
properties:
breed:
type: "string"
upperCaseName: "DOG"
Cat:
allOf:
- $ref: "#/definitions/Animal"
- type: "object"
properties:
declawed:
type: "boolean"
upperCaseName: "CAT"
Animal:
type: "object"
required:
- "className"
discriminator: "className"
properties:
className:
type: "string"
color:
type: "string"
default: "red"
upperCaseName: "ANIMAL"
AnimalFarm:
type: "array"
items:
$ref: "#/definitions/Animal"
upperCaseName: "ANIMALFARM"
format_test:
type: "object"
required:
- "byte"
- "date"
- "number"
- "password"
properties:
integer:
type: "integer"
minimum: 10
maximum: 100
int32:
type: "integer"
format: "int32"
minimum: 20
maximum: 200
int64:
type: "integer"
format: "int64"
number:
type: "number"
minimum: 32.1
maximum: 543.2
float:
type: "number"
format: "float"
minimum: 54.3
maximum: 987.6
double:
type: "number"
format: "double"
minimum: 67.8
maximum: 123.4
string:
type: "string"
pattern: "/[a-z]/i"
byte:
type: "string"
format: "byte"
pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"
binary:
type: "string"
format: "binary"
date:
type: "string"
format: "date"
dateTime:
type: "string"
format: "date-time"
uuid:
type: "string"
format: "uuid"
password:
type: "string"
format: "password"
minLength: 10
maxLength: 64
upperCaseName: "FORMAT_TEST"
EnumClass:
type: "string"
enum:
- "_abc"
- "-efg"
- "(xyz)"
default: "-efg"
upperCaseName: "ENUMCLASS"
Enum_Test:
type: "object"
properties:
enum_string:
type: "string"
enum:
- "UPPER"
- "lower"
- ""
enum_integer:
type: "integer"
format: "int32"
enum:
- 1
- -1
enum_number:
type: "number"
format: "double"
enum:
- 1.1
- -1.2
outerEnum:
$ref: "#/definitions/OuterEnum"
upperCaseName: "ENUM_TEST"
AdditionalPropertiesClass:
type: "object"
properties:
map_property:
type: "object"
additionalProperties:
type: "string"
map_of_map_property:
type: "object"
additionalProperties:
type: "object"
additionalProperties:
type: "string"
upperCaseName: "ADDITIONALPROPERTIESCLASS"
MixedPropertiesAndAdditionalPropertiesClass:
type: "object"
properties:
uuid:
type: "string"
format: "uuid"
dateTime:
type: "string"
format: "date-time"
map:
type: "object"
additionalProperties:
$ref: "#/definitions/Animal"
upperCaseName: "MIXEDPROPERTIESANDADDITIONALPROPERTIESCLASS"
List:
type: "object"
properties:
123-list:
type: "string"
upperCaseName: "LIST"
Client:
type: "object"
properties:
client:
type: "string"
example:
client: "client"
upperCaseName: "CLIENT"
ReadOnlyFirst:
type: "object"
properties:
bar:
type: "string"
readOnly: true
baz:
type: "string"
upperCaseName: "READONLYFIRST"
hasOnlyReadOnly:
type: "object"
properties:
bar:
type: "string"
readOnly: true
foo:
type: "string"
readOnly: true
upperCaseName: "HASONLYREADONLY"
Capitalization:
type: "object"
properties:
smallCamel:
type: "string"
CapitalCamel:
type: "string"
small_Snake:
type: "string"
Capital_Snake:
type: "string"
SCA_ETH_Flow_Points:
type: "string"
ATT_NAME:
type: "string"
description: "Name of the pet\n"
upperCaseName: "CAPITALIZATION"
MapTest:
type: "object"
properties:
map_map_of_string:
type: "object"
additionalProperties:
type: "object"
additionalProperties:
type: "string"
map_of_enum_string:
type: "object"
additionalProperties:
type: "string"
enum:
- "UPPER"
- "lower"
upperCaseName: "MAPTEST"
ArrayTest:
type: "object"
properties:
array_of_string:
type: "array"
items:
type: "string"
array_array_of_integer:
type: "array"
items:
type: "array"
items:
type: "integer"
format: "int64"
array_array_of_model:
type: "array"
items:
type: "array"
items:
$ref: "#/definitions/ReadOnlyFirst"
upperCaseName: "ARRAYTEST"
NumberOnly:
type: "object"
properties:
JustNumber:
type: "number"
upperCaseName: "NUMBERONLY"
ArrayOfNumberOnly:
type: "object"
properties:
ArrayNumber:
type: "array"
items:
type: "number"
upperCaseName: "ARRAYOFNUMBERONLY"
ArrayOfArrayOfNumberOnly:
type: "object"
properties:
ArrayArrayNumber:
type: "array"
items:
type: "array"
items:
type: "number"
upperCaseName: "ARRAYOFARRAYOFNUMBERONLY"
EnumArrays:
type: "object"
properties:
just_symbol:
type: "string"
enum:
- ">="
- "$"
array_enum:
type: "array"
items:
type: "string"
enum:
- "fish"
- "crab"
upperCaseName: "ENUMARRAYS"
OuterEnum:
type: "string"
enum:
- "placed"
- "approved"
- "delivered"
upperCaseName: "OUTERENUM"
OuterComposite:
type: "object"
properties:
my_number:
$ref: "#/definitions/OuterNumber"
my_string:
$ref: "#/definitions/OuterString"
my_boolean:
$ref: "#/definitions/OuterBoolean"
example:
my_string: {}
my_number: {}
my_boolean: {}
upperCaseName: "OUTERCOMPOSITE"
OuterNumber:
type: "number"
upperCaseName: "OUTERNUMBER"
OuterString:
type: "string"
upperCaseName: "OUTERSTRING"
OuterBoolean:
type: "boolean"
upperCaseName: "OUTERBOOLEAN"
externalDocs:
description: "Find out more about Swagger"
url: "http://swagger.io"