@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.
Files changed (107) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/helpers/index.d.ts +2 -0
  3. package/dist/helpers/index.d.ts.map +1 -0
  4. package/dist/helpers/index.js +5 -0
  5. package/dist/helpers/index.js.map +7 -0
  6. package/dist/helpers/is-dereferenced.d.ts +7 -0
  7. package/dist/helpers/is-dereferenced.d.ts.map +1 -0
  8. package/dist/helpers/is-dereferenced.js +5 -0
  9. package/dist/helpers/is-dereferenced.js.map +7 -0
  10. package/dist/openapi-types.d.ts +9 -18
  11. package/dist/openapi-types.d.ts.map +1 -1
  12. package/dist/openapi-types.js +1 -16
  13. package/dist/openapi-types.js.map +3 -3
  14. package/dist/openapi-types.test-d.js.map +2 -2
  15. package/dist/schemas/3.1/processed/index.d.ts +1 -1
  16. package/dist/schemas/3.1/processed/index.d.ts.map +1 -1
  17. package/dist/schemas/3.1/processed/index.js.map +2 -2
  18. package/dist/schemas/3.1/processed/openapi-object.d.ts +30835 -22
  19. package/dist/schemas/3.1/processed/openapi-object.d.ts.map +1 -1
  20. package/dist/schemas/3.1/processed/openapi-object.js +1 -1
  21. package/dist/schemas/3.1/processed/openapi-object.js.map +2 -2
  22. package/dist/schemas/3.1/unprocessed/index.d.ts +1 -1
  23. package/dist/schemas/3.1/unprocessed/index.d.ts.map +1 -1
  24. package/dist/schemas/3.1/unprocessed/index.js.map +2 -2
  25. package/dist/schemas/3.1/unprocessed/openapi-object.d.ts +22 -23
  26. package/dist/schemas/3.1/unprocessed/openapi-object.d.ts.map +1 -1
  27. package/dist/schemas/3.1/unprocessed/openapi-object.js +55 -1
  28. package/dist/schemas/3.1/unprocessed/openapi-object.js.map +2 -2
  29. package/dist/schemas/3.1/unprocessed/paths-object.d.ts +2268 -265
  30. package/dist/schemas/3.1/unprocessed/paths-object.d.ts.map +1 -1
  31. package/dist/schemas/3.1/unprocessed/paths-object.js +14 -2
  32. package/dist/schemas/3.1/unprocessed/paths-object.js.map +2 -2
  33. package/package.json +8 -3
  34. package/dist/schemas/3.1/compliance/callback-object.test.js +0 -97
  35. package/dist/schemas/3.1/compliance/callback-object.test.js.map +0 -7
  36. package/dist/schemas/3.1/compliance/contact-object.test.js +0 -19
  37. package/dist/schemas/3.1/compliance/contact-object.test.js.map +0 -7
  38. package/dist/schemas/3.1/compliance/example-object.test.js +0 -91
  39. package/dist/schemas/3.1/compliance/example-object.test.js.map +0 -7
  40. package/dist/schemas/3.1/compliance/external-documentation-object.test.js +0 -17
  41. package/dist/schemas/3.1/compliance/external-documentation-object.test.js.map +0 -7
  42. package/dist/schemas/3.1/compliance/header-object.test.js +0 -47
  43. package/dist/schemas/3.1/compliance/header-object.test.js.map +0 -7
  44. package/dist/schemas/3.1/compliance/info-object.test.js +0 -41
  45. package/dist/schemas/3.1/compliance/info-object.test.js.map +0 -7
  46. package/dist/schemas/3.1/compliance/license-object.test.js +0 -17
  47. package/dist/schemas/3.1/compliance/license-object.test.js.map +0 -7
  48. package/dist/schemas/3.1/compliance/media-type-object.test.js +0 -69
  49. package/dist/schemas/3.1/compliance/media-type-object.test.js.map +0 -7
  50. package/dist/schemas/3.1/compliance/openapi-object.test.js +0 -381
  51. package/dist/schemas/3.1/compliance/openapi-object.test.js.map +0 -7
  52. package/dist/schemas/3.1/compliance/operation-object.test.js +0 -467
  53. package/dist/schemas/3.1/compliance/operation-object.test.js.map +0 -7
  54. package/dist/schemas/3.1/compliance/parameter-object.test.js +0 -155
  55. package/dist/schemas/3.1/compliance/parameter-object.test.js.map +0 -7
  56. package/dist/schemas/3.1/compliance/path-item-object.test.js +0 -103
  57. package/dist/schemas/3.1/compliance/path-item-object.test.js.map +0 -7
  58. package/dist/schemas/3.1/compliance/reference-object.test.js +0 -282
  59. package/dist/schemas/3.1/compliance/reference-object.test.js.map +0 -7
  60. package/dist/schemas/3.1/compliance/request-body-object.test.js +0 -97
  61. package/dist/schemas/3.1/compliance/request-body-object.test.js.map +0 -7
  62. package/dist/schemas/3.1/compliance/response-object.test.js +0 -131
  63. package/dist/schemas/3.1/compliance/response-object.test.js.map +0 -7
  64. package/dist/schemas/3.1/compliance/responses-object.test.js +0 -53
  65. package/dist/schemas/3.1/compliance/responses-object.test.js.map +0 -7
  66. package/dist/schemas/3.1/compliance/runtime-expression.test.js +0 -165
  67. package/dist/schemas/3.1/compliance/runtime-expression.test.js.map +0 -7
  68. package/dist/schemas/3.1/compliance/schema-object.test.js +0 -470
  69. package/dist/schemas/3.1/compliance/schema-object.test.js.map +0 -7
  70. package/dist/schemas/3.1/compliance/security-requirement-object.test.js +0 -54
  71. package/dist/schemas/3.1/compliance/security-requirement-object.test.js.map +0 -7
  72. package/dist/schemas/3.1/compliance/security-scheme-object.test.js +0 -123
  73. package/dist/schemas/3.1/compliance/security-scheme-object.test.js.map +0 -7
  74. package/dist/schemas/3.1/compliance/server-object.test.js +0 -17
  75. package/dist/schemas/3.1/compliance/server-object.test.js.map +0 -7
  76. package/dist/schemas/3.1/compliance/tag-object.test.js +0 -17
  77. package/dist/schemas/3.1/compliance/tag-object.test.js.map +0 -7
  78. package/dist/schemas/3.1/processed/schema-object.test.js +0 -310
  79. package/dist/schemas/3.1/processed/schema-object.test.js.map +0 -7
  80. package/dist/schemas/extensions/x-additional-properties-name.test.js +0 -28
  81. package/dist/schemas/extensions/x-additional-properties-name.test.js.map +0 -7
  82. package/dist/schemas/extensions/x-code-samples.test.js +0 -82
  83. package/dist/schemas/extensions/x-code-samples.test.js.map +0 -7
  84. package/dist/schemas/extensions/x-display-name.test.js +0 -28
  85. package/dist/schemas/extensions/x-display-name.test.js.map +0 -7
  86. package/dist/schemas/extensions/x-enum-descriptions.test.js +0 -36
  87. package/dist/schemas/extensions/x-enum-descriptions.test.js.map +0 -7
  88. package/dist/schemas/extensions/x-internal.test.js +0 -20
  89. package/dist/schemas/extensions/x-internal.test.js.map +0 -7
  90. package/dist/schemas/extensions/x-post-response.test.js +0 -24
  91. package/dist/schemas/extensions/x-post-response.test.js.map +0 -7
  92. package/dist/schemas/extensions/x-scalar-icon.test.js +0 -14
  93. package/dist/schemas/extensions/x-scalar-icon.test.js.map +0 -7
  94. package/dist/schemas/extensions/x-scalar-ignore.test.js +0 -20
  95. package/dist/schemas/extensions/x-scalar-ignore.test.js.map +0 -7
  96. package/dist/schemas/extensions/x-scalar-redirect-uri.test.js +0 -23
  97. package/dist/schemas/extensions/x-scalar-redirect-uri.test.js.map +0 -7
  98. package/dist/schemas/extensions/x-scalar-sdk-installation.test.js +0 -25
  99. package/dist/schemas/extensions/x-scalar-sdk-installation.test.js.map +0 -7
  100. package/dist/schemas/extensions/x-scalar-security-query.test.js +0 -35
  101. package/dist/schemas/extensions/x-scalar-security-query.test.js.map +0 -7
  102. package/dist/schemas/extensions/x-scalar-stability.test.js +0 -33
  103. package/dist/schemas/extensions/x-scalar-stability.test.js.map +0 -7
  104. package/dist/schemas/extensions/x-tag-groups.test.js +0 -55
  105. package/dist/schemas/extensions/x-tag-groups.test.js.map +0 -7
  106. package/dist/schemas/extensions/x-use-pkce.test.js +0 -34
  107. package/dist/schemas/extensions/x-use-pkce.test.js.map +0 -7
