2024-06-26 10:04:23 +08:00

1419 lines
34 KiB
YAML

openapi: 3.0.0
info:
description: "This is a sample server Petstore server. For this sample, you can\
\ use the api key `special-key` to test the authorization filters."
license:
name: Apache-2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
title: OpenAPI Petstore
version: 1.0.0
externalDocs:
description: Find out more about Swagger
url: http://swagger.io
servers:
- url: http://petstore.swagger.io/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:
description: ""
operationId: addPet
requestBody:
$ref: '#/components/requestBodies/Pet'
responses:
"200":
content:
application/xml:
schema:
$ref: '#/components/schemas/Pet'
application/json:
schema:
$ref: '#/components/schemas/Pet'
description: successful operation
"405":
description: Invalid input
security:
- petstore_auth:
- write:pets
- read:pets
summary: Add a new pet to the store
tags:
- pet
put:
description: ""
externalDocs:
description: API documentation for the updatePet operation
url: http://petstore.swagger.io/v2/doc/updatePet
operationId: updatePet
requestBody:
$ref: '#/components/requestBodies/Pet'
responses:
"200":
content:
application/xml:
schema:
$ref: '#/components/schemas/Pet'
application/json:
schema:
$ref: '#/components/schemas/Pet'
description: successful operation
"400":
description: Invalid ID supplied
"404":
description: Pet not found
"405":
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: Entity type
explode: false
in: path
name: inlineEnumPath
required: false
schema:
enum:
- OPTION_1
- OPTION_2
- OPTION_3
type: string
style: simple
- description: Entity type
explode: true
in: query
name: inlineEnum
required: false
schema:
enum:
- OPTION_1
- OPTION_2
- OPTION_3
type: string
style: form
- explode: true
in: query
name: defaultInt
required: false
schema:
default: 1
type: integer
style: form
- explode: true
in: query
name: defaultNum
required: false
schema:
default: 1.5
type: number
style: form
- explode: true
in: query
name: defaultStr
required: false
schema:
default: default
type: string
style: form
- deprecated: true
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":
description: Invalid status value
security:
- petstore_auth:
- read:pets
summary: Finds Pets by status
tags:
- pet
/pet/searchPetWithManyFilters:
get:
description: Search endpoint
operationId: searchPet
parameters:
- description: age of the pet
explode: true
in: query
name: age
required: false
schema:
format: int64
nullable: true
type: integer
style: form
- description: Price of the pet
explode: true
in: query
name: price
required: false
schema:
nullable: true
type: number
style: form
- description: Find pets born after this date
explode: false
in: query
name: bornAfter
required: false
schema:
format: date-time
nullable: true
type: string
style: form
- description: Is the pet classified as old
explode: true
in: query
name: old
required: false
schema:
nullable: true
type: boolean
style: form
responses:
"200":
content:
application/xml:
schema:
items:
$ref: '#/components/schemas/Pet'
type: array
description: successful operation
summary: Search Pets by filters
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
- description: Find pets born after this date
explode: false
in: query
name: bornAfter
required: true
schema:
format: date-time
type: string
style: form
- description: Find pets born before this date
explode: false
in: query
name: bornBefore
required: false
schema:
format: date-time
type: string
style: form
- explode: true
in: query
name: colour
required: false
schema:
$ref: '#/components/schemas/Colour'
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":
description: Invalid tag value
security:
- petstore_auth:
- read:pets
summary: Finds Pets by tags
tags:
- pet
/pet/filterPets/{gender}:
get:
operationId: filterPetsByCategory
parameters:
- explode: false
in: path
name: gender
required: true
schema:
$ref: '#/components/schemas/Gender'
style: simple
- description: Species to filter by
explode: false
in: query
name: species
required: true
schema:
$ref: '#/components/schemas/Species'
style: form
- description: Species to omit from results
explode: false
in: query
name: notSpecies
required: false
schema:
items:
$ref: '#/components/schemas/Species'
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":
description: Invalid species value
summary: Finds Pets
tags:
- pet
/pet/{petId}:
delete:
description: ""
operationId: deletePet
parameters:
- explode: false
in: header
name: api_key
required: false
schema:
type: string
style: simple
- description: Pet id to delete
explode: false
in: path
name: petId
required: true
schema:
format: int64
type: integer
style: simple
responses:
"400":
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
explode: false
in: path
name: petId
required: true
schema:
format: int64
type: integer
style: simple
responses:
"200":
content:
application/xml:
schema:
$ref: '#/components/schemas/Pet'
application/json:
schema:
$ref: '#/components/schemas/Pet'
description: successful operation
"400":
description: Invalid ID supplied
"404":
description: Pet not found
security:
- api_key: []
summary: Find pet by ID
tags:
- pet
post:
description: ""
operationId: updatePetWithForm
parameters:
- description: ID of pet that needs to be updated
explode: false
in: path
name: petId
required: true
schema:
format: int64
type: integer
style: simple
requestBody:
content:
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/updatePetWithForm_request'
responses:
"405":
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:
get:
description: Returns the image for the Pet that has been previously uploaded
operationId: getPetImageById
parameters:
- description: ID of pet to return
explode: false
in: path
name: petId
required: true
schema:
format: int64
type: integer
style: simple
responses:
"200":
content:
image/jpeg:
schema:
format: binary
type: string
description: successful operation
"400":
description: Invalid ID supplied
"404":
description: Pet not found
summary: Returns the image for the Pet that has been previously uploaded
tags:
- pet
post:
description: ""
operationId: uploadFile
parameters:
- description: ID of pet to update
explode: false
in: path
name: petId
required: true
schema:
format: int64
type: integer
style: simple
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/uploadFile_request'
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:
description: ""
operationId: placeOrder
requestBody:
content:
application/json:
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":
description: Invalid Order
summary: Place an order for a pet
tags:
- store
/store/order/{orderId}:
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
explode: false
in: path
name: orderId
required: true
schema:
type: string
style: simple
responses:
"400":
description: Invalid ID supplied
"404":
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 generate exceptions
operationId: getOrderById
parameters:
- description: ID of pet that needs to be fetched
explode: false
in: path
name: orderId
required: true
schema:
format: int64
maximum: 5
minimum: 1
type: integer
style: simple
responses:
"200":
content:
application/xml:
schema:
$ref: '#/components/schemas/Order'
application/json:
schema:
$ref: '#/components/schemas/Order'
description: successful operation
"400":
description: Invalid ID supplied
"404":
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:
application/json:
schema:
$ref: '#/components/schemas/User'
description: Created user object
required: true
responses:
default:
description: successful operation
security:
- api_key: []
summary: Create user
tags:
- user
/user/createWithArray:
post:
description: ""
operationId: createUsersWithArrayInput
requestBody:
$ref: '#/components/requestBodies/UserArray'
responses:
default:
description: successful operation
security:
- api_key: []
summary: Creates list of users with given input array
tags:
- user
/user/createWithList:
post:
description: ""
operationId: createUsersWithListInput
requestBody:
$ref: '#/components/requestBodies/UserArray'
responses:
default:
description: successful operation
security:
- api_key: []
summary: Creates list of users with given input array
tags:
- user
/user/login:
get:
description: ""
operationId: loginUser
parameters:
- description: The user name for login
explode: true
in: query
name: username
required: true
schema:
pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$"
type: string
style: form
- description: The password for login in clear text
explode: true
in: query
name: password
required: true
schema:
type: string
style: form
- description: Remember Me
explode: true
in: query
name: remember_me
required: false
schema:
type: boolean
style: form
responses:
"200":
content:
application/xml:
schema:
type: string
application/json:
schema:
type: string
description: successful operation
headers:
Set-Cookie:
description: Cookie authentication key for use with the `api_key` apiKey
authentication.
explode: false
schema:
example: AUTH_KEY=abcde12345; Path=/; HttpOnly
type: string
style: simple
X-Rate-Limit:
description: calls per hour allowed by the user
explode: false
schema:
format: int32
type: integer
style: simple
X-Expires-After:
description: date in UTC when token expires
explode: false
schema:
format: date-time
type: string
style: simple
"400":
description: Invalid username/password supplied
summary: Logs user into the system
tags:
- user
/user/logout:
get:
description: ""
operationId: logoutUser
responses:
default:
description: successful operation
security:
- api_key: []
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
explode: false
in: path
name: username
required: true
schema:
type: string
style: simple
- description: Confirm the deletion
explode: true
in: query
name: confirmation
required: false
schema:
type: boolean
style: form
responses:
"400":
description: Invalid username supplied
"404":
description: User not found
security:
- api_key: []
summary: Delete user
tags:
- user
get:
description: ""
operationId: getUserByName
parameters:
- description: The name that needs to be fetched. Use user1 for testing.
explode: false
in: path
name: username
required: true
schema:
type: string
style: simple
responses:
"200":
content:
application/xml:
schema:
$ref: '#/components/schemas/User'
application/json:
schema:
$ref: '#/components/schemas/User'
description: successful operation
"400":
description: Invalid username supplied
"404":
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
explode: false
in: path
name: username
required: true
schema:
type: string
style: simple
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/User'
description: Updated user object
required: true
responses:
"400":
description: Invalid user supplied
"404":
description: User not found
security:
- api_key: []
summary: Updated user
tags:
- user
/fake/uploadImage/array of_file:
post:
description: ""
operationId: uploadFileArrayOfFiles
parameters:
- description: ID of pet to update
explode: false
in: path
name: petId
required: true
schema:
format: int64
type: integer
style: simple
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/uploadFileArrayOfFiles_request'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
description: successful operation
security:
- petstore_auth:
- write:pets
- read:pets
summary: uploads images (array of files)
tags:
- pet
/pets/boolean/parsing:
get:
operationId: GetPetsUsingBooleanQueryParameters
parameters:
- explode: true
in: query
name: expr
required: true
schema:
type: boolean
style: form
- explode: true
in: query
name: grouping
required: false
schema:
type: boolean
style: form
- explode: true
in: query
name: inactive
required: false
schema:
default: false
type: boolean
style: form
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
description: successful operation
summary: Get the pets by only using boolean query parameters
tags:
- pet
/pets/byTime/{createdTime}:
get:
operationId: GetPetsByTime
parameters:
- explode: false
in: path
name: createdTime
required: true
schema:
format: date-time
type: string
style: simple
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
description: successful operation
summary: Get the pets by time
tags:
- pet
components:
requestBodies:
UserArray:
content:
application/json:
schema:
items:
$ref: '#/components/schemas/User'
type: array
description: List of user object
required: true
Pet:
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
schemas:
OrderInfo:
description: An order info for a pets from the pet store
properties:
petId:
format: int64
type: integer
quantity:
format: int32
type: integer
shipDate:
format: date-time
type: string
title: Pet Order Info
type: object
xml:
name: OrderInfo
SpecialInfo:
description: An order info for a pets from the pet store
discriminator:
propertyName: type
properties:
promotion:
type: boolean
type:
type: string
title: Pet Order Info
type: object
xml:
name: OrderInfo
Order:
allOf:
- $ref: '#/components/schemas/OrderInfo'
- $ref: '#/components/schemas/SpecialInfo'
- description: An order for a pets from the pet store
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
comment:
nullable: true
type: string
required:
- comment
title: Pet Order
type: object
example: null
example:
petId: 5
quantity: 5
comment: comment
id: 1
shipDate: 2000-01-23T04:56:07.000+00:00
type: type
complete: false
promotion: true
status: placed
type: object
xml:
name: Order
Category:
description: A category for a pet
example:
name: name
id: 6
nullable: true
properties:
id:
format: int64
type: integer
name:
pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$"
type: string
title: Pet category
type: object
xml:
name: Category
User:
description: A User who is purchasing from the pet store
example:
firstName: firstName
lastName: lastName
password: password
userStatus: 6
phone: phone
deepSliceModel:
- - - name: name
id: 1
- name: name
id: 1
- - name: name
id: 1
- name: name
id: 1
- - - name: name
id: 1
- name: name
id: 1
- - name: name
id: 1
- name: name
id: 1
id: 0
deepSliceMap:
- - tag:
name: name
id: 1
Pet:
- photoUrls:
- photoUrls
- photoUrls
name: doggie
id: 0
category:
name: name
id: 6
tags:
- name: name
id: 1
- name: name
id: 1
status: available
- photoUrls:
- photoUrls
- photoUrls
name: doggie
id: 0
category:
name: name
id: 6
tags:
- name: name
id: 1
- name: name
id: 1
status: available
- tag:
name: name
id: 1
Pet:
- photoUrls:
- photoUrls
- photoUrls
name: doggie
id: 0
category:
name: name
id: 6
tags:
- name: name
id: 1
- name: name
id: 1
status: available
- photoUrls:
- photoUrls
- photoUrls
name: doggie
id: 0
category:
name: name
id: 6
tags:
- name: name
id: 1
- name: name
id: 1
status: available
- - tag:
name: name
id: 1
Pet:
- photoUrls:
- photoUrls
- photoUrls
name: doggie
id: 0
category:
name: name
id: 6
tags:
- name: name
id: 1
- name: name
id: 1
status: available
- photoUrls:
- photoUrls
- photoUrls
name: doggie
id: 0
category:
name: name
id: 6
tags:
- name: name
id: 1
- name: name
id: 1
status: available
- tag:
name: name
id: 1
Pet:
- photoUrls:
- photoUrls
- photoUrls
name: doggie
id: 0
category:
name: name
id: 6
tags:
- name: name
id: 1
- name: name
id: 1
status: available
- photoUrls:
- photoUrls
- photoUrls
name: doggie
id: 0
category:
name: name
id: 6
tags:
- name: name
id: 1
- name: name
id: 1
status: available
email: email
username: username
properties:
id:
format: int64
type: integer
username:
type: string
firstName:
type: string
lastName:
type: string
email:
type: string
password:
type: string
phone:
nullable: true
type: string
userStatus:
description: User Status
format: int32
type: integer
deepSliceModel:
description: An array 1-deep.
items:
description: An array 2-deep.
items:
description: An array 3-deep.
items:
$ref: '#/components/schemas/Tag'
type: array
type: array
nullable: true
type: array
deepSliceMap:
description: An array 1-deep.
items:
description: An array 2-deep.
items:
$ref: '#/components/schemas/an_Object'
type: array
type: array
required:
- deepSliceModel
title: a User
type: object
xml:
name: User
Tag:
description: A tag for a pet
example:
name: name
id: 1
properties:
id:
format: int64
type: integer
name:
type: string
title: Pet Tag
type: object
xml:
name: Tag
Pet:
description: A pet for sale in the pet store
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
category:
$ref: '#/components/schemas/Category'
name:
example: doggie
type: string
photoUrls:
items:
type: string
nullable: true
type: array
xml:
name: photoUrl
wrapped: true
tags:
items:
$ref: '#/components/schemas/Tag'
nullable: true
type: array
xml:
name: tag
wrapped: true
status:
deprecated: true
description: pet status in the store
enum:
- available
- pending
- sold
type: string
required:
- name
- photoUrls
title: a Pet
type: object
xml:
name: Pet
Species:
enum:
- cat
- dog
- fish
- goat
- pig
title: The species of a pet
type: string
Gender:
enum:
- male
- female
type: string
Colour:
enum:
- Blue
- White
nullable: true
type: string
ApiResponse:
description: Describes the result of uploading an image resource
example:
code: 0
type: type
message: message
properties:
code:
format: int32
type: integer
type:
type: string
message:
type: string
title: An uploaded response
type: object
updatePetWithForm_request:
properties:
name:
description: Updated name of the pet
type: string
status:
description: Updated status of the pet
type: string
type: object
uploadFile_request:
properties:
additionalMetadata:
description: Additional data to pass to server
type: string
extraOptionalMetadata:
description: More data to pass to server
items:
type: string
type: array
file:
description: file to upload
format: binary
type: string
type: object
uploadFileArrayOfFiles_request:
properties:
additionalMetadata:
description: Additional data to pass to server
type: string
files:
description: files to upload
items:
format: binary
type: string
type: array
type: object
an_Object:
description: An array 3-deep.
example:
tag:
name: name
id: 1
Pet:
- photoUrls:
- photoUrls
- photoUrls
name: doggie
id: 0
category:
name: name
id: 6
tags:
- name: name
id: 1
- name: name
id: 1
status: available
- photoUrls:
- photoUrls
- photoUrls
name: doggie
id: 0
category:
name: name
id: 6
tags:
- name: name
id: 1
- name: name
id: 1
status: available
properties:
tag:
$ref: '#/components/schemas/Tag'
Pet:
description: An array of pet.
items:
$ref: '#/components/schemas/Pet'
type: array
title: an Object
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
api_key:
in: header
name: api_key
type: apiKey