1
1
import { makeApi , Zodios } from "@zodios/core" ;
2
2
import { z } from "zod" ;
3
3
4
- const vR1x0k5qaLk = z . object ( { id : z . number ( ) , name : z . string ( ) } ) . partial ( ) ;
5
- const v8JbFEq2fUl = z . object ( {
6
- id : z . number ( ) . optional ( ) ,
4
+ const Category = z . object ( { id : z . number ( ) . int ( ) , name : z . string ( ) } ) . partial ( ) ;
5
+ const Tag = z . object ( { id : z . number ( ) . int ( ) , name : z . string ( ) } ) . partial ( ) ;
6
+ const Pet = z . object ( {
7
+ id : z . number ( ) . int ( ) . optional ( ) ,
7
8
name : z . string ( ) ,
8
- category : vR1x0k5qaLk . optional ( ) ,
9
+ category : Category . optional ( ) ,
9
10
photoUrls : z . array ( z . string ( ) ) ,
10
- tags : z . array ( vR1x0k5qaLk ) . optional ( ) ,
11
+ tags : z . array ( Tag ) . optional ( ) ,
11
12
status : z . enum ( [ "available" , "pending" , "sold" ] ) . optional ( ) ,
12
13
} ) ;
13
- const vlh4E1pXYTG = z . enum ( [ "available" , "pending" , "sold" ] ) . optional ( ) ;
14
- const vh4fxCvnN1b = z . array ( v8JbFEq2fUl ) ;
15
- const vGqL1kemtHF = z . array ( z . string ( ) ) . optional ( ) ;
16
- const vBaxCoPHbgy = z . object ( { code : z . number ( ) , type : z . string ( ) , message : z . string ( ) } ) . partial ( ) ;
17
- const vLBYC40hXo1 = z
14
+ const status = z . enum ( [ "available" , "pending" , "sold" ] ) . optional ( ) ;
15
+ const tags = z . array ( z . string ( ) ) . optional ( ) ;
16
+ const ApiResponse = z . object ( { code : z . number ( ) . int ( ) , type : z . string ( ) , message : z . string ( ) } ) . partial ( ) ;
17
+ const Order = z
18
18
. object ( {
19
- id : z . number ( ) ,
20
- petId : z . number ( ) ,
21
- quantity : z . number ( ) ,
19
+ id : z . number ( ) . int ( ) ,
20
+ petId : z . number ( ) . int ( ) ,
21
+ quantity : z . number ( ) . int ( ) ,
22
22
shipDate : z . string ( ) ,
23
23
status : z . enum ( [ "placed" , "approved" , "delivered" ] ) ,
24
24
complete : z . boolean ( ) ,
25
25
} )
26
26
. partial ( ) ;
27
- const veNKKR5W6KW = z
27
+ const User = z
28
28
. object ( {
29
- id : z . number ( ) ,
29
+ id : z . number ( ) . int ( ) ,
30
30
username : z . string ( ) ,
31
31
firstName : z . string ( ) ,
32
32
lastName : z . string ( ) ,
33
33
email : z . string ( ) ,
34
34
password : z . string ( ) ,
35
35
phone : z . string ( ) ,
36
- userStatus : z . number ( ) ,
36
+ userStatus : z . number ( ) . int ( ) ,
37
37
} )
38
38
. partial ( ) ;
39
- const vVrSPZVa6q7 = z . array ( veNKKR5W6KW ) ;
40
-
41
- const variables = {
42
- ApiResponse : vBaxCoPHbgy ,
43
- Order : vLBYC40hXo1 ,
44
- Pet : v8JbFEq2fUl ,
45
- User : veNKKR5W6KW ,
46
- addPet : v8JbFEq2fUl ,
47
- addPet_Body : v8JbFEq2fUl ,
48
- createUser : veNKKR5W6KW ,
49
- createUser_Body : veNKKR5W6KW ,
50
- createUsersWithListInput : veNKKR5W6KW ,
51
- createUsersWithListInput_Body : vVrSPZVa6q7 ,
52
- findPetsByStatus : vh4fxCvnN1b ,
53
- findPetsByTags : vh4fxCvnN1b ,
54
- getOrderById : vLBYC40hXo1 ,
55
- getPetById : v8JbFEq2fUl ,
56
- getUserByName : veNKKR5W6KW ,
57
- placeOrder : vLBYC40hXo1 ,
58
- placeOrder_Body : vLBYC40hXo1 ,
59
- status : vlh4E1pXYTG ,
60
- tags : vGqL1kemtHF ,
61
- updatePet : v8JbFEq2fUl ,
62
- updatePet_Body : v8JbFEq2fUl ,
63
- updateUser_Body : veNKKR5W6KW ,
64
- uploadFile : vBaxCoPHbgy ,
65
- } ;
39
+ const createUsersWithListInput_Body = z . array ( User ) ;
66
40
67
41
const endpoints = makeApi ( [
68
42
{
@@ -75,10 +49,27 @@ const endpoints = makeApi([
75
49
name : "body" ,
76
50
description : `Update an existent pet in the store` ,
77
51
type : "Body" ,
78
- schema : variables [ "updatePet_Body" ] ,
52
+ schema : Pet ,
53
+ } ,
54
+ ] ,
55
+ response : Pet ,
56
+ errors : [
57
+ {
58
+ status : 400 ,
59
+ description : `Invalid ID supplied` ,
60
+ schema : z . void ( ) ,
61
+ } ,
62
+ {
63
+ status : 404 ,
64
+ description : `Pet not found` ,
65
+ schema : z . void ( ) ,
66
+ } ,
67
+ {
68
+ status : 405 ,
69
+ description : `Validation exception` ,
70
+ schema : z . void ( ) ,
79
71
} ,
80
72
] ,
81
- response : variables [ "Pet" ] ,
82
73
} ,
83
74
{
84
75
method : "post" ,
@@ -90,30 +81,61 @@ const endpoints = makeApi([
90
81
name : "body" ,
91
82
description : `Create a new pet in the store` ,
92
83
type : "Body" ,
93
- schema : variables [ "addPet_Body" ] ,
84
+ schema : Pet ,
85
+ } ,
86
+ ] ,
87
+ response : Pet ,
88
+ errors : [
89
+ {
90
+ status : 405 ,
91
+ description : `Invalid input` ,
92
+ schema : z . void ( ) ,
94
93
} ,
95
94
] ,
96
- response : variables [ "Pet" ] ,
97
95
} ,
98
96
{
99
97
method : "get" ,
100
98
path : "/pet/:petId" ,
101
99
description : `Returns a single pet` ,
102
100
requestFormat : "json" ,
103
- response : variables [ "Pet" ] ,
101
+ parameters : [
102
+ {
103
+ name : "petId" ,
104
+ type : "Path" ,
105
+ schema : z . number ( ) ,
106
+ } ,
107
+ ] ,
108
+ response : Pet ,
109
+ errors : [
110
+ {
111
+ status : 400 ,
112
+ description : `Invalid ID supplied` ,
113
+ schema : z . void ( ) ,
114
+ } ,
115
+ {
116
+ status : 404 ,
117
+ description : `Pet not found` ,
118
+ schema : z . void ( ) ,
119
+ } ,
120
+ ] ,
104
121
} ,
105
122
{
106
123
method : "post" ,
107
124
path : "/pet/:petId/uploadImage" ,
108
125
requestFormat : "json" ,
109
126
parameters : [
127
+ {
128
+ name : "petId" ,
129
+ type : "Path" ,
130
+ schema : z . number ( ) ,
131
+ } ,
110
132
{
111
133
name : "additionalMetadata" ,
112
134
type : "Query" ,
113
135
schema : z . string ( ) . optional ( ) ,
114
136
} ,
115
137
] ,
116
- response : variables [ " ApiResponse" ] ,
138
+ response : ApiResponse ,
117
139
} ,
118
140
{
119
141
method : "get" ,
@@ -124,10 +146,17 @@ const endpoints = makeApi([
124
146
{
125
147
name : "status" ,
126
148
type : "Query" ,
127
- schema : variables [ "status" ] ,
149
+ schema : status ,
150
+ } ,
151
+ ] ,
152
+ response : z . array ( Pet ) ,
153
+ errors : [
154
+ {
155
+ status : 400 ,
156
+ description : `Invalid status value` ,
157
+ schema : z . void ( ) ,
128
158
} ,
129
159
] ,
130
- response : z . array ( variables [ "getPetById" ] ) ,
131
160
} ,
132
161
{
133
162
method : "get" ,
@@ -138,10 +167,17 @@ const endpoints = makeApi([
138
167
{
139
168
name : "tags" ,
140
169
type : "Query" ,
141
- schema : variables [ "tags" ] ,
170
+ schema : tags ,
171
+ } ,
172
+ ] ,
173
+ response : z . array ( Pet ) ,
174
+ errors : [
175
+ {
176
+ status : 400 ,
177
+ description : `Invalid tag value` ,
178
+ schema : z . void ( ) ,
142
179
} ,
143
180
] ,
144
- response : z . array ( variables [ "getPetById" ] ) ,
145
181
} ,
146
182
{
147
183
method : "get" ,
@@ -159,17 +195,43 @@ const endpoints = makeApi([
159
195
{
160
196
name : "body" ,
161
197
type : "Body" ,
162
- schema : variables [ "placeOrder_Body" ] ,
198
+ schema : Order ,
199
+ } ,
200
+ ] ,
201
+ response : Order ,
202
+ errors : [
203
+ {
204
+ status : 405 ,
205
+ description : `Invalid input` ,
206
+ schema : z . void ( ) ,
163
207
} ,
164
208
] ,
165
- response : variables [ "Order" ] ,
166
209
} ,
167
210
{
168
211
method : "get" ,
169
212
path : "/store/order/:orderId" ,
170
213
description : `For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.` ,
171
214
requestFormat : "json" ,
172
- response : variables [ "Order" ] ,
215
+ parameters : [
216
+ {
217
+ name : "orderId" ,
218
+ type : "Path" ,
219
+ schema : z . number ( ) ,
220
+ } ,
221
+ ] ,
222
+ response : Order ,
223
+ errors : [
224
+ {
225
+ status : 400 ,
226
+ description : `Invalid ID supplied` ,
227
+ schema : z . void ( ) ,
228
+ } ,
229
+ {
230
+ status : 404 ,
231
+ description : `Order not found` ,
232
+ schema : z . void ( ) ,
233
+ } ,
234
+ ] ,
173
235
} ,
174
236
{
175
237
method : "post" ,
@@ -181,16 +243,55 @@ const endpoints = makeApi([
181
243
name : "body" ,
182
244
description : `Created user object` ,
183
245
type : "Body" ,
184
- schema : variables [ "createUser_Body" ] ,
246
+ schema : User ,
185
247
} ,
186
248
] ,
187
- response : variables [ " User" ] ,
249
+ response : User ,
188
250
} ,
189
251
{
190
252
method : "get" ,
191
253
path : "/user/:username" ,
192
254
requestFormat : "json" ,
193
- response : variables [ "User" ] ,
255
+ parameters : [
256
+ {
257
+ name : "username" ,
258
+ type : "Path" ,
259
+ schema : z . string ( ) ,
260
+ } ,
261
+ ] ,
262
+ response : User ,
263
+ errors : [
264
+ {
265
+ status : 400 ,
266
+ description : `Invalid username supplied` ,
267
+ schema : z . void ( ) ,
268
+ } ,
269
+ {
270
+ status : 404 ,
271
+ description : `User not found` ,
272
+ schema : z . void ( ) ,
273
+ } ,
274
+ ] ,
275
+ } ,
276
+ {
277
+ method : "put" ,
278
+ path : "/user/:username" ,
279
+ description : `This can only be done by the logged in user.` ,
280
+ requestFormat : "json" ,
281
+ parameters : [
282
+ {
283
+ name : "body" ,
284
+ description : `Update an existent user in the store` ,
285
+ type : "Body" ,
286
+ schema : User ,
287
+ } ,
288
+ {
289
+ name : "username" ,
290
+ type : "Path" ,
291
+ schema : z . string ( ) ,
292
+ } ,
293
+ ] ,
294
+ response : z . void ( ) ,
194
295
} ,
195
296
{
196
297
method : "post" ,
@@ -201,10 +302,10 @@ const endpoints = makeApi([
201
302
{
202
303
name : "body" ,
203
304
type : "Body" ,
204
- schema : variables [ " createUsersWithListInput_Body" ] ,
305
+ schema : createUsersWithListInput_Body ,
205
306
} ,
206
307
] ,
207
- response : variables [ " User" ] ,
308
+ response : User ,
208
309
} ,
209
310
{
210
311
method : "get" ,
@@ -223,6 +324,19 @@ const endpoints = makeApi([
223
324
} ,
224
325
] ,
225
326
response : z . string ( ) ,
327
+ errors : [
328
+ {
329
+ status : 400 ,
330
+ description : `Invalid username/password supplied` ,
331
+ schema : z . void ( ) ,
332
+ } ,
333
+ ] ,
334
+ } ,
335
+ {
336
+ method : "get" ,
337
+ path : "/user/logout" ,
338
+ requestFormat : "json" ,
339
+ response : z . void ( ) ,
226
340
} ,
227
341
] ) ;
228
342
0 commit comments