Benjamin Gill a9961a062a [rust-server] Drop file support (#547)
* [rust-server] drop 'file' support

In swagger v2, we had 'binary', 'byte', and 'file'. OpenAPI v3 only has
the former two. This commit drops the old 'file' handling. This has the
side-effect of removing a half-complete implementation of form parameter handling.

This removes the ability to send files as streams, so will make life
harder for those wishing to send large files without running out of
memory.

* Remove all remaining uses of `hasFile`
2018-07-23 18:46:35 +08:00

1527 lines
37 KiB
YAML

openapi: 3.0.1
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:
" \'
license:
name: Apache-2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
title: OpenAPI Petstore
version: 1.0.0
servers:
- url: http://petstore.swagger.io:80/v2
tags:
- description: Everything about your Pets
name: pet
- description: Access to Petstore orders
name: store
- description: Operations about user
name: user
paths:
/pet:
post:
operationId: addPet
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
$ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
required: true
responses:
405:
content: {}
description: Invalid input
security:
- petstore_auth:
- write:pets
- read:pets
summary: Add a new pet to the store
tags:
- pet
put:
operationId: updatePet
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
$ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
required: true
responses:
400:
content: {}
description: Invalid ID supplied
404:
content: {}
description: Pet not found
405:
content: {}
description: Validation exception
security:
- petstore_auth:
- write:pets
- read:pets
summary: Update an existing pet
tags:
- pet
/pet/findByStatus:
get:
description: Multiple status values can be provided with comma separated strings
operationId: findPetsByStatus
parameters:
- description: Status values that need to be considered for filter
explode: false
in: query
name: status
required: true
schema:
items:
default: available
enum:
- available
- pending
- sold
type: string
type: array
style: form
responses:
200:
content:
application/xml:
schema:
items:
$ref: '#/components/schemas/Pet'
type: array
application/json:
schema:
items:
$ref: '#/components/schemas/Pet'
type: array
description: successful operation
400:
content: {}
description: Invalid status value
security:
- petstore_auth:
- write:pets
- read:pets
summary: Finds Pets by status
tags:
- pet
/pet/findByTags:
get:
deprecated: true
description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
operationId: findPetsByTags
parameters:
- description: Tags to filter by
explode: false
in: query
name: tags
required: true
schema:
items:
type: string
type: array
style: form
responses:
200:
content:
application/xml:
schema:
items:
$ref: '#/components/schemas/Pet'
type: array
application/json:
schema:
items:
$ref: '#/components/schemas/Pet'
type: array
description: successful operation
400:
content: {}
description: Invalid tag value
security:
- petstore_auth:
- write:pets
- read:pets
summary: Finds Pets by tags
tags:
- pet
/pet/{petId}:
delete:
operationId: deletePet
parameters:
- in: header
name: api_key
schema:
type: string
- description: Pet id to delete
in: path
name: petId
required: true
schema:
format: int64
type: integer
responses:
400:
content: {}
description: Invalid pet value
security:
- petstore_auth:
- write:pets
- read:pets
summary: Deletes a pet
tags:
- pet
get:
description: Returns a single pet
operationId: getPetById
parameters:
- description: ID of pet to return
in: path
name: petId
required: true
schema:
format: int64
type: integer
responses:
200:
content:
application/xml:
schema:
$ref: '#/components/schemas/Pet'
application/json:
schema:
$ref: '#/components/schemas/Pet'
description: successful operation
400:
content: {}
description: Invalid ID supplied
404:
content: {}
description: Pet not found
security:
- api_key: []
summary: Find pet by ID
tags:
- pet
post:
operationId: updatePetWithForm
parameters:
- description: ID of pet that needs to be updated
in: path
name: petId
required: true
schema:
format: int64
type: integer
requestBody:
content:
application/x-www-form-urlencoded:
schema:
properties:
name:
description: Updated name of the pet
type: string
status:
description: Updated status of the pet
type: string
responses:
405:
content: {}
description: Invalid input
security:
- petstore_auth:
- write:pets
- read:pets
summary: Updates a pet in the store with form data
tags:
- pet
/pet/{petId}/uploadImage:
post:
operationId: uploadFile
parameters:
- description: ID of pet to update
in: path
name: petId
required: true
schema:
format: int64
type: integer
requestBody:
content:
multipart/form-data:
schema:
properties:
additionalMetadata:
description: Additional data to pass to server
type: string
file:
description: file to upload
format: binary
type: string
responses:
200:
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
description: successful operation
security:
- petstore_auth:
- write:pets
- read:pets
summary: uploads an image
tags:
- pet
/store/inventory:
get:
description: Returns a map of status codes to quantities
operationId: getInventory
responses:
200:
content:
application/json:
schema:
additionalProperties:
format: int32
type: integer
type: object
description: successful operation
security:
- api_key: []
summary: Returns pet inventories by status
tags:
- store
/store/order:
post:
operationId: placeOrder
requestBody:
content:
'*/*':
schema:
$ref: '#/components/schemas/Order'
description: order placed for purchasing the pet
required: true
responses:
200:
content:
application/xml:
schema:
$ref: '#/components/schemas/Order'
application/json:
schema:
$ref: '#/components/schemas/Order'
description: successful operation
400:
content: {}
description: Invalid Order
summary: Place an order for a pet
tags:
- store
/store/order/{order_id}:
delete:
description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
operationId: deleteOrder
parameters:
- description: ID of the order that needs to be deleted
in: path
name: order_id
required: true
schema:
type: string
responses:
400:
content: {}
description: Invalid ID supplied
404:
content: {}
description: Order not found
summary: Delete purchase order by ID
tags:
- store
get:
description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
operationId: getOrderById
parameters:
- description: ID of pet that needs to be fetched
in: path
name: order_id
required: true
schema:
format: int64
maximum: 5
minimum: 1
type: integer
responses:
200:
content:
application/xml:
schema:
$ref: '#/components/schemas/Order'
application/json:
schema:
$ref: '#/components/schemas/Order'
description: successful operation
400:
content: {}
description: Invalid ID supplied
404:
content: {}
description: Order not found
summary: Find purchase order by ID
tags:
- store
/user:
post:
description: This can only be done by the logged in user.
operationId: createUser
requestBody:
content:
'*/*':
schema:
$ref: '#/components/schemas/User'
description: Created user object
required: true
responses:
default:
content: {}
description: successful operation
summary: Create user
tags:
- user
/user/createWithArray:
post:
operationId: createUsersWithArrayInput
requestBody:
content:
'*/*':
schema:
items:
$ref: '#/components/schemas/User'
type: array
description: List of user object
required: true
responses:
default:
content: {}
description: successful operation
summary: Creates list of users with given input array
tags:
- user
/user/createWithList:
post:
operationId: createUsersWithListInput
requestBody:
content:
'*/*':
schema:
items:
$ref: '#/components/schemas/User'
type: array
description: List of user object
required: true
responses:
default:
content: {}
description: successful operation
summary: Creates list of users with given input array
tags:
- user
/user/login:
get:
operationId: loginUser
parameters:
- description: The user name for login
in: query
name: username
required: true
schema:
type: string
- description: The password for login in clear text
in: query
name: password
required: true
schema:
type: string
responses:
200:
content:
application/xml:
schema:
type: string
application/json:
schema:
type: string
description: successful operation
headers:
X-Rate-Limit:
description: calls per hour allowed by the user
schema:
format: int32
type: integer
X-Expires-After:
description: date in UTC when token expires
schema:
format: date-time
type: string
400:
content: {}
description: Invalid username/password supplied
summary: Logs user into the system
tags:
- user
/user/logout:
get:
operationId: logoutUser
responses:
default:
content: {}
description: successful operation
summary: Logs out current logged in user session
tags:
- user
/user/{username}:
delete:
description: This can only be done by the logged in user.
operationId: deleteUser
parameters:
- description: The name that needs to be deleted
in: path
name: username
required: true
schema:
type: string
responses:
400:
content: {}
description: Invalid username supplied
404:
content: {}
description: User not found
summary: Delete user
tags:
- user
get:
operationId: getUserByName
parameters:
- description: The name that needs to be fetched. Use user1 for testing.
in: path
name: username
required: true
schema:
type: string
responses:
200:
content:
application/xml:
schema:
$ref: '#/components/schemas/User'
application/json:
schema:
$ref: '#/components/schemas/User'
description: successful operation
400:
content: {}
description: Invalid username supplied
404:
content: {}
description: User not found
summary: Get user by user name
tags:
- user
put:
description: This can only be done by the logged in user.
operationId: updateUser
parameters:
- description: name that need to be deleted
in: path
name: username
required: true
schema:
type: string
requestBody:
content:
'*/*':
schema:
$ref: '#/components/schemas/User'
description: Updated user object
required: true
responses:
400:
content: {}
description: Invalid user supplied
404:
content: {}
description: User not found
summary: Updated user
tags:
- user
/fake_classname_test:
patch:
description: To test class name in snake case
operationId: testClassname
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Client'
description: client model
required: true
responses:
200:
content:
application/json:
schema:
$ref: '#/components/schemas/Client'
description: successful operation
security:
- api_key_query: []
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
/fake:
get:
description: To test enum parameters
operationId: testEnumParameters
parameters:
- description: Header parameter enum test (string array)
explode: false
in: header
name: enum_header_string_array
schema:
items:
default: $
enum:
- '>'
- $
type: string
type: array
style: simple
- description: Header parameter enum test (string)
in: header
name: enum_header_string
schema:
default: -efg
enum:
- _abc
- -efg
- (xyz)
type: string
- description: Query parameter enum test (string array)
explode: false
in: query
name: enum_query_string_array
schema:
items:
default: $
enum:
- '>'
- $
type: string
type: array
style: form
- description: Query parameter enum test (string)
in: query
name: enum_query_string
schema:
default: -efg
enum:
- _abc
- -efg
- (xyz)
type: string
- description: Query parameter enum test (double)
in: query
name: enum_query_integer
schema:
enum:
- 1
- -2
format: int32
type: integer
- description: Query parameter enum test (double)
in: query
name: enum_query_double
schema:
enum:
- 1.1
- -1.2
format: double
type: number
requestBody:
content:
application/x-www-form-urlencoded:
schema:
properties:
enum_form_string:
default: -efg
description: Form parameter enum test (string)
enum:
- _abc
- -efg
- (xyz)
type: string
responses:
400:
content: {}
description: Invalid request
404:
content: {}
description: Not found
summary: To test enum parameters
tags:
- fake
patch:
description: To test "client" model
operationId: testClientModel
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Client'
description: client model
required: true
responses:
200:
content:
application/json:
schema:
$ref: '#/components/schemas/Client'
description: successful operation
summary: To test "client" model
tags:
- fake
post:
description: |
Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
operationId: testEndpointParameters
requestBody:
content:
application/x-www-form-urlencoded:
schema:
properties:
integer:
description: None
maximum: 100
minimum: 10
type: integer
int32:
description: None
format: int32
maximum: 200
minimum: 20
type: integer
int64:
description: None
format: int64
type: integer
number:
description: None
maximum: 543.2
minimum: 32.1
type: number
float:
description: None
format: float
maximum: 987.6
type: number
double:
description: None
format: double
maximum: 123.4
minimum: 67.8
type: number
string:
description: None
pattern: /[a-z]/i
type: string
pattern_without_delimiter:
description: None
pattern: ^[A-Z].*
type: string
byte:
description: None
format: byte
type: string
binary:
description: None
format: binary
type: string
date:
description: None
format: date
type: string
dateTime:
description: None
format: date-time
type: string
password:
description: None
format: password
maxLength: 64
minLength: 10
type: string
callback:
description: None
type: string
required:
- byte
- double
- number
- pattern_without_delimiter
required: true
responses:
400:
content: {}
description: Invalid username supplied
404:
content: {}
description: User not found
security:
- http_basic_test: []
summary: |
Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
tags:
- fake
/fake/outer/number:
post:
description: Test serialization of outer number types
operationId: fakeOuterNumberSerialize
requestBody:
content:
'*/*':
schema:
$ref: '#/components/schemas/OuterNumber'
description: Input number as post body
required: false
responses:
200:
content:
'*/*':
schema:
$ref: '#/components/schemas/OuterNumber'
description: Output number
tags:
- fake
/fake/outer/string:
post:
description: Test serialization of outer string types
operationId: fakeOuterStringSerialize
requestBody:
content:
'*/*':
schema:
$ref: '#/components/schemas/OuterString'
description: Input string as post body
required: false
responses:
200:
content:
'*/*':
schema:
$ref: '#/components/schemas/OuterString'
description: Output string
tags:
- fake
/fake/outer/boolean:
post:
description: Test serialization of outer boolean types
operationId: fakeOuterBooleanSerialize
requestBody:
content:
'*/*':
schema:
$ref: '#/components/schemas/OuterBoolean'
description: Input boolean as post body
required: false
responses:
200:
content:
'*/*':
schema:
$ref: '#/components/schemas/OuterBoolean'
description: Output boolean
tags:
- fake
/fake/outer/composite:
post:
description: Test serialization of object with outer number type
operationId: fakeOuterCompositeSerialize
requestBody:
content:
'*/*':
schema:
$ref: '#/components/schemas/OuterComposite'
description: Input composite as post body
required: false
responses:
200:
content:
'*/*':
schema:
$ref: '#/components/schemas/OuterComposite'
description: Output composite
tags:
- fake
/fake/jsonFormData:
get:
operationId: testJsonFormData
requestBody:
content:
application/x-www-form-urlencoded:
schema:
properties:
param:
description: field1
type: string
param2:
description: field2
type: string
required:
- param
- param2
required: true
responses:
200:
content: {}
description: successful operation
summary: test json serialization of form data
tags:
- fake
/fake/inline-additionalProperties:
post:
operationId: testInlineAdditionalProperties
requestBody:
content:
application/json:
schema:
additionalProperties:
type: string
type: object
description: request body
required: true
responses:
200:
content: {}
description: successful operation
summary: test inline additionalProperties
tags:
- fake
/fake/body-with-query-params:
put:
operationId: testBodyWithQueryParams
parameters:
- in: query
name: query
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/User'
required: true
responses:
200:
content: {}
description: Success
tags:
- fake
/another-fake/dummy:
patch:
description: To test special tags
operationId: test_special_tags
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Client'
description: client model
required: true
responses:
200:
content:
application/json:
schema:
$ref: '#/components/schemas/Client'
description: successful operation
summary: To test special tags
tags:
- $another-fake?
components:
schemas:
Category:
example:
name: name
id: 6
properties:
id:
format: int64
type: integer
name:
type: string
type: object
xml:
name: Category
User:
example:
firstName: firstName
lastName: lastName
password: password
userStatus: 6
phone: phone
id: 0
email: email
username: username
properties:
id:
format: int64
type: integer
x-is-unique: true
username:
type: string
firstName:
type: string
lastName:
type: string
email:
type: string
password:
type: string
phone:
type: string
userStatus:
description: User Status
format: int32
type: integer
type: object
xml:
name: User
OuterNumber:
type: number
ArrayOfNumberOnly:
properties:
ArrayNumber:
items:
type: number
type: array
type: object
Capitalization:
properties:
smallCamel:
type: string
CapitalCamel:
type: string
small_Snake:
type: string
Capital_Snake:
type: string
SCA_ETH_Flow_Points:
type: string
ATT_NAME:
description: |
Name of the pet
type: string
type: object
MixedPropertiesAndAdditionalPropertiesClass:
properties:
uuid:
format: uuid
type: string
dateTime:
format: date-time
type: string
map:
additionalProperties:
$ref: '#/components/schemas/Animal'
type: object
type: object
ApiResponse:
example:
code: 0
type: type
message: message
properties:
code:
format: int32
type: integer
type:
type: string
message:
type: string
type: object
Name:
description: Model for testing model name same as property name
properties:
name:
format: int32
type: integer
snake_case:
format: int32
readOnly: true
type: integer
property:
type: string
123Number:
readOnly: true
type: integer
required:
- name
type: object
xml:
name: Name
EnumClass:
default: -efg
enum:
- _abc
- -efg
- (xyz)
type: string
List:
properties:
123-list:
type: string
type: object
NumberOnly:
properties:
JustNumber:
type: number
type: object
200_response:
description: Model for testing model name starting with number
properties:
name:
format: int32
type: integer
class:
type: string
type: object
xml:
name: Name
Client:
example:
client: client
properties:
client:
type: string
type: object
Dog:
allOf:
- $ref: '#/components/schemas/Animal'
- properties:
breed:
type: string
type: object
Enum_Test:
properties:
enum_string:
enum:
- UPPER
- lower
- ""
type: string
enum_string_required:
enum:
- UPPER
- lower
- ""
type: string
enum_integer:
enum:
- 1
- -1
format: int32
type: integer
enum_number:
enum:
- 1.1
- -1.2
format: double
type: number
outerEnum:
$ref: '#/components/schemas/OuterEnum'
required:
- enum_string_required
type: object
Order:
example:
petId: 6
quantity: 1
id: 0
shipDate: 2000-01-23T04:56:07.000+00:00
complete: false
status: placed
properties:
id:
format: int64
type: integer
petId:
format: int64
type: integer
quantity:
format: int32
type: integer
shipDate:
format: date-time
type: string
status:
description: Order Status
enum:
- placed
- approved
- delivered
type: string
complete:
default: false
type: boolean
type: object
xml:
name: Order
AdditionalPropertiesClass:
properties:
map_property:
additionalProperties:
type: string
type: object
map_of_map_property:
additionalProperties:
additionalProperties:
type: string
type: object
type: object
type: object
$special[model.name]:
properties:
$special[property.name]:
format: int64
type: integer
type: object
xml:
name: $special[model.name]
Return:
description: Model for testing reserved words
properties:
return:
format: int32
type: integer
type: object
xml:
name: Return
ReadOnlyFirst:
properties:
bar:
readOnly: true
type: string
baz:
type: string
type: object
ArrayOfArrayOfNumberOnly:
properties:
ArrayArrayNumber:
items:
items:
type: number
type: array
type: array
type: object
OuterEnum:
enum:
- placed
- approved
- delivered
type: string
ArrayTest:
properties:
array_of_string:
items:
type: string
type: array
array_array_of_integer:
items:
items:
format: int64
type: integer
type: array
type: array
array_array_of_model:
items:
items:
$ref: '#/components/schemas/ReadOnlyFirst'
type: array
type: array
array_of_enum:
items:
enum:
- UPPER
- lower
type: string
type: array
type: object
OuterComposite:
example:
my_string: my_string
my_number: 0.80082819046101150206595775671303272247314453125
my_boolean: true
properties:
my_number:
type: number
my_string:
type: string
my_boolean:
type: boolean
x-codegen-body-parameter-name: boolean_post_body
type: object
format_test:
properties:
integer:
maximum: 1E+2
minimum: 1E+1
type: integer
int32:
format: int32
maximum: 2E+2
minimum: 2E+1
type: integer
int64:
format: int64
type: integer
number:
maximum: 543.2
minimum: 32.1
type: number
float:
format: float
maximum: 987.6
minimum: 54.3
type: number
double:
format: double
maximum: 123.4
minimum: 67.8
type: number
string:
pattern: /[a-z]/i
type: string
byte:
format: byte
pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$
type: string
binary:
format: binary
type: string
date:
format: date
type: string
dateTime:
format: date-time
type: string
uuid:
format: uuid
type: string
password:
format: password
maxLength: 64
minLength: 10
type: string
required:
- byte
- date
- number
- password
type: object
EnumArrays:
properties:
just_symbol:
enum:
- '>='
- $
type: string
array_enum:
items:
enum:
- fish
- crab
type: string
type: array
array_array_enum:
items:
items:
enum:
- Cat
- Dog
type: string
type: array
type: array
type: object
OuterString:
type: string
ClassModel:
description: Model for testing model with "_class" property
properties:
_class:
type: string
type: object
OuterBoolean:
type: boolean
x-codegen-body-parameter-name: boolean_post_body
Animal:
discriminator:
propertyName: className
properties:
className:
type: string
color:
default: red
type: string
required:
- className
type: object
Cat:
allOf:
- $ref: '#/components/schemas/Animal'
- properties:
declawed:
type: boolean
type: object
MapTest:
properties:
map_map_of_string:
additionalProperties:
additionalProperties:
type: string
type: object
type: object
map_map_of_enum:
additionalProperties:
additionalProperties:
enum:
- UPPER
- lower
type: string
type: object
type: object
map_of_enum_string:
additionalProperties:
enum:
- UPPER
- lower
type: string
type: object
type: object
Tag:
example:
name: name
id: 1
properties:
id:
format: int64
type: integer
name:
type: string
type: object
xml:
name: Tag
AnimalFarm:
items:
$ref: '#/components/schemas/Animal'
type: array
Pet:
example:
photoUrls:
- photoUrls
- photoUrls
name: doggie
id: 0
category:
name: name
id: 6
tags:
- name: name
id: 1
- name: name
id: 1
status: available
properties:
id:
format: int64
type: integer
x-is-unique: true
category:
$ref: '#/components/schemas/Category'
name:
example: doggie
type: string
photoUrls:
items:
type: string
type: array
xml:
name: photoUrl
wrapped: true
tags:
items:
$ref: '#/components/schemas/Tag'
type: array
xml:
name: tag
wrapped: true
status:
description: pet status in the store
enum:
- available
- pending
- sold
type: string
required:
- name
- photoUrls
type: object
xml:
name: Pet
hasOnlyReadOnly:
properties:
bar:
readOnly: true
type: string
foo:
readOnly: true
type: string
type: object
securitySchemes:
petstore_auth:
flows:
implicit:
authorizationUrl: http://petstore.swagger.io/api/oauth/dialog
scopes:
write:pets: modify pets in your account
read:pets: read your pets
type: oauth2
http_basic_test:
scheme: basic
type: http
api_key:
in: header
name: api_key
type: apiKey
api_key_query:
in: query
name: api_key_query
type: apiKey