@@ -1,470 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { ComponentsObjectSchema } from "../unprocessed/components-object.js";
3
- import { SchemaObjectSchema } from "../unprocessed/schema-object.js";
4
- describe("schema-object", () => {
5
- describe("SchemaObjectSchema", () => {
6
- describe("Schema Object Examples", () => {
7
- it("Primitive Example", () => {
8
- const result = SchemaObjectSchema.parse({
9
- type: "string",
10
- format: "email"
11
- });
12
- expect(result).toEqual({
13
- type: "string",
14
- format: "email"
15
- });
16
- });
17
- it("Simple Model", () => {
18
- const result = SchemaObjectSchema.parse({
19
- type: "object",
20
- required: ["name"],
21
- properties: {
22
- name: {
23
- type: "string"
24
- },
25
- address: {
26
- $ref: "#/components/schemas/Address"
27
- },
28
- age: {
29
- type: "integer",
30
- format: "int32",
31
- minimum: 0
32
- }
33
- }
34
- });
35
- expect(result).toEqual({
36
- type: "object",
37
- required: ["name"],
38
- properties: {
39
- name: {
40
- type: "string"
41
- },
42
- address: {
43
- $ref: "#/components/schemas/Address"
44
- },
45
- age: {
46
- type: "integer",
47
- format: "int32",
48
- minimum: 0
49
- }
50
- }
51
- });
52
- });
53
- describe("Model with Map/Dictionary Properties", () => {
54
- it("For a simple string to string mapping", () => {
55
- const result = SchemaObjectSchema.parse({
56
- type: "object",
57
- additionalProperties: {
58
- type: "string"
59
- }
60
- });
61
- expect(result).toEqual({
62
- type: "object",
63
- additionalProperties: {
64
- type: "string"
65
- }
66
- });
67
- });
68
- it("For a string to model mapping", () => {
69
- const result = SchemaObjectSchema.parse({
70
- type: "object",
71
- additionalProperties: {
72
- $ref: "#/components/schemas/ComplexModel"
73
- }
74
- });
75
- expect(result).toEqual({
76
- type: "object",
77
- additionalProperties: {
78
- $ref: "#/components/schemas/ComplexModel"
79
- }
80
- });
81
- });
82
- });
83
- });
84
- it("Model with Annotated Enumeration", () => {
85
- const result = SchemaObjectSchema.parse({
86
- oneOf: [
87
- {
88
- const: "RGB",
89
- title: "Red, Green, Blue",
90
- description: "Specify colors with the red, green, and blue additive color model"
91
- },
92
- {
93
- const: "CMYK",
94
- title: "Cyan, Magenta, Yellow, Black",
95
- description: "Specify colors with the cyan, magenta, yellow, and black subtractive color model"
96
- }
97
- ]
98
- });
99
- expect(result).toEqual({
100
- oneOf: [
101
- {
102
- const: "RGB",
103
- title: "Red, Green, Blue",
104
- description: "Specify colors with the red, green, and blue additive color model"
105
- },
106
- {
107
- const: "CMYK",
108
- title: "Cyan, Magenta, Yellow, Black",
109
- description: "Specify colors with the cyan, magenta, yellow, and black subtractive color model"
110
- }
111
- ]
112
- });
113
- });
114
- it("Model with Example", () => {
115
- const result = SchemaObjectSchema.parse({
116
- type: "object",
117
- properties: {
118
- id: {
119
- type: "integer",
120
- format: "int64"
121
- },
122
- name: {
123
- type: "string"
124
- }
125
- },
126
- required: ["name"],
127
- examples: [
128
- {
129
- name: "Puma",
130
- id: 1
131
- }
132
- ]
133
- });
134
- expect(result).toEqual({
135
- type: "object",
136
- properties: {
137
- id: {
138
- type: "integer",
139
- format: "int64"
140
- },
141
- name: {
142
- type: "string"
143
- }
144
- },
145
- required: ["name"],
146
- examples: [
147
- {
148
- name: "Puma",
149
- id: 1
150
- }
151
- ]
152
- });
153
- });
154
- it("Models with Composition", () => {
155
- const result = ComponentsObjectSchema.parse({
156
- schemas: {
157
- ErrorModel: {
158
- type: "object",
159
- required: ["message", "code"],
160
- properties: {
161
- message: {
162
- type: "string"
163
- },
164
- code: {
165
- type: "integer",
166
- minimum: 100,
167
- maximum: 600
168
- }
169
- }
170
- },
171
- ExtendedErrorModel: {
172
- allOf: [
173
- {
174
- $ref: "#/components/schemas/ErrorModel"
175
- },
176
- {
177
- type: "object",
178
- required: ["rootCause"],
179
- properties: {
180
- rootCause: {
181
- type: "string"
182
- }
183
- }
184
- }
185
- ]
186
- }
187
- }
188
- });
189
- expect(result).toEqual({
190
- schemas: {
191
- ErrorModel: {
192
- type: "object",
193
- required: ["message", "code"],
194
- properties: {
195
- message: {
196
- type: "string"
197
- },
198
- code: {
199
- type: "integer",
200
- minimum: 100,
201
- maximum: 600
202
- }
203
- }
204
- },
205
- ExtendedErrorModel: {
206
- allOf: [
207
- {
208
- $ref: "#/components/schemas/ErrorModel"
209
- },
210
- {
211
- type: "object",
212
- required: ["rootCause"],
213
- properties: {
214
- rootCause: {
215
- type: "string"
216
- }
217
- }
218
- }
219
- ]
220
- }
221
- }
222
- });
223
- });
224
- it("Models with Polymorphism Support", () => {
225
- const result = ComponentsObjectSchema.parse({
226
- schemas: {
227
- Pet: {
228
- type: "object",
229
- discriminator: {
230
- propertyName: "petType"
231
- },
232
- properties: {
233
- name: {
234
- type: "string"
235
- },
236
- petType: {
237
- type: "string"
238
- }
239
- },
240
- required: ["name", "petType"]
241
- },
242
- Cat: {
243
- description: "A representation of a cat. Note that `Cat` will be used as the discriminating value.",
244
- allOf: [
245
- {
246
- $ref: "#/components/schemas/Pet"
247
- },
248
- {
249
- type: "object",
250
- properties: {
251
- huntingSkill: {
252
- type: "string",
253
- description: "The measured skill for hunting",
254
- default: "lazy",
255
- enum: ["clueless", "lazy", "adventurous", "aggressive"]
256
- }
257
- },
258
- "required": ["huntingSkill"]
259
- }
260
- ]
261
- },
262
- Dog: {
263
- description: "A representation of a dog. Note that `Dog` will be used as the discriminating value.",
264
- allOf: [
265
- {
266
- $ref: "#/components/schemas/Pet"
267
- },
268
- {
269
- type: "object",
270
- properties: {
271
- packSize: {
272
- type: "integer",
273
- format: "int32",
274
- description: "the size of the pack the dog is from",
275
- default: 0,
276
- "minimum": 0
277
- }
278
- },
279
- required: ["packSize"]
280
- }
281
- ]
282
- }
283
- }
284
- });
285
- expect(result).toEqual({
286
- schemas: {
287
- Pet: {
288
- type: "object",
289
- discriminator: {
290
- propertyName: "petType"
291
- },
292
- properties: {
293
- name: {
294
- type: "string"
295
- },
296
- petType: {
297
- type: "string"
298
- }
299
- },
300
- required: ["name", "petType"]
301
- },
302
- Cat: {
303
- description: "A representation of a cat. Note that `Cat` will be used as the discriminating value.",
304
- allOf: [
305
- {
306
- $ref: "#/components/schemas/Pet"
307
- },
308
- {
309
- type: "object",
310
- properties: {
311
- huntingSkill: {
312
- type: "string",
313
- description: "The measured skill for hunting",
314
- default: "lazy",
315
- enum: ["clueless", "lazy", "adventurous", "aggressive"]
316
- }
317
- },
318
- "required": ["huntingSkill"]
319
- }
320
- ]
321
- },
322
- Dog: {
323
- description: "A representation of a dog. Note that `Dog` will be used as the discriminating value.",
324
- allOf: [
325
- {
326
- $ref: "#/components/schemas/Pet"
327
- },
328
- {
329
- type: "object",
330
- properties: {
331
- packSize: {
332
- type: "integer",
333
- format: "int32",
334
- description: "the size of the pack the dog is from",
335
- default: 0,
336
- "minimum": 0
337
- }
338
- },
339
- required: ["packSize"]
340
- }
341
- ]
342
- }
343
- }
344
- });
345
- });
346
- it("Generic Data Structure Model", () => {
347
- const result = ComponentsObjectSchema.parse({
348
- schemas: {
349
- genericArrayComponent: {
350
- $id: "fully_generic_array",
351
- type: "array",
352
- items: {
353
- $dynamicRef: "#generic-array"
354
- },
355
- $defs: {
356
- allowAll: {
357
- $dynamicAnchor: "generic-array"
358
- }
359
- }
360
- },
361
- numberArray: {
362
- $id: "array_of_numbers",
363
- $ref: "fully_generic_array",
364
- $defs: {
365
- numbersOnly: {
366
- "$dynamicAnchor": "generic-array",
367
- "type": "number"
368
- }
369
- }
370
- },
371
- stringArray: {
372
- $id: "array_of_strings",
373
- $ref: "fully_generic_array",
374
- $defs: {
375
- stringsOnly: {
376
- $dynamicAnchor: "generic-array",
377
- type: "string"
378
- }
379
- }
380
- },
381
- objWithTypedArray: {
382
- $id: "obj_with_typed_array",
383
- type: "object",
384
- required: ["dataType", "data"],
385
- properties: {
386
- dataType: {
387
- enum: ["string", "number"]
388
- }
389
- },
390
- oneOf: [
391
- {
392
- properties: {
393
- dataType: { const: "string" },
394
- data: { $ref: "array_of_strings" }
395
- }
396
- },
397
- {
398
- properties: {
399
- dataType: { const: "number" },
400
- data: { $ref: "array_of_numbers" }
401
- }
402
- }
403
- ]
404
- }
405
- }
406
- });
407
- expect(result).toEqual({
408
- schemas: {
409
- genericArrayComponent: {
410
- $id: "fully_generic_array",
411
- type: "array",
412
- items: {
413
- $dynamicRef: "#generic-array"
414
- },
415
- $defs: {
416
- allowAll: {
417
- $dynamicAnchor: "generic-array"
418
- }
419
- }
420
- },
421
- numberArray: {
422
- $id: "array_of_numbers",
423
- $ref: "fully_generic_array",
424
- $defs: {
425
- numbersOnly: {
426
- "$dynamicAnchor": "generic-array",
427
- "type": "number"
428
- }
429
- }
430
- },
431
- stringArray: {
432
- $id: "array_of_strings",
433
- $ref: "fully_generic_array",
434
- $defs: {
435
- stringsOnly: {
436
- $dynamicAnchor: "generic-array",
437
- type: "string"
438
- }
439
- }
440
- },
441
- objWithTypedArray: {
442
- $id: "obj_with_typed_array",
443
- type: "object",
444
- required: ["dataType", "data"],
445
- properties: {
446
- dataType: {
447
- enum: ["string", "number"]
448
- }
449
- },
450
- oneOf: [
451
- {
452
- properties: {
453
- dataType: { const: "string" },
454
- data: { $ref: "array_of_strings" }
455
- }
456
- },
457
- {
458
- properties: {
459
- dataType: { const: "number" },
460
- data: { $ref: "array_of_numbers" }
461
- }
462
- }
463
- ]
464
- }
465
- }
466
- });
467
- });
468
- });
469
- });
470
- //# sourceMappingURL=schema-object.test.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/schemas/3.1/compliance/schema-object.test.ts"],
4
- "sourcesContent": ["import { describe, expect, it } from 'vitest'\n\nimport { ComponentsObjectSchema } from '../unprocessed/components-object'\nimport { SchemaObjectSchema } from '../unprocessed/schema-object'\n\ndescribe('schema-object', () => {\n describe('SchemaObjectSchema', () => {\n // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#schema-object-example\n describe('Schema Object Examples', () => {\n it('Primitive Example', () => {\n const result = SchemaObjectSchema.parse({\n type: 'string',\n format: 'email',\n })\n\n expect(result).toEqual({\n type: 'string',\n format: 'email',\n })\n })\n\n it('Simple Model', () => {\n const result = SchemaObjectSchema.parse({\n type: 'object',\n required: ['name'],\n properties: {\n name: {\n type: 'string',\n },\n address: {\n $ref: '#/components/schemas/Address',\n },\n age: {\n type: 'integer',\n format: 'int32',\n minimum: 0,\n },\n },\n })\n\n expect(result).toEqual({\n type: 'object',\n required: ['name'],\n properties: {\n name: {\n type: 'string',\n },\n address: {\n $ref: '#/components/schemas/Address',\n },\n age: {\n type: 'integer',\n format: 'int32',\n minimum: 0,\n },\n },\n })\n })\n\n describe('Model with Map/Dictionary Properties', () => {\n it('For a simple string to string mapping', () => {\n const result = SchemaObjectSchema.parse({\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n })\n\n expect(result).toEqual({\n type: 'object',\n additionalProperties: {\n type: 'string',\n },\n })\n })\n\n it('For a string to model mapping', () => {\n const result = SchemaObjectSchema.parse({\n type: 'object',\n additionalProperties: {\n $ref: '#/components/schemas/ComplexModel',\n },\n })\n\n expect(result).toEqual({\n type: 'object',\n additionalProperties: {\n $ref: '#/components/schemas/ComplexModel',\n },\n })\n })\n })\n })\n\n it('Model with Annotated Enumeration', () => {\n const result = SchemaObjectSchema.parse({\n oneOf: [\n {\n const: 'RGB',\n title: 'Red, Green, Blue',\n description: 'Specify colors with the red, green, and blue additive color model',\n },\n {\n const: 'CMYK',\n title: 'Cyan, Magenta, Yellow, Black',\n description: 'Specify colors with the cyan, magenta, yellow, and black subtractive color model',\n },\n ],\n })\n\n expect(result).toEqual({\n oneOf: [\n {\n const: 'RGB',\n title: 'Red, Green, Blue',\n description: 'Specify colors with the red, green, and blue additive color model',\n },\n {\n const: 'CMYK',\n title: 'Cyan, Magenta, Yellow, Black',\n description: 'Specify colors with the cyan, magenta, yellow, and black subtractive color model',\n },\n ],\n })\n })\n\n it('Model with Example', () => {\n const result = SchemaObjectSchema.parse({\n type: 'object',\n properties: {\n id: {\n type: 'integer',\n format: 'int64',\n },\n name: {\n type: 'string',\n },\n },\n required: ['name'],\n examples: [\n {\n name: 'Puma',\n id: 1,\n },\n ],\n })\n\n expect(result).toEqual({\n type: 'object',\n properties: {\n id: {\n type: 'integer',\n format: 'int64',\n },\n name: {\n type: 'string',\n },\n },\n required: ['name'],\n examples: [\n {\n name: 'Puma',\n id: 1,\n },\n ],\n })\n })\n\n it('Models with Composition', () => {\n const result = ComponentsObjectSchema.parse({\n schemas: {\n ErrorModel: {\n type: 'object',\n required: ['message', 'code'],\n properties: {\n message: {\n type: 'string',\n },\n code: {\n type: 'integer',\n minimum: 100,\n maximum: 600,\n },\n },\n },\n ExtendedErrorModel: {\n allOf: [\n {\n $ref: '#/components/schemas/ErrorModel',\n },\n {\n type: 'object',\n required: ['rootCause'],\n properties: {\n rootCause: {\n type: 'string',\n },\n },\n },\n ],\n },\n },\n })\n\n expect(result).toEqual({\n schemas: {\n ErrorModel: {\n type: 'object',\n required: ['message', 'code'],\n properties: {\n message: {\n type: 'string',\n },\n code: {\n type: 'integer',\n minimum: 100,\n maximum: 600,\n },\n },\n },\n ExtendedErrorModel: {\n allOf: [\n {\n $ref: '#/components/schemas/ErrorModel',\n },\n {\n type: 'object',\n required: ['rootCause'],\n properties: {\n rootCause: {\n type: 'string',\n },\n },\n },\n ],\n },\n },\n })\n })\n\n it('Models with Polymorphism Support', () => {\n const result = ComponentsObjectSchema.parse({\n schemas: {\n Pet: {\n type: 'object',\n discriminator: {\n propertyName: 'petType',\n },\n properties: {\n name: {\n type: 'string',\n },\n petType: {\n type: 'string',\n },\n },\n required: ['name', 'petType'],\n },\n Cat: {\n description: 'A representation of a cat. Note that `Cat` will be used as the discriminating value.',\n allOf: [\n {\n $ref: '#/components/schemas/Pet',\n },\n {\n type: 'object',\n properties: {\n huntingSkill: {\n type: 'string',\n description: 'The measured skill for hunting',\n default: 'lazy',\n enum: ['clueless', 'lazy', 'adventurous', 'aggressive'],\n },\n },\n 'required': ['huntingSkill'],\n },\n ],\n },\n Dog: {\n description: 'A representation of a dog. Note that `Dog` will be used as the discriminating value.',\n allOf: [\n {\n $ref: '#/components/schemas/Pet',\n },\n {\n type: 'object',\n properties: {\n packSize: {\n type: 'integer',\n format: 'int32',\n description: 'the size of the pack the dog is from',\n default: 0,\n 'minimum': 0,\n },\n },\n required: ['packSize'],\n },\n ],\n },\n },\n })\n\n expect(result).toEqual({\n schemas: {\n Pet: {\n type: 'object',\n discriminator: {\n propertyName: 'petType',\n },\n properties: {\n name: {\n type: 'string',\n },\n petType: {\n type: 'string',\n },\n },\n required: ['name', 'petType'],\n },\n Cat: {\n description: 'A representation of a cat. Note that `Cat` will be used as the discriminating value.',\n allOf: [\n {\n $ref: '#/components/schemas/Pet',\n },\n {\n type: 'object',\n properties: {\n huntingSkill: {\n type: 'string',\n description: 'The measured skill for hunting',\n default: 'lazy',\n enum: ['clueless', 'lazy', 'adventurous', 'aggressive'],\n },\n },\n 'required': ['huntingSkill'],\n },\n ],\n },\n Dog: {\n description: 'A representation of a dog. Note that `Dog` will be used as the discriminating value.',\n allOf: [\n {\n $ref: '#/components/schemas/Pet',\n },\n {\n type: 'object',\n properties: {\n packSize: {\n type: 'integer',\n format: 'int32',\n description: 'the size of the pack the dog is from',\n default: 0,\n 'minimum': 0,\n },\n },\n required: ['packSize'],\n },\n ],\n },\n },\n })\n })\n\n it('Generic Data Structure Model', () => {\n const result = ComponentsObjectSchema.parse({\n schemas: {\n genericArrayComponent: {\n $id: 'fully_generic_array',\n type: 'array',\n items: {\n $dynamicRef: '#generic-array',\n },\n $defs: {\n allowAll: {\n $dynamicAnchor: 'generic-array',\n },\n },\n },\n numberArray: {\n $id: 'array_of_numbers',\n $ref: 'fully_generic_array',\n $defs: {\n numbersOnly: {\n '$dynamicAnchor': 'generic-array',\n 'type': 'number',\n },\n },\n },\n stringArray: {\n $id: 'array_of_strings',\n $ref: 'fully_generic_array',\n $defs: {\n stringsOnly: {\n $dynamicAnchor: 'generic-array',\n type: 'string',\n },\n },\n },\n objWithTypedArray: {\n $id: 'obj_with_typed_array',\n type: 'object',\n required: ['dataType', 'data'],\n properties: {\n dataType: {\n enum: ['string', 'number'],\n },\n },\n oneOf: [\n {\n properties: {\n dataType: { const: 'string' },\n data: { $ref: 'array_of_strings' },\n },\n },\n {\n properties: {\n dataType: { const: 'number' },\n data: { $ref: 'array_of_numbers' },\n },\n },\n ],\n },\n },\n })\n\n expect(result).toEqual({\n schemas: {\n genericArrayComponent: {\n $id: 'fully_generic_array',\n type: 'array',\n items: {\n $dynamicRef: '#generic-array',\n },\n $defs: {\n allowAll: {\n $dynamicAnchor: 'generic-array',\n },\n },\n },\n numberArray: {\n $id: 'array_of_numbers',\n $ref: 'fully_generic_array',\n $defs: {\n numbersOnly: {\n '$dynamicAnchor': 'generic-array',\n 'type': 'number',\n },\n },\n },\n stringArray: {\n $id: 'array_of_strings',\n $ref: 'fully_generic_array',\n $defs: {\n stringsOnly: {\n $dynamicAnchor: 'generic-array',\n type: 'string',\n },\n },\n },\n objWithTypedArray: {\n $id: 'obj_with_typed_array',\n type: 'object',\n required: ['dataType', 'data'],\n properties: {\n dataType: {\n enum: ['string', 'number'],\n },\n },\n oneOf: [\n {\n properties: {\n dataType: { const: 'string' },\n data: { $ref: 'array_of_strings' },\n },\n },\n {\n properties: {\n dataType: { const: 'number' },\n data: { $ref: 'array_of_numbers' },\n },\n },\n ],\n },\n },\n })\n })\n })\n})\n"],
5
- "mappings": "AAAA,SAAS,UAAU,QAAQ,UAAU;AAErC,SAAS,8BAA8B;AACvC,SAAS,0BAA0B;AAEnC,SAAS,iBAAiB,MAAM;AAC9B,WAAS,sBAAsB,MAAM;AAEnC,aAAS,0BAA0B,MAAM;AACvC,SAAG,qBAAqB,MAAM;AAC5B,cAAM,SAAS,mBAAmB,MAAM;AAAA,UACtC,MAAM;AAAA,UACN,QAAQ;AAAA,QACV,CAAC;AAED,eAAO,MAAM,EAAE,QAAQ;AAAA,UACrB,MAAM;AAAA,UACN,QAAQ;AAAA,QACV,CAAC;AAAA,MACH,CAAC;AAED,SAAG,gBAAgB,MAAM;AACvB,cAAM,SAAS,mBAAmB,MAAM;AAAA,UACtC,MAAM;AAAA,UACN,UAAU,CAAC,MAAM;AAAA,UACjB,YAAY;AAAA,YACV,MAAM;AAAA,cACJ,MAAM;AAAA,YACR;AAAA,YACA,SAAS;AAAA,cACP,MAAM;AAAA,YACR;AAAA,YACA,KAAK;AAAA,cACH,MAAM;AAAA,cACN,QAAQ;AAAA,cACR,SAAS;AAAA,YACX;AAAA,UACF;AAAA,QACF,CAAC;AAED,eAAO,MAAM,EAAE,QAAQ;AAAA,UACrB,MAAM;AAAA,UACN,UAAU,CAAC,MAAM;AAAA,UACjB,YAAY;AAAA,YACV,MAAM;AAAA,cACJ,MAAM;AAAA,YACR;AAAA,YACA,SAAS;AAAA,cACP,MAAM;AAAA,YAC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AA,cACF;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF,CAAC;AAED,aAAO,MAAM,EAAE,QAAQ;AAAA,QACrB,SAAS;AAAA,UACP,uBAAuB;AAAA,YACrB,KAAK;AAAA,YACL,MAAM;AAAA,YACN,OAAO;AAAA,cACL,aAAa;AAAA,YACf;AAAA,YACA,OAAO;AAAA,cACL,UAAU;AAAA,gBACR,gBAAgB;AAAA,cAClB;AAAA,YACF;AAAA,UACF;AAAA,UACA,aAAa;AAAA,YACX,KAAK;AAAA,YACL,MAAM;AAAA,YACN,OAAO;AAAA,cACL,aAAa;AAAA,gBACX,kBAAkB;AAAA,gBAClB,QAAQ;AAAA,cACV;AAAA,YACF;AAAA,UACF;AAAA,UACA,aAAa;AAAA,YACX,KAAK;AAAA,YACL,MAAM;AAAA,YACN,OAAO;AAAA,cACL,aAAa;AAAA,gBACX,gBAAgB;AAAA,gBAChB,MAAM;AAAA,cACR;AAAA,YACF;AAAA,UACF;AAAA,UACA,mBAAmB;AAAA,YACjB,KAAK;AAAA,YACL,MAAM;AAAA,YACN,UAAU,CAAC,YAAY,MAAM;AAAA,YAC7B,YAAY;AAAA,cACV,UAAU;AAAA,gBACR,MAAM,CAAC,UAAU,QAAQ;AAAA,cAC3B;AAAA,YACF;AAAA,YACA,OAAO;AAAA,cACL;AAAA,gBACE,YAAY;AAAA,kBACV,UAAU,EAAE,OAAO,SAAS;AAAA,kBAC5B,MAAM,EAAE,MAAM,mBAAmB;AAAA,gBACnC;AAAA,cACF;AAAA,cACA;AAAA,gBACE,YAAY;AAAA,kBACV,UAAU,EAAE,OAAO,SAAS;AAAA,kBAC5B,MAAM,EAAE,MAAM,mBAAmB;AAAA,gBACnC;AAAA,cACF;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH,CAAC;",
6
- "names": []
7
- }
@@ -1,54 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { OpenApiObjectSchema } from "../unprocessed/openapi-object.js";
3
- import { SecurityRequirementObjectSchema } from "../unprocessed/security-requirement-object.js";
4
- describe("security-requirement-object", () => {
5
- describe("SecurityRequirementObjectSchema", () => {
6
- describe("Security Requirement Object Examples", () => {
7
- it("Non-OAuth2 Security Requirement", () => {
8
- const result = SecurityRequirementObjectSchema.parse({
9
- api_key: []
10
- });
11
- expect(result).toEqual({
12
- api_key: []
13
- });
14
- });
15
- it("OAuth2 Security Requirement", () => {
16
- const result = SecurityRequirementObjectSchema.parse({
17
- petstore_auth: ["write:pets", "read:pets"]
18
- });
19
- expect(result).toEqual({
20
- petstore_auth: ["write:pets", "read:pets"]
21
- });
22
- });
23
- it("Optional OAuth2 Security", () => {
24
- const result = OpenApiObjectSchema.parse({
25
- openapi: "3.1.1",
26
- info: {
27
- title: "Example",
28
- version: "1.0.0"
29
- },
30
- security: [
31
- {},
32
- {
33
- petstore_auth: ["write:pets", "read:pets"]
34
- }
35
- ]
36
- });
37
- expect(result).toEqual({
38
- openapi: "3.1.1",
39
- info: {
40
- title: "Example",
41
- version: "1.0.0"
42
- },
43
- security: [
44
- {},
45
- {
46
- petstore_auth: ["write:pets", "read:pets"]
47
- }
48
- ]
49
- });
50
- });
51
- });
52
- });
53
- });
54
- //# sourceMappingURL=security-requirement-object.test.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/schemas/3.1/compliance/security-requirement-object.test.ts"],
4
- "sourcesContent": ["import { describe, expect, it } from 'vitest'\n\nimport { OpenApiObjectSchema } from '../unprocessed/openapi-object'\nimport { SecurityRequirementObjectSchema } from '../unprocessed/security-requirement-object'\n\ndescribe('security-requirement-object', () => {\n describe('SecurityRequirementObjectSchema', () => {\n // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#contact-object-example\n describe('Security Requirement Object Examples', () => {\n it('Non-OAuth2 Security Requirement', () => {\n const result = SecurityRequirementObjectSchema.parse({\n api_key: [],\n })\n\n expect(result).toEqual({\n api_key: [],\n })\n })\n\n it('OAuth2 Security Requirement', () => {\n const result = SecurityRequirementObjectSchema.parse({\n petstore_auth: ['write:pets', 'read:pets'],\n })\n\n expect(result).toEqual({\n petstore_auth: ['write:pets', 'read:pets'],\n })\n })\n\n it('Optional OAuth2 Security', () => {\n const result = OpenApiObjectSchema.parse({\n openapi: '3.1.1',\n info: {\n title: 'Example',\n version: '1.0.0',\n },\n security: [\n {},\n {\n petstore_auth: ['write:pets', 'read:pets'],\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 security: [\n {},\n {\n petstore_auth: ['write:pets', 'read:pets'],\n },\n ],\n })\n })\n })\n })\n})\n"],
5
- "mappings": "AAAA,SAAS,UAAU,QAAQ,UAAU;AAErC,SAAS,2BAA2B;AACpC,SAAS,uCAAuC;AAEhD,SAAS,+BAA+B,MAAM;AAC5C,WAAS,mCAAmC,MAAM;AAEhD,aAAS,wCAAwC,MAAM;AACrD,SAAG,mCAAmC,MAAM;AAC1C,cAAM,SAAS,gCAAgC,MAAM;AAAA,UACnD,SAAS,CAAC;AAAA,QACZ,CAAC;AAED,eAAO,MAAM,EAAE,QAAQ;AAAA,UACrB,SAAS,CAAC;AAAA,QACZ,CAAC;AAAA,MACH,CAAC;AAED,SAAG,+BAA+B,MAAM;AACtC,cAAM,SAAS,gCAAgC,MAAM;AAAA,UACnD,eAAe,CAAC,cAAc,WAAW;AAAA,QAC3C,CAAC;AAED,eAAO,MAAM,EAAE,QAAQ;AAAA,UACrB,eAAe,CAAC,cAAc,WAAW;AAAA,QAC3C,CAAC;AAAA,MACH,CAAC;AAED,SAAG,4BAA4B,MAAM;AACnC,cAAM,SAAS,oBAAoB,MAAM;AAAA,UACvC,SAAS;AAAA,UACT,MAAM;AAAA,YACJ,OAAO;AAAA,YACP,SAAS;AAAA,UACX;AAAA,UACA,UAAU;AAAA,YACR,CAAC;AAAA,YACD;AAAA,cACE,eAAe,CAAC,cAAc,WAAW;AAAA,YAC3C;AAAA,UACF;AAAA,QACF,CAAC;AAED,eAAO,MAAM,EAAE,QAAQ;AAAA,UACrB,SAAS;AAAA,UACT,MAAM;AAAA,YACJ,OAAO;AAAA,YACP,SAAS;AAAA,UACX;AAAA,UACA,UAAU;AAAA,YACR,CAAC;AAAA,YACD;AAAA,cACE,eAAe,CAAC,cAAc,WAAW;AAAA,YAC3C;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH,CAAC;",
6
- "names": []
7
- }