@scalar/openapi-types 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/helpers/index.d.ts +2 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +5 -0
- package/dist/helpers/index.js.map +7 -0
- package/dist/helpers/is-dereferenced.d.ts +7 -0
- package/dist/helpers/is-dereferenced.d.ts.map +1 -0
- package/dist/helpers/is-dereferenced.js +5 -0
- package/dist/helpers/is-dereferenced.js.map +7 -0
- package/dist/openapi-types.d.ts +9 -18
- package/dist/openapi-types.d.ts.map +1 -1
- package/dist/openapi-types.js +1 -16
- package/dist/openapi-types.js.map +3 -3
- package/dist/openapi-types.test-d.js.map +2 -2
- package/dist/schemas/3.1/processed/index.d.ts +1 -1
- package/dist/schemas/3.1/processed/index.d.ts.map +1 -1
- package/dist/schemas/3.1/processed/index.js.map +2 -2
- package/dist/schemas/3.1/processed/openapi-object.d.ts +30835 -22
- package/dist/schemas/3.1/processed/openapi-object.d.ts.map +1 -1
- package/dist/schemas/3.1/processed/openapi-object.js +1 -1
- package/dist/schemas/3.1/processed/openapi-object.js.map +2 -2
- package/dist/schemas/3.1/unprocessed/index.d.ts +1 -1
- package/dist/schemas/3.1/unprocessed/index.d.ts.map +1 -1
- package/dist/schemas/3.1/unprocessed/index.js.map +2 -2
- package/dist/schemas/3.1/unprocessed/openapi-object.d.ts +22 -23
- package/dist/schemas/3.1/unprocessed/openapi-object.d.ts.map +1 -1
- package/dist/schemas/3.1/unprocessed/openapi-object.js +55 -1
- package/dist/schemas/3.1/unprocessed/openapi-object.js.map +2 -2
- package/dist/schemas/3.1/unprocessed/paths-object.d.ts +2268 -265
- package/dist/schemas/3.1/unprocessed/paths-object.d.ts.map +1 -1
- package/dist/schemas/3.1/unprocessed/paths-object.js +14 -2
- package/dist/schemas/3.1/unprocessed/paths-object.js.map +2 -2
- package/package.json +8 -3
- package/dist/schemas/3.1/compliance/callback-object.test.js +0 -97
- package/dist/schemas/3.1/compliance/callback-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/contact-object.test.js +0 -19
- package/dist/schemas/3.1/compliance/contact-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/example-object.test.js +0 -91
- package/dist/schemas/3.1/compliance/example-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/external-documentation-object.test.js +0 -17
- package/dist/schemas/3.1/compliance/external-documentation-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/header-object.test.js +0 -47
- package/dist/schemas/3.1/compliance/header-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/info-object.test.js +0 -41
- package/dist/schemas/3.1/compliance/info-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/license-object.test.js +0 -17
- package/dist/schemas/3.1/compliance/license-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/media-type-object.test.js +0 -69
- package/dist/schemas/3.1/compliance/media-type-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/openapi-object.test.js +0 -381
- package/dist/schemas/3.1/compliance/openapi-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/operation-object.test.js +0 -467
- package/dist/schemas/3.1/compliance/operation-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/parameter-object.test.js +0 -155
- package/dist/schemas/3.1/compliance/parameter-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/path-item-object.test.js +0 -103
- package/dist/schemas/3.1/compliance/path-item-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/reference-object.test.js +0 -282
- package/dist/schemas/3.1/compliance/reference-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/request-body-object.test.js +0 -97
- package/dist/schemas/3.1/compliance/request-body-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/response-object.test.js +0 -131
- package/dist/schemas/3.1/compliance/response-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/responses-object.test.js +0 -53
- package/dist/schemas/3.1/compliance/responses-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/runtime-expression.test.js +0 -165
- package/dist/schemas/3.1/compliance/runtime-expression.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/schema-object.test.js +0 -470
- package/dist/schemas/3.1/compliance/schema-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/security-requirement-object.test.js +0 -54
- package/dist/schemas/3.1/compliance/security-requirement-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/security-scheme-object.test.js +0 -123
- package/dist/schemas/3.1/compliance/security-scheme-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/server-object.test.js +0 -17
- package/dist/schemas/3.1/compliance/server-object.test.js.map +0 -7
- package/dist/schemas/3.1/compliance/tag-object.test.js +0 -17
- package/dist/schemas/3.1/compliance/tag-object.test.js.map +0 -7
- package/dist/schemas/3.1/processed/schema-object.test.js +0 -310
- package/dist/schemas/3.1/processed/schema-object.test.js.map +0 -7
- package/dist/schemas/extensions/x-additional-properties-name.test.js +0 -28
- package/dist/schemas/extensions/x-additional-properties-name.test.js.map +0 -7
- package/dist/schemas/extensions/x-code-samples.test.js +0 -82
- package/dist/schemas/extensions/x-code-samples.test.js.map +0 -7
- package/dist/schemas/extensions/x-display-name.test.js +0 -28
- package/dist/schemas/extensions/x-display-name.test.js.map +0 -7
- package/dist/schemas/extensions/x-enum-descriptions.test.js +0 -36
- package/dist/schemas/extensions/x-enum-descriptions.test.js.map +0 -7
- package/dist/schemas/extensions/x-internal.test.js +0 -20
- package/dist/schemas/extensions/x-internal.test.js.map +0 -7
- package/dist/schemas/extensions/x-post-response.test.js +0 -24
- package/dist/schemas/extensions/x-post-response.test.js.map +0 -7
- package/dist/schemas/extensions/x-scalar-icon.test.js +0 -14
- package/dist/schemas/extensions/x-scalar-icon.test.js.map +0 -7
- package/dist/schemas/extensions/x-scalar-ignore.test.js +0 -20
- package/dist/schemas/extensions/x-scalar-ignore.test.js.map +0 -7
- package/dist/schemas/extensions/x-scalar-redirect-uri.test.js +0 -23
- package/dist/schemas/extensions/x-scalar-redirect-uri.test.js.map +0 -7
- package/dist/schemas/extensions/x-scalar-sdk-installation.test.js +0 -25
- package/dist/schemas/extensions/x-scalar-sdk-installation.test.js.map +0 -7
- package/dist/schemas/extensions/x-scalar-security-query.test.js +0 -35
- package/dist/schemas/extensions/x-scalar-security-query.test.js.map +0 -7
- package/dist/schemas/extensions/x-scalar-stability.test.js +0 -33
- package/dist/schemas/extensions/x-scalar-stability.test.js.map +0 -7
- package/dist/schemas/extensions/x-tag-groups.test.js +0 -55
- package/dist/schemas/extensions/x-tag-groups.test.js.map +0 -7
- package/dist/schemas/extensions/x-use-pkce.test.js +0 -34
- package/dist/schemas/extensions/x-use-pkce.test.js.map +0 -7
|
@@ -1,381 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { OpenApiObjectSchema } from "../unprocessed/openapi-object.js";
|
|
3
|
-
describe("openapi-object", () => {
|
|
4
|
-
describe("OpenApiObject", () => {
|
|
5
|
-
describe("Server Object Example", () => {
|
|
6
|
-
it(`The following shows how multiple servers can be described, for example, at the OpenAPI Object's servers`, () => {
|
|
7
|
-
const result = OpenApiObjectSchema.parse({
|
|
8
|
-
openapi: "3.1.1",
|
|
9
|
-
info: {
|
|
10
|
-
title: "Example",
|
|
11
|
-
version: "1.0.0"
|
|
12
|
-
},
|
|
13
|
-
servers: [
|
|
14
|
-
{
|
|
15
|
-
url: "https://development.gigantic-server.com/v1",
|
|
16
|
-
description: "Development server"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
url: "https://staging.gigantic-server.com/v1",
|
|
20
|
-
description: "Staging server"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
url: "https://api.gigantic-server.com/v1",
|
|
24
|
-
description: "Production server"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
});
|
|
28
|
-
expect(result).toEqual({
|
|
29
|
-
openapi: "3.1.1",
|
|
30
|
-
info: {
|
|
31
|
-
title: "Example",
|
|
32
|
-
version: "1.0.0"
|
|
33
|
-
},
|
|
34
|
-
servers: [
|
|
35
|
-
{
|
|
36
|
-
url: "https://development.gigantic-server.com/v1",
|
|
37
|
-
description: "Development server"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
url: "https://staging.gigantic-server.com/v1",
|
|
41
|
-
description: "Staging server"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
url: "https://api.gigantic-server.com/v1",
|
|
45
|
-
description: "Production server"
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
it("The following shows how variables can be used for a server configuration", () => {
|
|
52
|
-
const result = OpenApiObjectSchema.parse({
|
|
53
|
-
openapi: "3.1.1",
|
|
54
|
-
info: {
|
|
55
|
-
title: "Example",
|
|
56
|
-
version: "1.0.0"
|
|
57
|
-
},
|
|
58
|
-
servers: [
|
|
59
|
-
{
|
|
60
|
-
"url": "https://{username}.gigantic-server.com:{port}/{basePath}",
|
|
61
|
-
"description": "The production API server",
|
|
62
|
-
"variables": {
|
|
63
|
-
"username": {
|
|
64
|
-
"default": "demo",
|
|
65
|
-
"description": "A user-specific subdomain. Use `demo` for a free sandbox environment."
|
|
66
|
-
},
|
|
67
|
-
port: {
|
|
68
|
-
enum: ["8443", "443"],
|
|
69
|
-
default: "8443"
|
|
70
|
-
},
|
|
71
|
-
"basePath": {
|
|
72
|
-
"default": "v2"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
-
});
|
|
78
|
-
expect(result).toEqual({
|
|
79
|
-
openapi: "3.1.1",
|
|
80
|
-
info: {
|
|
81
|
-
title: "Example",
|
|
82
|
-
version: "1.0.0"
|
|
83
|
-
},
|
|
84
|
-
servers: [
|
|
85
|
-
{
|
|
86
|
-
url: "https://{username}.gigantic-server.com:{port}/{basePath}",
|
|
87
|
-
description: "The production API server",
|
|
88
|
-
variables: {
|
|
89
|
-
username: {
|
|
90
|
-
default: "demo",
|
|
91
|
-
description: "A user-specific subdomain. Use `demo` for a free sandbox environment."
|
|
92
|
-
},
|
|
93
|
-
port: {
|
|
94
|
-
enum: ["8443", "443"],
|
|
95
|
-
default: "8443"
|
|
96
|
-
},
|
|
97
|
-
basePath: {
|
|
98
|
-
default: "v2"
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
it("Components Object Example", () => {
|
|
106
|
-
const result = OpenApiObjectSchema.parse({
|
|
107
|
-
openapi: "3.1.1",
|
|
108
|
-
info: {
|
|
109
|
-
title: "Example",
|
|
110
|
-
version: "1.0.0"
|
|
111
|
-
},
|
|
112
|
-
components: {
|
|
113
|
-
schemas: {
|
|
114
|
-
GeneralError: {
|
|
115
|
-
type: "object",
|
|
116
|
-
properties: {
|
|
117
|
-
code: {
|
|
118
|
-
type: "integer",
|
|
119
|
-
format: "int32"
|
|
120
|
-
},
|
|
121
|
-
message: {
|
|
122
|
-
type: "string"
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
Category: {
|
|
127
|
-
type: "object",
|
|
128
|
-
properties: {
|
|
129
|
-
id: {
|
|
130
|
-
type: "integer",
|
|
131
|
-
format: "int64"
|
|
132
|
-
},
|
|
133
|
-
name: {
|
|
134
|
-
type: "string"
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
Tag: {
|
|
139
|
-
type: "object",
|
|
140
|
-
properties: {
|
|
141
|
-
id: {
|
|
142
|
-
type: "integer",
|
|
143
|
-
format: "int64"
|
|
144
|
-
},
|
|
145
|
-
name: {
|
|
146
|
-
type: "string"
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
parameters: {
|
|
152
|
-
skipParam: {
|
|
153
|
-
name: "skip",
|
|
154
|
-
in: "query",
|
|
155
|
-
description: "number of items to skip",
|
|
156
|
-
required: true,
|
|
157
|
-
schema: {
|
|
158
|
-
type: "integer",
|
|
159
|
-
format: "int32"
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
limitParam: {
|
|
163
|
-
name: "limit",
|
|
164
|
-
in: "query",
|
|
165
|
-
description: "max records to return",
|
|
166
|
-
required: true,
|
|
167
|
-
schema: {
|
|
168
|
-
type: "integer",
|
|
169
|
-
format: "int32"
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
responses: {
|
|
174
|
-
NotFound: {
|
|
175
|
-
description: "Entity not found."
|
|
176
|
-
},
|
|
177
|
-
IllegalInput: {
|
|
178
|
-
description: "Illegal input for operation."
|
|
179
|
-
},
|
|
180
|
-
GeneralError: {
|
|
181
|
-
description: "General Error",
|
|
182
|
-
content: {
|
|
183
|
-
"application/json": {
|
|
184
|
-
schema: {
|
|
185
|
-
$ref: "#/components/schemas/GeneralError"
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
securitySchemes: {
|
|
192
|
-
api_key: {
|
|
193
|
-
type: "apiKey",
|
|
194
|
-
name: "api-key",
|
|
195
|
-
in: "header"
|
|
196
|
-
},
|
|
197
|
-
petstore_auth: {
|
|
198
|
-
type: "oauth2",
|
|
199
|
-
flows: {
|
|
200
|
-
implicit: {
|
|
201
|
-
authorizationUrl: "https://example.org/api/oauth/dialog",
|
|
202
|
-
scopes: {
|
|
203
|
-
"write:pets": "modify pets in your account",
|
|
204
|
-
"read:pets": "read your pets"
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
expect(result).toEqual({
|
|
213
|
-
openapi: "3.1.1",
|
|
214
|
-
info: {
|
|
215
|
-
title: "Example",
|
|
216
|
-
version: "1.0.0"
|
|
217
|
-
},
|
|
218
|
-
components: {
|
|
219
|
-
schemas: {
|
|
220
|
-
GeneralError: {
|
|
221
|
-
type: "object",
|
|
222
|
-
properties: {
|
|
223
|
-
code: {
|
|
224
|
-
type: "integer",
|
|
225
|
-
format: "int32"
|
|
226
|
-
},
|
|
227
|
-
message: {
|
|
228
|
-
type: "string"
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
Category: {
|
|
233
|
-
type: "object",
|
|
234
|
-
properties: {
|
|
235
|
-
id: {
|
|
236
|
-
type: "integer",
|
|
237
|
-
format: "int64"
|
|
238
|
-
},
|
|
239
|
-
name: {
|
|
240
|
-
type: "string"
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
Tag: {
|
|
245
|
-
type: "object",
|
|
246
|
-
properties: {
|
|
247
|
-
id: {
|
|
248
|
-
type: "integer",
|
|
249
|
-
format: "int64"
|
|
250
|
-
},
|
|
251
|
-
name: {
|
|
252
|
-
type: "string"
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
parameters: {
|
|
258
|
-
skipParam: {
|
|
259
|
-
name: "skip",
|
|
260
|
-
in: "query",
|
|
261
|
-
description: "number of items to skip",
|
|
262
|
-
required: true,
|
|
263
|
-
schema: {
|
|
264
|
-
type: "integer",
|
|
265
|
-
format: "int32"
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
limitParam: {
|
|
269
|
-
name: "limit",
|
|
270
|
-
in: "query",
|
|
271
|
-
description: "max records to return",
|
|
272
|
-
required: true,
|
|
273
|
-
schema: {
|
|
274
|
-
type: "integer",
|
|
275
|
-
format: "int32"
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
},
|
|
279
|
-
responses: {
|
|
280
|
-
NotFound: {
|
|
281
|
-
description: "Entity not found."
|
|
282
|
-
},
|
|
283
|
-
IllegalInput: {
|
|
284
|
-
description: "Illegal input for operation."
|
|
285
|
-
},
|
|
286
|
-
GeneralError: {
|
|
287
|
-
description: "General Error",
|
|
288
|
-
content: {
|
|
289
|
-
"application/json": {
|
|
290
|
-
schema: {
|
|
291
|
-
$ref: "#/components/schemas/GeneralError"
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
securitySchemes: {
|
|
298
|
-
api_key: {
|
|
299
|
-
type: "apiKey",
|
|
300
|
-
name: "api-key",
|
|
301
|
-
in: "header"
|
|
302
|
-
},
|
|
303
|
-
petstore_auth: {
|
|
304
|
-
type: "oauth2",
|
|
305
|
-
flows: {
|
|
306
|
-
implicit: {
|
|
307
|
-
authorizationUrl: "https://example.org/api/oauth/dialog",
|
|
308
|
-
scopes: {
|
|
309
|
-
"write:pets": "modify pets in your account",
|
|
310
|
-
"read:pets": "read your pets"
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
});
|
|
319
|
-
it("Paths Object Example", () => {
|
|
320
|
-
const result = OpenApiObjectSchema.parse({
|
|
321
|
-
openapi: "3.1.1",
|
|
322
|
-
info: {
|
|
323
|
-
title: "Example",
|
|
324
|
-
version: "1.0.0"
|
|
325
|
-
},
|
|
326
|
-
paths: {
|
|
327
|
-
"/pets": {
|
|
328
|
-
get: {
|
|
329
|
-
description: "Returns all pets from the system that the user has access to",
|
|
330
|
-
responses: {
|
|
331
|
-
200: {
|
|
332
|
-
description: "A list of pets.",
|
|
333
|
-
content: {
|
|
334
|
-
"application/json": {
|
|
335
|
-
schema: {
|
|
336
|
-
type: "array",
|
|
337
|
-
items: {
|
|
338
|
-
$ref: "#/components/schemas/pet"
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
expect(result).toEqual({
|
|
350
|
-
openapi: "3.1.1",
|
|
351
|
-
info: {
|
|
352
|
-
title: "Example",
|
|
353
|
-
version: "1.0.0"
|
|
354
|
-
},
|
|
355
|
-
paths: {
|
|
356
|
-
"/pets": {
|
|
357
|
-
get: {
|
|
358
|
-
description: "Returns all pets from the system that the user has access to",
|
|
359
|
-
responses: {
|
|
360
|
-
200: {
|
|
361
|
-
description: "A list of pets.",
|
|
362
|
-
content: {
|
|
363
|
-
"application/json": {
|
|
364
|
-
schema: {
|
|
365
|
-
type: "array",
|
|
366
|
-
items: {
|
|
367
|
-
$ref: "#/components/schemas/pet"
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
});
|
|
378
|
-
});
|
|
379
|
-
});
|
|
380
|
-
});
|
|
381
|
-
//# sourceMappingURL=openapi-object.test.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/schemas/3.1/compliance/openapi-object.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { describe, expect, it } from 'vitest'\n\nimport { OpenApiObjectSchema } from '../unprocessed/openapi-object'\n\ndescribe('openapi-object', () => {\n describe('OpenApiObject', () => {\n // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#server-object-example\n describe('Server Object Example', () => {\n it(`The following shows how multiple servers can be described, for example, at the OpenAPI Object's servers`, () => {\n const result = OpenApiObjectSchema.parse({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n servers: [\n {\n url: 'https://development.gigantic-server.com/v1',\n description: 'Development server',\n },\n {\n url: 'https://staging.gigantic-server.com/v1',\n description: 'Staging server',\n },\n {\n url: 'https://api.gigantic-server.com/v1',\n description: 'Production server',\n },\n ],\n })\n\n expect(result).toEqual({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n servers: [\n {\n url: 'https://development.gigantic-server.com/v1',\n description: 'Development server',\n },\n {\n url: 'https://staging.gigantic-server.com/v1',\n description: 'Staging server',\n },\n {\n url: 'https://api.gigantic-server.com/v1',\n description: 'Production server',\n },\n ],\n })\n })\n })\n\n it('The following shows how variables can be used for a server configuration', () => {\n const result = OpenApiObjectSchema.parse({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n servers: [\n {\n 'url': 'https://{username}.gigantic-server.com:{port}/{basePath}',\n 'description': 'The production API server',\n 'variables': {\n 'username': {\n 'default': 'demo',\n 'description': 'A user-specific subdomain. Use `demo` for a free sandbox environment.',\n },\n port: {\n enum: ['8443', '443'],\n default: '8443',\n },\n 'basePath': {\n 'default': 'v2',\n },\n },\n },\n ],\n })\n\n expect(result).toEqual({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n servers: [\n {\n url: 'https://{username}.gigantic-server.com:{port}/{basePath}',\n description: 'The production API server',\n variables: {\n username: {\n default: 'demo',\n description: 'A user-specific subdomain. Use `demo` for a free sandbox environment.',\n },\n port: {\n enum: ['8443', '443'],\n default: '8443',\n },\n basePath: {\n default: 'v2',\n },\n },\n },\n ],\n })\n })\n\n // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#components-object-example\n it('Components Object Example', () => {\n const result = OpenApiObjectSchema.parse({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n components: {\n schemas: {\n GeneralError: {\n type: 'object',\n properties: {\n code: {\n type: 'integer',\n format: 'int32',\n },\n message: {\n type: 'string',\n },\n },\n },\n Category: {\n type: 'object',\n properties: {\n id: {\n type: 'integer',\n format: 'int64',\n },\n name: {\n type: 'string',\n },\n },\n },\n Tag: {\n type: 'object',\n properties: {\n id: {\n type: 'integer',\n format: 'int64',\n },\n name: {\n type: 'string',\n },\n },\n },\n },\n parameters: {\n skipParam: {\n name: 'skip',\n in: 'query',\n description: 'number of items to skip',\n required: true,\n schema: {\n type: 'integer',\n format: 'int32',\n },\n },\n limitParam: {\n name: 'limit',\n in: 'query',\n description: 'max records to return',\n required: true,\n schema: {\n type: 'integer',\n format: 'int32',\n },\n },\n },\n responses: {\n NotFound: {\n description: 'Entity not found.',\n },\n IllegalInput: {\n description: 'Illegal input for operation.',\n },\n GeneralError: {\n description: 'General Error',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/GeneralError',\n },\n },\n },\n },\n },\n securitySchemes: {\n api_key: {\n type: 'apiKey',\n name: 'api-key',\n in: 'header',\n },\n petstore_auth: {\n type: 'oauth2',\n flows: {\n implicit: {\n authorizationUrl: 'https://example.org/api/oauth/dialog',\n scopes: {\n 'write:pets': 'modify pets in your account',\n 'read:pets': 'read your pets',\n },\n },\n },\n },\n },\n },\n })\n\n expect(result).toEqual({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n components: {\n schemas: {\n GeneralError: {\n type: 'object',\n properties: {\n code: {\n type: 'integer',\n format: 'int32',\n },\n message: {\n type: 'string',\n },\n },\n },\n Category: {\n type: 'object',\n properties: {\n id: {\n type: 'integer',\n format: 'int64',\n },\n name: {\n type: 'string',\n },\n },\n },\n Tag: {\n type: 'object',\n properties: {\n id: {\n type: 'integer',\n format: 'int64',\n },\n name: {\n type: 'string',\n },\n },\n },\n },\n parameters: {\n skipParam: {\n name: 'skip',\n in: 'query',\n description: 'number of items to skip',\n required: true,\n schema: {\n type: 'integer',\n format: 'int32',\n },\n },\n limitParam: {\n name: 'limit',\n in: 'query',\n description: 'max records to return',\n required: true,\n schema: {\n type: 'integer',\n format: 'int32',\n },\n },\n },\n responses: {\n NotFound: {\n description: 'Entity not found.',\n },\n IllegalInput: {\n description: 'Illegal input for operation.',\n },\n GeneralError: {\n description: 'General Error',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/GeneralError',\n },\n },\n },\n },\n },\n securitySchemes: {\n api_key: {\n type: 'apiKey',\n name: 'api-key',\n in: 'header',\n },\n petstore_auth: {\n type: 'oauth2',\n flows: {\n implicit: {\n authorizationUrl: 'https://example.org/api/oauth/dialog',\n scopes: {\n 'write:pets': 'modify pets in your account',\n 'read:pets': 'read your pets',\n },\n },\n },\n },\n },\n },\n })\n })\n\n // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#paths-object-example\n it('Paths Object Example', () => {\n const result = OpenApiObjectSchema.parse({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n paths: {\n '/pets': {\n get: {\n description: 'Returns all pets from the system that the user has access to',\n responses: {\n 200: {\n description: 'A list of pets.',\n content: {\n 'application/json': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/pet',\n },\n },\n },\n },\n },\n },\n },\n },\n },\n })\n\n expect(result).toEqual({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n paths: {\n '/pets': {\n get: {\n description: 'Returns all pets from the system that the user has access to',\n responses: {\n 200: {\n description: 'A list of pets.',\n content: {\n 'application/json': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/pet',\n },\n },\n },\n },\n },\n },\n },\n },\n },\n })\n })\n })\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,UAAU,QAAQ,UAAU;AAErC,SAAS,2BAA2B;AAEpC,SAAS,kBAAkB,MAAM;AAC/B,WAAS,iBAAiB,MAAM;AAE9B,aAAS,yBAAyB,MAAM;AACtC,SAAG,2GAA2G,MAAM;AAClH,cAAM,SAAS,oBAAoB,MAAM;AAAA,UACvC,SAAS;AAAA,UACT,MAAM;AAAA,YACJ,OAAO;AAAA,YACP,SAAS;AAAA,UACX;AAAA,UACA,SAAS;AAAA,YACP;AAAA,cACE,KAAK;AAAA,cACL,aAAa;AAAA,YACf;AAAA,YACA;A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