Last active
September 20, 2023 03:27
-
-
Save suntong/a03a7754b0109b8fd9496e631445afc5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.0 | |
info: | |
title: Petstore-OpenAPI | |
version: v0.1 | |
summary: "" | |
description: >- | |
This is a sample Pet Store Server based on the OpenAPI 3.0 | |
specification. You can find out more about | |
Swagger at [http://swagger.io](http://swagger.io). In the third iteration of the pet store, we've switched to the design first approach! | |
You can now help us improve the API whether it's by making changes to the definition itself or to the code. | |
That way, with time, we can improve the API in general, and expose some of the new features in OAS3. | |
Some useful links: | |
- [The Pet Store repository](https://github.com/swagger-api/swagger-petstore) | |
- [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml) | |
contact: | |
email: [email protected] | |
license: | |
name: Apache 2.0 | |
url: http://www.apache.org/licenses/LICENSE-2.0.html | |
tags: | |
- name: pet | |
description: Everything about your Pets | |
- name: user | |
description: Operations about user | |
servers: | |
- url: /api/v1 | |
paths: | |
/pet: | |
post: | |
operationId: addPet | |
summary: Add a new pet to the store | |
description: Add a new pet to the store | |
requestBody: | |
required: true | |
description: Create a new pet | |
content: | |
application/json: | |
schema: | |
$ref: "#/components/schemas/NewPet" | |
application/x-www-form-urlencoded: | |
schema: | |
$ref: "#/components/schemas/NewPet" | |
responses: | |
"200": | |
description: Successful operation | |
content: | |
application/json: | |
schema: | |
$ref: "#/components/schemas/Pet" | |
"405": | |
description: Invalid input | |
content: {} | |
default: | |
description: unexpected error | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Error' | |
tags: | |
- pet | |
#x-internal: false | |
put: | |
operationId: updatePet | |
description: Update an existing pet by Id | |
summary: Update an existing pet | |
requestBody: | |
required: true | |
description: Update an existent pet in the store | |
content: | |
application/json: | |
schema: | |
$ref: "#/components/schemas/Pet" | |
application/x-www-form-urlencoded: | |
schema: | |
$ref: "#/components/schemas/Pet" | |
responses: | |
"200": | |
description: Successful operation | |
content: | |
application/json: | |
schema: | |
$ref: "#/components/schemas/Pet" | |
"400": | |
description: Invalid ID supplied | |
content: {} | |
"404": | |
description: Pet not found | |
content: {} | |
"405": | |
description: Validation exception | |
content: {} | |
tags: | |
- pet | |
#x-internal: false | |
"/pet/{petId}": | |
get: | |
operationId: findPetByID # getPetById | |
summary: Find pet by ID | |
description: Returns a single pet | |
parameters: | |
- in: path | |
name: petId | |
description: ID of pet to return | |
required: true | |
schema: | |
type: integer | |
format: int64 | |
responses: | |
"200": | |
description: successful operation | |
content: | |
application/json: | |
schema: | |
$ref: "#/components/schemas/Pet" | |
"400": | |
description: Invalid ID supplied | |
content: {} | |
"404": | |
description: Pet not found | |
content: {} | |
tags: | |
- pet | |
#x-internal: false | |
# post: | |
# operationId: updatePetWithForm | |
# description: "" | |
# summary: Updates a pet in the store with form data | |
# parameters: | |
# - in: path | |
# name: petId | |
# description: ID of pet that needs to be updated | |
# required: true | |
# schema: | |
# type: integer | |
# format: int64 | |
# - in: query | |
# name: name | |
# description: Name of pet that needs to be updated | |
# schema: | |
# type: string | |
# - in: query | |
# name: status | |
# description: Status of pet that needs to be updated | |
# schema: | |
# type: string | |
# responses: | |
# "405": | |
# description: Invalid input | |
# content: {} | |
# tags: | |
# - pet | |
# #x-internal: false | |
delete: | |
operationId: deletePet | |
description: "" | |
summary: Deletes a pet | |
parameters: | |
- in: path | |
name: petId | |
description: Pet id to delete | |
required: true | |
schema: | |
type: integer | |
format: int64 | |
responses: | |
"400": | |
description: Invalid pet value | |
content: {} | |
tags: | |
- pet | |
#x-internal: false | |
# "/pet/{petId}/uploadImage": | |
# post: | |
# operationId: uploadFile | |
# description: "" | |
# summary: uploads an image | |
# parameters: | |
# - in: path | |
# name: petId | |
# description: ID of pet to update | |
# required: true | |
# schema: | |
# type: integer | |
# format: int64 | |
# - in: query | |
# name: additionalMetadata | |
# description: Additional Metadata | |
# required: false | |
# schema: | |
# type: string | |
# requestBody: | |
# required: false | |
# content: | |
# application/octet-stream: | |
# schema: | |
# type: string | |
# format: binary | |
# responses: | |
# "200": | |
# description: successful operation | |
# content: | |
# application/json: | |
# schema: | |
# $ref: "#/components/schemas/ApiResponse" | |
# tags: | |
# - pet | |
# #x-internal: false | |
# /pet/findByStatus: | |
# get: | |
# operationId: findPetsByStatus | |
# description: Multiple status values can be provided with comma separated strings | |
# summary: Finds Pets by status | |
# parameters: | |
# - in: query | |
# name: status | |
# description: Status values that need to be considered for filter | |
# required: false | |
# schema: | |
# type: string | |
# default: available | |
# enum: | |
# - available | |
# - pending | |
# - sold | |
# x-enum-options: | |
# - value: available | |
# - value: pending | |
# - value: sold | |
# responses: | |
# "200": | |
# description: successful operation | |
# content: | |
# application/json: | |
# schema: | |
# type: array | |
# items: | |
# $ref: "#/components/schemas/Pet" | |
# "400": | |
# description: Invalid status value | |
# content: {} | |
# tags: | |
# - pet | |
# #x-internal: false | |
/pet/findByTags: | |
get: | |
operationId: findPets # ByTags | |
description: Multiple tags can be provided with comma separated strings. Use | |
tag1, tag2, tag3 for testing. | |
summary: Finds Pets by tags | |
parameters: | |
- in: query | |
name: tags | |
description: Tags to filter by | |
required: false | |
schema: | |
type: array | |
items: | |
type: string | |
- name: limit | |
in: query | |
description: maximum number of results to return | |
required: false | |
schema: | |
type: integer | |
format: int32 | |
responses: | |
"200": | |
description: successful operation | |
content: | |
application/json: | |
schema: | |
type: array | |
items: | |
$ref: "#/components/schemas/Pet" | |
"400": | |
description: Invalid tag value | |
content: {} | |
tags: | |
- pet | |
#x-internal: false | |
/user/sign/up: | |
post: | |
operationId: createUser | |
description: This can only be done by the logged in user. | |
summary: Create user | |
requestBody: | |
required: false | |
description: Created user object | |
content: | |
application/json: | |
schema: | |
$ref: "#/components/schemas/User" | |
application/x-www-form-urlencoded: | |
schema: | |
$ref: "#/components/schemas/User" | |
responses: | |
default: | |
description: successful operation | |
content: | |
application/json: | |
schema: | |
$ref: "#/components/schemas/User" | |
tags: | |
- user | |
#x-internal: false | |
/user/sign/in: | |
get: | |
operationId: loginUser | |
description: "" | |
summary: Logs user into the system | |
parameters: | |
- in: query | |
name: username | |
description: The user name for login | |
required: false | |
schema: | |
type: string | |
- in: query | |
name: password | |
description: The password for login in clear text | |
required: false | |
schema: | |
type: string | |
responses: | |
"200": | |
description: successful operation | |
content: | |
application/json: | |
schema: | |
type: string | |
"400": | |
description: Invalid username/password supplied | |
content: {} | |
tags: | |
- user | |
#x-internal: false | |
/user/sign/out: | |
get: | |
operationId: logoutUser | |
description: "" | |
summary: Logs out current logged in user session | |
responses: | |
default: | |
description: successful operation | |
content: {} | |
tags: | |
- user | |
#x-internal: false | |
"/user/{userId}": | |
get: | |
operationId: getUserByID | |
description: "" | |
summary: Get user by user ID | |
parameters: | |
- in: path | |
name: userId | |
description: The user ID | |
required: true | |
schema: | |
type: string | |
responses: | |
"200": | |
description: successful operation | |
content: | |
application/json: | |
schema: | |
$ref: "#/components/schemas/User" | |
"400": | |
description: Invalid username supplied | |
content: {} | |
"404": | |
description: User not found | |
content: {} | |
tags: | |
- user | |
#x-internal: false | |
delete: | |
operationId: deleteUser | |
description: This can only be done by the logged in user. | |
summary: Delete user | |
parameters: | |
- in: path | |
name: userId | |
description: The user ID that needs to be deleted | |
required: true | |
schema: | |
type: string | |
responses: | |
"400": | |
description: Invalid username supplied | |
content: {} | |
"404": | |
description: User not found | |
content: {} | |
tags: | |
- user | |
#x-internal: false | |
put: | |
operationId: updateUser | |
description: This can only be done by the logged in user. | |
summary: Update user | |
parameters: | |
- in: path | |
name: userId | |
description: The user ID | |
required: true | |
schema: | |
type: string | |
requestBody: | |
required: true | |
description: Update an existent user in the store | |
content: | |
application/json: | |
schema: | |
$ref: "#/components/schemas/User" | |
application/x-www-form-urlencoded: | |
schema: | |
$ref: "#/components/schemas/User" | |
responses: | |
default: | |
description: successful operation | |
content: {} | |
tags: | |
- user | |
#x-internal: false | |
components: | |
schemas: | |
Address: | |
type: object | |
properties: | |
street: | |
type: string | |
examples: | |
- 437 Lytton | |
city: | |
type: string | |
examples: | |
- Palo Alto | |
state: | |
type: string | |
examples: | |
- CA | |
zip: | |
type: string | |
examples: | |
- "94301" | |
ApiResponse: | |
type: object | |
properties: | |
code: | |
type: integer | |
type: | |
type: string | |
message: | |
type: string | |
Category: | |
type: object | |
properties: | |
id: | |
type: integer | |
examples: | |
- 1 | |
name: | |
type: string | |
examples: | |
- Dogs | |
Customer: | |
type: object | |
properties: | |
id: | |
type: integer | |
examples: | |
- 100000 | |
username: | |
type: string | |
examples: | |
- fehguy | |
address: | |
type: array | |
items: | |
$ref: "#/components/schemas/Address" | |
Order: | |
type: object | |
properties: | |
id: | |
type: integer | |
examples: | |
- 10 | |
petId: | |
type: integer | |
format: int64 | |
examples: | |
- 198772 | |
quantity: | |
type: integer | |
examples: | |
- 7 | |
shipDate: | |
type: string | |
format: date-time | |
status: | |
description: Order Status | |
type: string | |
examples: | |
- approved | |
enum: | |
- placed | |
- approved | |
- delivered | |
x-enum-options: | |
- value: placed | |
- value: approved | |
- value: delivered | |
complete: | |
type: boolean | |
Pet: | |
allOf: | |
- $ref: '#/components/schemas/NewPet' | |
- required: | |
- id | |
properties: | |
id: | |
type: integer | |
format: int64 | |
description: Unique id of the pet | |
NewPet: | |
type: object | |
properties: | |
id: | |
type: integer | |
format: int64 | |
examples: | |
- 10 | |
name: | |
type: string | |
examples: | |
- doggie | |
category: | |
$ref: "#/components/schemas/Category" | |
photoUrls: | |
type: array | |
items: | |
type: string | |
# tags: | |
# type: array | |
# items: | |
# $ref: "#/components/schemas/Tag" | |
tag: | |
type: string | |
description: Type of the pet | |
status: | |
description: pet status in the store | |
type: string | |
enum: | |
- available | |
- pending | |
- sold | |
x-enum-options: | |
- value: available | |
- value: pending | |
- value: sold | |
required: | |
- name | |
# - photoUrls | |
Tag: | |
type: object | |
properties: | |
id: | |
type: integer | |
name: | |
type: string | |
User: | |
type: object | |
properties: | |
id: | |
type: integer | |
examples: | |
- 10 | |
username: | |
type: string | |
examples: | |
- theUser | |
firstName: | |
type: string | |
examples: | |
- John | |
lastName: | |
type: string | |
examples: | |
- James | |
email: | |
type: string | |
examples: | |
- [email protected] | |
password: | |
type: string | |
examples: | |
- "12345" | |
phone: | |
type: string | |
examples: | |
- "12345" | |
userStatus: | |
type: integer | |
description: User Status | |
examples: | |
- 1 | |
Error: | |
required: | |
- code | |
- message | |
properties: | |
code: | |
type: integer | |
format: int32 | |
description: Error code | |
message: | |
type: string | |
description: Error message | |
parameters: {} | |
responses: {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment