Repository navigation
Expand file tree
/
Copy pathapi.yaml
More file actions
94 lines (94 loc) · 2.68 KB
/
Copy pathapi.yaml
File metadata and controls
94 lines (94 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
openapi: 3.0.3
info: {title: petstore, version: "1"}
tags:
- {name: pets}
- {name: admin}
paths:
/pets:
get:
operationId: listPets
tags: [pets]
parameters:
- {name: limit, in: query, schema: {type: integer, format: int32, minimum: 1}}
- {name: status, in: query, schema: {$ref: '#/components/schemas/Status'}}
responses:
"200":
description: the pets
content:
application/json: {schema: {type: array, items: {$ref: '#/components/schemas/Pet'}}}
default:
description: error
content:
application/json: {schema: {$ref: '#/components/schemas/Error'}}
post:
operationId: createPet
tags: [pets]
requestBody:
required: true
content:
application/json: {schema: {$ref: '#/components/schemas/NewPet'}}
responses:
"201":
description: created
headers:
Location: {schema: {type: string}}
content:
application/json: {schema: {$ref: '#/components/schemas/Pet'}}
default:
description: error
content:
application/json: {schema: {$ref: '#/components/schemas/Error'}}
/pets/{id}:
parameters:
- {name: id, in: path, required: true, schema: {type: integer, format: int64}}
get:
operationId: getPet
tags: [pets]
responses:
"200":
description: the pet
content:
application/json: {schema: {$ref: '#/components/schemas/Pet'}}
"404":
description: no such pet
content:
application/json: {schema: {$ref: '#/components/schemas/Error'}}
delete:
operationId: deletePet
tags: [pets]
responses:
"204": {description: deleted}
/admin/stats:
get:
operationId: getStats
tags: [admin]
responses:
"200":
description: pets per status
content:
application/json: {schema: {type: object, additionalProperties: {type: integer}}}
components:
schemas:
Status:
type: string
enum: [available, pending, sold]
NewPet:
type: object
required: [name]
properties:
name: {type: string, minLength: 1, x-go-extra-tags: {db: name}}
tag: {type: string, nullable: true}
status: {$ref: '#/components/schemas/Status'}
Pet:
allOf:
- $ref: '#/components/schemas/NewPet'
- type: object
required: [id]
properties:
id: {type: integer, format: int64}
Error:
type: object
required: [code, message]
properties:
code: {type: integer}
message: {type: string}