-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpetstore.openapi.yaml
More file actions
204 lines (194 loc) · 4.8 KB
/
petstore.openapi.yaml
File metadata and controls
204 lines (194 loc) · 4.8 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
openapi: 3.0.3
info:
title: Petstore API
description: A simple API for managing a pet store
version: 1.0.0
license:
name: MIT
url: https://opensource.org/licenses/MIT
contact:
name: API Support
email: support@petstore.example.com
servers:
- url: https://api.petstore.io/v1
description: Production server
security:
- ApiKeyAuth: []
paths:
/pets:
get:
summary: List all pets
description: Returns a list of all pets in the store
operationId: listPets
tags:
- pets
parameters:
- name: limit
in: query
description: Maximum number of pets to return
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 20
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
'400':
description: Invalid request parameters
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
post:
summary: Create a pet
description: Add a new pet to the store
operationId: createPet
tags:
- pets
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewPet'
responses:
'201':
description: Pet created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
'400':
description: Invalid input
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key
schemas:
Pet:
type: object
required:
- id
- name
- species
- status
properties:
id:
type: string
format: uuid
description: Unique identifier for the pet
name:
type: string
minLength: 1
maxLength: 100
description: Name of the pet
species:
type: string
enum:
- dog
- cat
- rabbit
description: Species of the pet
breed:
type: string
maxLength: 50
description: Breed of the pet (optional)
age:
type: integer
minimum: 0
maximum: 50
description: Age of the pet in years (optional)
color:
type: string
maxLength: 30
description: Color of the pet (optional)
weight:
type: number
minimum: 0
description: Weight of the pet in kilograms (optional)
microchipId:
type: string
pattern: '^[0-9]{15}$'
description: 15-digit microchip ID (optional)
vaccinated:
type: boolean
description: Whether the pet is vaccinated (optional)
status:
type: string
enum:
- available
- pending
- sold
description: Availability status of the pet
createdAt:
type: string
format: date-time
description: Timestamp when the pet was added
NewPet:
type: object
required:
- name
- species
properties:
name:
type: string
minLength: 1
maxLength: 100
description: Name of the pet
species:
type: string
enum:
- dog
- cat
- rabbit
description: Species of the pet
breed:
type: string
maxLength: 50
description: Breed of the pet (optional)
age:
type: integer
minimum: 0
maximum: 50
description: Age of the pet in years (optional)
Error:
type: object
required:
- code
- message
properties:
code:
type: string
description: Error code
message:
type: string
description: Human-readable error message
details:
type: object
description: Additional error details (optional)