fork of hey-api/openapi-ts because I need some additional things
1{
2 "openapi": "3.1.0",
3 "info": {
4 "title": "Petstore API",
5 "version": "1.0.0",
6 "description": "A sample API that uses a petstore as an example"
7 },
8 "servers": [
9 {
10 "url": "http://localhost:3000/v3"
11 }
12 ],
13 "tags": [
14 {
15 "name": "pets",
16 "description": "Pet operations"
17 },
18 {
19 "name": "store",
20 "description": "Store operations"
21 }
22 ],
23 "paths": {
24 "/pets": {
25 "get": {
26 "summary": "List all pets",
27 "operationId": "listPets",
28 "tags": ["pets"],
29 "parameters": [
30 {
31 "name": "limit",
32 "in": "query",
33 "required": false,
34 "schema": {
35 "type": "integer",
36 "format": "int32",
37 "minimum": 1,
38 "maximum": 100
39 }
40 },
41 {
42 "name": "offset",
43 "in": "query",
44 "required": false,
45 "schema": {
46 "type": "integer",
47 "format": "int32",
48 "minimum": 0
49 }
50 }
51 ],
52 "responses": {
53 "200": {
54 "description": "A list of pets",
55 "content": {
56 "application/json": {
57 "schema": {
58 "type": "array",
59 "items": {
60 "$ref": "#/components/schemas/Pet"
61 }
62 }
63 }
64 }
65 }
66 }
67 },
68 "post": {
69 "summary": "Create a pet",
70 "operationId": "createPet",
71 "tags": ["pets"],
72 "requestBody": {
73 "required": true,
74 "content": {
75 "application/json": {
76 "schema": {
77 "$ref": "#/components/schemas/CreatePetBody"
78 }
79 }
80 }
81 },
82 "responses": {
83 "201": {
84 "description": "Pet created",
85 "content": {
86 "application/json": {
87 "schema": {
88 "$ref": "#/components/schemas/Pet"
89 }
90 }
91 }
92 },
93 "400": {
94 "description": "Validation error",
95 "content": {
96 "application/json": {
97 "schema": {
98 "$ref": "#/components/schemas/Error"
99 }
100 }
101 }
102 }
103 }
104 }
105 },
106 "/pets/{petId}": {
107 "get": {
108 "summary": "Find pet by ID",
109 "operationId": "showPetById",
110 "tags": ["pets"],
111 "parameters": [
112 {
113 "name": "petId",
114 "in": "path",
115 "required": true,
116 "schema": {
117 "type": "string",
118 "format": "uuid"
119 }
120 }
121 ],
122 "responses": {
123 "200": {
124 "description": "Pet found",
125 "content": {
126 "application/json": {
127 "schema": {
128 "$ref": "#/components/schemas/Pet"
129 }
130 }
131 }
132 },
133 "404": {
134 "description": "Pet not found",
135 "content": {
136 "application/json": {
137 "schema": {
138 "$ref": "#/components/schemas/Error"
139 }
140 }
141 }
142 }
143 }
144 },
145 "put": {
146 "summary": "Update a pet",
147 "operationId": "updatePet",
148 "tags": ["pets"],
149 "parameters": [
150 {
151 "name": "petId",
152 "in": "path",
153 "required": true,
154 "schema": {
155 "type": "string",
156 "format": "uuid"
157 }
158 }
159 ],
160 "requestBody": {
161 "required": true,
162 "content": {
163 "application/json": {
164 "schema": {
165 "$ref": "#/components/schemas/UpdatePetBody"
166 }
167 }
168 }
169 },
170 "responses": {
171 "200": {
172 "description": "Pet updated",
173 "content": {
174 "application/json": {
175 "schema": {
176 "$ref": "#/components/schemas/Pet"
177 }
178 }
179 }
180 },
181 "400": {
182 "description": "Validation error",
183 "content": {
184 "application/json": {
185 "schema": {
186 "$ref": "#/components/schemas/Error"
187 }
188 }
189 }
190 },
191 "404": {
192 "description": "Pet not found",
193 "content": {
194 "application/json": {
195 "schema": {
196 "$ref": "#/components/schemas/Error"
197 }
198 }
199 }
200 }
201 }
202 },
203 "delete": {
204 "summary": "Delete a pet",
205 "operationId": "deletePet",
206 "tags": ["pets"],
207 "parameters": [
208 {
209 "name": "petId",
210 "in": "path",
211 "required": true,
212 "schema": {
213 "type": "string",
214 "format": "uuid"
215 }
216 }
217 ],
218 "responses": {
219 "204": {
220 "description": "Pet deleted"
221 },
222 "404": {
223 "description": "Pet not found",
224 "content": {
225 "application/json": {
226 "schema": {
227 "$ref": "#/components/schemas/Error"
228 }
229 }
230 }
231 }
232 }
233 }
234 },
235 "/store/inventory": {
236 "get": {
237 "summary": "Returns pet inventories by status",
238 "operationId": "getInventory",
239 "tags": ["store"],
240 "responses": {
241 "200": {
242 "description": "Successful operation",
243 "content": {
244 "application/json": {
245 "schema": {
246 "type": "object",
247 "additionalProperties": {
248 "type": "integer",
249 "format": "int32"
250 }
251 }
252 }
253 }
254 }
255 }
256 }
257 }
258 },
259 "components": {
260 "schemas": {
261 "Pet": {
262 "type": "object",
263 "required": ["id", "name"],
264 "properties": {
265 "id": {
266 "type": "string",
267 "format": "uuid"
268 },
269 "name": {
270 "type": "string",
271 "minLength": 1,
272 "maxLength": 100
273 },
274 "tag": {
275 "type": "string"
276 },
277 "status": {
278 "type": "string",
279 "enum": ["available", "pending", "sold"]
280 }
281 }
282 },
283 "CreatePetBody": {
284 "type": "object",
285 "required": ["name"],
286 "properties": {
287 "name": {
288 "type": "string",
289 "minLength": 1,
290 "maxLength": 100
291 },
292 "tag": {
293 "type": "string"
294 }
295 }
296 },
297 "UpdatePetBody": {
298 "type": "object",
299 "properties": {
300 "name": {
301 "type": "string",
302 "minLength": 1,
303 "maxLength": 100
304 },
305 "tag": {
306 "type": "string"
307 },
308 "status": {
309 "type": "string",
310 "enum": ["available", "pending", "sold"]
311 }
312 }
313 },
314 "Error": {
315 "type": "object",
316 "required": ["code", "message"],
317 "properties": {
318 "code": {
319 "type": "integer",
320 "format": "int32"
321 },
322 "message": {
323 "type": "string"
324 }
325 }
326 }
327 }
328 }
329}