Skip to content

Instantly share code, notes, and snippets.

@Mahoney
Created March 20, 2024 13:37
Show Gist options
  • Save Mahoney/cf0f24f62c7158dc21f79c16aa5035e2 to your computer and use it in GitHub Desktop.
Save Mahoney/cf0f24f62c7158dc21f79c16aa5035e2 to your computer and use it in GitHub Desktop.
petstore.yaml
openapi: 3.0.0
info:
title: Swagger Petstore
description: 'This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.'
contact:
email: apiteam@swagger.io
version: '1.0.5'
servers:
- url: https://petstore.swagger.io/v2
variables: {}
- url: http://petstore.swagger.io/v2
variables: {}
- url: https://petstore.swagger.io/oauth
variables: {}
paths:
/pet/findByStatus:
get:
tags:
- pet
summary: findPetsByStatus
description: Multiple status values can be provided with comma separated strings
operationId: findPetsByStatus
parameters:
- name: status
in: query
description: Status values that need to be considered for filter
required: true
style: form
explode: true
schema:
type: array
items:
$ref: '#/components/schemas/status2'
responses:
'200':
description: successful operation
headers: {}
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
description: successful operation
'400':
description: Invalid status value
deprecated: false
security:
- oauth2:
- write:pets
- read:pets
/pet/findByTags:
get:
tags:
- pet
summary: findPetsByTags
description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
operationId: findPetsByTags
parameters:
- name: tags
in: query
description: Tags to filter by
required: true
style: form
explode: true
schema:
type: array
items:
type: string
responses:
'200':
description: successful operation
headers: {}
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
description: successful operation
'400':
description: Invalid tag value
deprecated: false
security:
- oauth2:
- write:pets
- read:pets
/pet/{petId}:
post:
tags:
- pet
summary: updatePetWithForm
description: Updates a pet in the store with form data
operationId: updatePetWithForm
parameters:
- name: petId
in: path
description: ID of pet that needs to be updated
required: true
style: simple
schema:
type: integer
format: int64
requestBody:
content:
application/x-www-form-urlencoded:
encoding: {}
schema:
type: object
properties:
name:
type: string
description: Updated name of the pet
status:
type: string
description: Updated status of the pet
required: false
responses:
'200':
description: ''
headers: {}
'405':
description: Invalid input
deprecated: false
security:
- oauth2:
- write:pets
- read:pets
get:
tags:
- pet
summary: getPetById
description: Returns a single pet
operationId: getPetById
parameters:
- name: petId
in: path
description: ID of pet to return
required: true
style: simple
schema:
type: integer
format: int64
responses:
'200':
description: successful operation
headers: {}
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
'400':
description: Invalid ID supplied
'404':
description: Pet not found
deprecated: false
delete:
tags:
- pet
summary: deletePet
description: Deletes a pet
operationId: deletePet
parameters:
- name: api_key
in: header
style: simple
schema:
type: string
- name: petId
in: path
description: Pet id to delete
required: true
style: simple
schema:
type: integer
format: int64
responses:
'200':
description: ''
headers: {}
'400':
description: Invalid ID supplied
'404':
description: Pet not found
deprecated: false
security:
- oauth2:
- write:pets
- read:pets
/pet:
post:
tags:
- pet
summary: addPet
description: Add a new pet to the store
operationId: addPet
parameters: []
requestBody:
description: Pet object that needs to be added to the store
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
required: true
responses:
'200':
description: ''
headers: {}
'405':
description: Invalid input
deprecated: false
security:
- oauth2:
- write:pets
- read:pets
put:
tags:
- pet
summary: updatePet
description: Update an existing pet
operationId: updatePet
parameters: []
requestBody:
description: Pet object that needs to be added to the store
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
required: true
responses:
'200':
description: ''
headers: {}
'400':
description: Invalid ID supplied
'404':
description: Pet not found
'405':
description: Validation exception
deprecated: false
security:
- oauth2:
- write:pets
- read:pets
/pet/{petId}/uploadImage:
post:
tags:
- pet
summary: uploadFile
description: uploads an image
operationId: uploadFile
parameters:
- name: petId
in: path
description: ID of pet to update
required: true
style: simple
schema:
type: integer
format: int64
requestBody:
content:
multipart/form-data:
encoding: {}
schema:
type: object
properties:
additionalMetadata:
type: string
description: Additional data to pass to server
file:
type: string
description: file to upload
format: binary
required: false
responses:
'200':
description: successful operation
headers: {}
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
deprecated: false
security:
- oauth2:
- write:pets
- read:pets
/store/order/{orderId}:
delete:
tags:
- store
summary: deleteOrder
description: For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors
operationId: deleteOrder
parameters:
- name: orderId
in: path
description: ID of the order that needs to be deleted
required: true
style: simple
schema:
minimum: 1
type: integer
format: int64
responses:
'200':
description: ''
headers: {}
'400':
description: Invalid ID supplied
'404':
description: Order not found
deprecated: false
get:
tags:
- store
summary: getOrderById
description: For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions
operationId: getOrderById
parameters:
- name: orderId
in: path
description: ID of pet that needs to be fetched
required: true
style: simple
schema:
maximum: 10
minimum: 1
type: integer
format: int64
responses:
'200':
description: successful operation
headers: {}
content:
application/json:
schema:
$ref: '#/components/schemas/Order'
'400':
description: Invalid ID supplied
'404':
description: Order not found
deprecated: false
/store/inventory:
get:
tags:
- store
summary: getInventory
description: Returns a map of status codes to quantities
operationId: getInventory
parameters: []
responses:
'200':
description: successful operation
headers: {}
content:
application/json:
schema:
type: object
additionalProperties:
type: integer
format: int32
description: successful operation
deprecated: false
/store/order:
post:
tags:
- store
summary: placeOrder
description: Place an order for a pet
operationId: placeOrder
parameters: []
requestBody:
description: order placed for purchasing the pet
content:
application/json:
schema:
$ref: '#/components/schemas/Order'
required: true
responses:
'200':
description: successful operation
headers: {}
content:
application/json:
schema:
$ref: '#/components/schemas/Order'
'400':
description: Invalid Order
deprecated: false
/user/{username}:
put:
tags:
- user
summary: updateUser
description: This can only be done by the logged in user.
operationId: updateUser
parameters:
- name: username
in: path
description: name that need to be updated
required: true
style: simple
schema:
type: string
requestBody:
description: Updated user object
content:
application/json:
schema:
$ref: '#/components/schemas/User'
required: true
responses:
'200':
description: ''
headers: {}
'400':
description: Invalid user supplied
'404':
description: User not found
deprecated: false
delete:
tags:
- user
summary: deleteUser
description: This can only be done by the logged in user.
operationId: deleteUser
parameters:
- name: username
in: path
description: The name that needs to be deleted
required: true
style: simple
schema:
type: string
responses:
'200':
description: ''
headers: {}
'400':
description: Invalid username supplied
'404':
description: User not found
deprecated: false
get:
tags:
- user
summary: getUserByName
description: Get user by user name
operationId: getUserByName
parameters:
- name: username
in: path
description: 'The name that needs to be fetched. Use user1 for testing. '
required: true
style: simple
schema:
type: string
responses:
'200':
description: successful operation
headers: {}
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'400':
description: Invalid username supplied
'404':
description: User not found
deprecated: false
/user/createWithList:
post:
tags:
- user
summary: createUsersWithListInput
description: Creates list of users with given input array
operationId: createUsersWithListInput
parameters: []
requestBody:
description: List of user object
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
description: List of user object
required: true
responses:
'200':
description: ''
headers: {}
default:
description: successful operation
deprecated: false
/user/logout:
get:
tags:
- user
summary: logoutUser
description: Logs out current logged in user session
operationId: logoutUser
parameters: []
responses:
'200':
description: ''
headers: {}
default:
description: successful operation
deprecated: false
/user:
post:
tags:
- user
summary: createUser
description: This can only be done by the logged in user.
operationId: createUser
parameters: []
requestBody:
description: Created user object
content:
application/json:
schema:
$ref: '#/components/schemas/User'
required: true
responses:
'200':
description: ''
headers: {}
default:
description: successful operation
deprecated: false
/user/createWithArray:
post:
tags:
- user
summary: createUsersWithArrayInput
description: Creates list of users with given input array
operationId: createUsersWithArrayInput
parameters: []
requestBody:
description: List of user object
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
description: List of user object
required: true
responses:
'200':
description: ''
headers: {}
default:
description: successful operation
deprecated: false
/user/login:
get:
tags:
- user
summary: loginUser
description: Logs user into the system
operationId: loginUser
parameters:
- name: username
in: query
description: The user name for login
required: true
style: form
explode: true
schema:
type: string
- name: password
in: query
description: The password for login in clear text
required: true
style: form
explode: true
schema:
type: string
responses:
'200':
description: successful operation
headers: {}
content:
text/plain:
schema:
type: string
description: successful operation
'400':
description: Invalid username/password supplied
deprecated: false
components:
schemas:
Order:
title: 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:
$ref: '#/components/schemas/Status1'
complete:
type: boolean
Tag:
title: Tag
type: object
properties:
id:
type: integer
format: int64
name:
type: string
Category:
title: Category
type: object
properties:
id:
type: integer
format: int64
name:
type: string
Status:
title: Status
enum:
- available
- pending
- sold
type: string
description: pet status in the store
Pet:
title: Pet
required:
- name
- photoUrls
type: object
properties:
id:
type: integer
format: int64
category:
$ref: '#/components/schemas/Category'
name:
type: string
photoUrls:
type: array
items:
type: string
xml:
name: photoUrl
attribute: false
wrapped: false
xml:
attribute: false
wrapped: true
tags:
type: array
items:
$ref: '#/components/schemas/Tag'
xml:
attribute: false
wrapped: true
status:
$ref: '#/components/schemas/Status'
ApiResponse:
title: ApiResponse
type: object
properties:
code:
type: integer
format: int32
type:
type: string
message:
type: string
status2:
title: status2
enum:
- available
- pending
- sold
type: string
Status1:
title: Status1
enum:
- placed
- approved
- delivered
type: string
description: Order Status
User:
title: User
type: object
properties:
id:
type: integer
format: int64
username:
type: string
firstName:
type: string
lastName:
type: string
email:
type: string
password:
type: string
phone:
type: string
userStatus:
type: integer
description: User Status
format: int32
securitySchemes:
oauth2:
type: oauth2
flows:
implicit:
authorizationUrl: https://petstore.swagger.io/oauth/authorize
scopes:
read:pets: read your pets
write:pets: modify pets in your account
security:
- oauth2: []
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
externalDocs:
description: Find out more about Swagger
url: http://swagger.io
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment