@scalar/oas-utils 0.2.99 → 0.2.101

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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # @scalar/oas-utils
2
2
 
3
+ ## 0.2.101
4
+
5
+ ### Patch Changes
6
+
7
+ - be34e7d: feat: adds value to server variables schema
8
+ - Updated dependencies [be34e7d]
9
+ - Updated dependencies [51f3177]
10
+ - @scalar/types@0.0.29
11
+ - @scalar/themes@0.9.63
12
+
13
+ ## 0.2.100
14
+
15
+ ### Patch Changes
16
+
17
+ - 12e7232: feat: adds parameter examples support
18
+ - 901970f: fix: removes application/json content type as default
19
+ - f1f39b0: refactor: better handle servers
20
+ - Updated dependencies [776a4e2]
21
+ - Updated dependencies [2ed681b]
22
+ - Updated dependencies [4f12fe4]
23
+ - Updated dependencies [702c386]
24
+ - Updated dependencies [f1f39b0]
25
+ - @scalar/themes@0.9.62
26
+ - @scalar/types@0.0.28
27
+
3
28
  ## 0.2.99
4
29
 
5
30
  ### Patch Changes
@@ -237,7 +237,12 @@ export declare const extendedCollectionSchema: z.ZodObject<{
237
237
  tags: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
238
238
  /** List of requests without tags and top level tag "folders" */
239
239
  children: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
240
- /** A link to where this document is stored, useful for live sync and possibly git sync down the line */
240
+ /**
241
+ * A link to where this document is stored
242
+ *
243
+ * - Used for watch mode
244
+ * - Possibly useful for Git sync down the line
245
+ */
241
246
  documentUrl: z.ZodOptional<z.ZodString>;
242
247
  /**
243
248
  * Enables polling of OpenAPI document urls
@@ -433,7 +438,12 @@ export declare const collectionSchema: z.ZodObject<z.objectUtil.extendShape<{
433
438
  tags: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
434
439
  /** List of requests without tags and top level tag "folders" */
435
440
  children: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodString>>, "many">>;
436
- /** A link to where this document is stored, useful for live sync and possibly git sync down the line */
441
+ /**
442
+ * A link to where this document is stored
443
+ *
444
+ * - Used for watch mode
445
+ * - Possibly useful for Git sync down the line
446
+ */
437
447
  documentUrl: z.ZodOptional<z.ZodString>;
438
448
  /**
439
449
  * Enables polling of OpenAPI document urls
@@ -1 +1 @@
1
- {"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/collection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,eAAO,MAAM,mBAAmB;IAC9B;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAaH;;;;;;OAMG;;;;;;;;;;;;IAGH,uBAAuB;;IAEvB,uBAAuB;;IAEvB,gDAAgD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWhD,CAAA;AAEF,eAAO,MAAM,wBAAwB;;IAEnC,qEAAqE;;IAErE,2FAA2F;;IAE3F,oCAAoC;;IAEpC,wDAAwD;;IAExD,gDAAgD;;IAEhD,8CAA8C;;IAE9C,gEAAgE;;IAEhE,wGAAwG;;IAExG;;;;OAIG;;IAEH,kFAAkF;;IAElF;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKH,CAAA;AAEF,eAAO,MAAM,gBAAgB;IAhF3B;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAaH;;;;;;OAMG;;;;;;;;;;;;IAGH,uBAAuB;;IAEvB,uBAAuB;;I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FAAkF;;IAElF;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKH,CAAA;AAEF,eAAO,MAAM,gBAAgB;IArF3B;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAaH;;;;;;OAMG;;;;;;;;;;;;IAGH,uBAAuB;;IAEvB,uBAAuB;;IAEvB,gDAAgD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAehD,qEAAqE;;IAErE,2FAA2F;;IAE3F,oCAAoC;;IAEpC,wDAAwD;;IAExD,gDAAgD;;IAEhD,8CAA8C;;IAE9C,gEAAgE;;IAEhE;;;;;OAKG;;IAEH;;;;OAIG;;IAEH,kFAAkF;;IAElF;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASJ,CAAA;AACD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AACzD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
@@ -64,7 +64,12 @@ const extendedCollectionSchema = z.object({
64
64
  tags: nanoidSchema.array().default([]),
65
65
  /** List of requests without tags and top level tag "folders" */
66
66
  children: nanoidSchema.array().default([]),
67
- /** A link to where this document is stored, useful for live sync and possibly git sync down the line */
67
+ /**
68
+ * A link to where this document is stored
69
+ *
70
+ * - Used for watch mode
71
+ * - Possibly useful for Git sync down the line
72
+ */
68
73
  documentUrl: z.string().optional(),
69
74
  /**
70
75
  * Enables polling of OpenAPI document urls
@@ -16,6 +16,7 @@ export declare const requestExampleParametersSchema: z.ZodObject<{
16
16
  description: z.ZodOptional<z.ZodString>;
17
17
  required: z.ZodOptional<z.ZodBoolean>;
18
18
  enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
19
+ examples: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
19
20
  type: z.ZodOptional<z.ZodString>;
20
21
  format: z.ZodOptional<z.ZodString>;
21
22
  minimum: z.ZodOptional<z.ZodNumber>;
@@ -33,6 +34,7 @@ export declare const requestExampleParametersSchema: z.ZodObject<{
33
34
  required?: boolean | undefined;
34
35
  description?: string | undefined;
35
36
  enum?: string[] | undefined;
37
+ examples?: string[] | undefined;
36
38
  format?: string | undefined;
37
39
  file?: any;
38
40
  nullable?: boolean | undefined;
@@ -45,6 +47,7 @@ export declare const requestExampleParametersSchema: z.ZodObject<{
45
47
  required?: boolean | undefined;
46
48
  description?: string | undefined;
47
49
  enum?: string[] | undefined;
50
+ examples?: string[] | undefined;
48
51
  format?: string | undefined;
49
52
  file?: any;
50
53
  key?: string | undefined;
@@ -124,14 +127,14 @@ export type BodyMime = (typeof exampleBodyMime)[number];
124
127
  */
125
128
  export declare const exampleRequestBodySchema: z.ZodObject<{
126
129
  raw: z.ZodOptional<z.ZodObject<{
127
- encoding: z.ZodDefault<z.ZodEnum<["json", "text", "html", "javascript", "xml", "yaml", "edn"]>>;
130
+ encoding: z.ZodEnum<["json", "text", "html", "javascript", "xml", "yaml", "edn"]>;
128
131
  value: z.ZodDefault<z.ZodString>;
129
132
  }, "strip", z.ZodTypeAny, {
130
133
  value: string;
131
134
  encoding: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
132
135
  }, {
136
+ encoding: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
133
137
  value?: string | undefined;
134
- encoding?: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn" | undefined;
135
138
  }>>;
136
139
  formData: z.ZodOptional<z.ZodObject<{
137
140
  encoding: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"form-data">, z.ZodLiteral<"urlencoded">]>>;
@@ -143,6 +146,7 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
143
146
  description: z.ZodOptional<z.ZodString>;
144
147
  required: z.ZodOptional<z.ZodBoolean>;
145
148
  enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
149
+ examples: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
146
150
  type: z.ZodOptional<z.ZodString>;
147
151
  format: z.ZodOptional<z.ZodString>;
148
152
  minimum: z.ZodOptional<z.ZodNumber>;
@@ -160,6 +164,7 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
160
164
  required?: boolean | undefined;
161
165
  description?: string | undefined;
162
166
  enum?: string[] | undefined;
167
+ examples?: string[] | undefined;
163
168
  format?: string | undefined;
164
169
  file?: any;
165
170
  nullable?: boolean | undefined;
@@ -172,6 +177,7 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
172
177
  required?: boolean | undefined;
173
178
  description?: string | undefined;
174
179
  enum?: string[] | undefined;
180
+ examples?: string[] | undefined;
175
181
  format?: string | undefined;
176
182
  file?: any;
177
183
  key?: string | undefined;
@@ -190,6 +196,7 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
190
196
  required?: boolean | undefined;
191
197
  description?: string | undefined;
192
198
  enum?: string[] | undefined;
199
+ examples?: string[] | undefined;
193
200
  format?: string | undefined;
194
201
  file?: any;
195
202
  nullable?: boolean | undefined;
@@ -205,6 +212,7 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
205
212
  required?: boolean | undefined;
206
213
  description?: string | undefined;
207
214
  enum?: string[] | undefined;
215
+ examples?: string[] | undefined;
208
216
  format?: string | undefined;
209
217
  file?: any;
210
218
  key?: string | undefined;
@@ -230,6 +238,7 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
230
238
  required?: boolean | undefined;
231
239
  description?: string | undefined;
232
240
  enum?: string[] | undefined;
241
+ examples?: string[] | undefined;
233
242
  format?: string | undefined;
234
243
  file?: any;
235
244
  nullable?: boolean | undefined;
@@ -252,6 +261,7 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
252
261
  required?: boolean | undefined;
253
262
  description?: string | undefined;
254
263
  enum?: string[] | undefined;
264
+ examples?: string[] | undefined;
255
265
  format?: string | undefined;
256
266
  file?: any;
257
267
  key?: string | undefined;
@@ -261,15 +271,15 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
261
271
  encoding?: "form-data" | "urlencoded" | undefined;
262
272
  } | undefined;
263
273
  raw?: {
274
+ encoding: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
264
275
  value?: string | undefined;
265
- encoding?: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn" | undefined;
266
276
  } | undefined;
267
277
  activeBody?: "binary" | "formData" | "raw" | undefined;
268
278
  }>;
269
279
  export type ExampleRequestBody = z.infer<typeof exampleRequestBodySchema>;
270
280
  /** Schema for the OAS serialization of request example bodies */
271
281
  export declare const xScalarExampleBodySchema: z.ZodObject<{
272
- encoding: z.ZodDefault<z.ZodEnum<["application/json", "text/plain", "text/html", "application/javascript", "application/xml", "application/yaml", "application/edn", "application/octet-stream", "application/x-www-form-urlencoded", "multipart/form-data", "binary"]>>;
282
+ encoding: z.ZodEnum<["application/json", "text/plain", "text/html", "application/javascript", "application/xml", "application/yaml", "application/edn", "application/octet-stream", "application/x-www-form-urlencoded", "multipart/form-data", "binary"]>;
273
283
  /**
274
284
  * Body content as an object with a separately specified encoding or a simple pre-encoded string value
275
285
  *
@@ -296,7 +306,7 @@ export declare const xScalarExampleBodySchema: z.ZodObject<{
296
306
  } | null | undefined;
297
307
  }, {
298
308
  content: string | Record<string, any>;
299
- encoding?: "application/json" | "text/plain" | "text/html" | "application/javascript" | "application/xml" | "application/yaml" | "application/edn" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "binary" | undefined;
309
+ encoding: "application/json" | "text/plain" | "text/html" | "application/javascript" | "application/xml" | "application/yaml" | "application/edn" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "binary";
300
310
  file?: {
301
311
  url: string;
302
312
  base64?: string | undefined;
@@ -310,14 +320,14 @@ export declare const requestExampleSchema: z.ZodObject<{
310
320
  name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
311
321
  body: z.ZodDefault<z.ZodOptional<z.ZodObject<{
312
322
  raw: z.ZodOptional<z.ZodObject<{
313
- encoding: z.ZodDefault<z.ZodEnum<["json", "text", "html", "javascript", "xml", "yaml", "edn"]>>;
323
+ encoding: z.ZodEnum<["json", "text", "html", "javascript", "xml", "yaml", "edn"]>;
314
324
  value: z.ZodDefault<z.ZodString>;
315
325
  }, "strip", z.ZodTypeAny, {
316
326
  value: string;
317
327
  encoding: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
318
328
  }, {
329
+ encoding: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
319
330
  value?: string | undefined;
320
- encoding?: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn" | undefined;
321
331
  }>>;
322
332
  formData: z.ZodOptional<z.ZodObject<{
323
333
  encoding: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"form-data">, z.ZodLiteral<"urlencoded">]>>;
@@ -329,6 +339,7 @@ export declare const requestExampleSchema: z.ZodObject<{
329
339
  description: z.ZodOptional<z.ZodString>;
330
340
  required: z.ZodOptional<z.ZodBoolean>;
331
341
  enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
342
+ examples: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
332
343
  type: z.ZodOptional<z.ZodString>;
333
344
  format: z.ZodOptional<z.ZodString>;
334
345
  minimum: z.ZodOptional<z.ZodNumber>;
@@ -346,6 +357,7 @@ export declare const requestExampleSchema: z.ZodObject<{
346
357
  required?: boolean | undefined;
347
358
  description?: string | undefined;
348
359
  enum?: string[] | undefined;
360
+ examples?: string[] | undefined;
349
361
  format?: string | undefined;
350
362
  file?: any;
351
363
  nullable?: boolean | undefined;
@@ -358,6 +370,7 @@ export declare const requestExampleSchema: z.ZodObject<{
358
370
  required?: boolean | undefined;
359
371
  description?: string | undefined;
360
372
  enum?: string[] | undefined;
373
+ examples?: string[] | undefined;
361
374
  format?: string | undefined;
362
375
  file?: any;
363
376
  key?: string | undefined;
@@ -376,6 +389,7 @@ export declare const requestExampleSchema: z.ZodObject<{
376
389
  required?: boolean | undefined;
377
390
  description?: string | undefined;
378
391
  enum?: string[] | undefined;
392
+ examples?: string[] | undefined;
379
393
  format?: string | undefined;
380
394
  file?: any;
381
395
  nullable?: boolean | undefined;
@@ -391,6 +405,7 @@ export declare const requestExampleSchema: z.ZodObject<{
391
405
  required?: boolean | undefined;
392
406
  description?: string | undefined;
393
407
  enum?: string[] | undefined;
408
+ examples?: string[] | undefined;
394
409
  format?: string | undefined;
395
410
  file?: any;
396
411
  key?: string | undefined;
@@ -416,6 +431,7 @@ export declare const requestExampleSchema: z.ZodObject<{
416
431
  required?: boolean | undefined;
417
432
  description?: string | undefined;
418
433
  enum?: string[] | undefined;
434
+ examples?: string[] | undefined;
419
435
  format?: string | undefined;
420
436
  file?: any;
421
437
  nullable?: boolean | undefined;
@@ -438,6 +454,7 @@ export declare const requestExampleSchema: z.ZodObject<{
438
454
  required?: boolean | undefined;
439
455
  description?: string | undefined;
440
456
  enum?: string[] | undefined;
457
+ examples?: string[] | undefined;
441
458
  format?: string | undefined;
442
459
  file?: any;
443
460
  key?: string | undefined;
@@ -447,8 +464,8 @@ export declare const requestExampleSchema: z.ZodObject<{
447
464
  encoding?: "form-data" | "urlencoded" | undefined;
448
465
  } | undefined;
449
466
  raw?: {
467
+ encoding: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
450
468
  value?: string | undefined;
451
- encoding?: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn" | undefined;
452
469
  } | undefined;
453
470
  activeBody?: "binary" | "formData" | "raw" | undefined;
454
471
  }>>>;
@@ -461,6 +478,7 @@ export declare const requestExampleSchema: z.ZodObject<{
461
478
  description: z.ZodOptional<z.ZodString>;
462
479
  required: z.ZodOptional<z.ZodBoolean>;
463
480
  enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
481
+ examples: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
464
482
  type: z.ZodOptional<z.ZodString>;
465
483
  format: z.ZodOptional<z.ZodString>;
466
484
  minimum: z.ZodOptional<z.ZodNumber>;
@@ -478,6 +496,7 @@ export declare const requestExampleSchema: z.ZodObject<{
478
496
  required?: boolean | undefined;
479
497
  description?: string | undefined;
480
498
  enum?: string[] | undefined;
499
+ examples?: string[] | undefined;
481
500
  format?: string | undefined;
482
501
  file?: any;
483
502
  nullable?: boolean | undefined;
@@ -490,6 +509,7 @@ export declare const requestExampleSchema: z.ZodObject<{
490
509
  required?: boolean | undefined;
491
510
  description?: string | undefined;
492
511
  enum?: string[] | undefined;
512
+ examples?: string[] | undefined;
493
513
  format?: string | undefined;
494
514
  file?: any;
495
515
  key?: string | undefined;
@@ -504,6 +524,7 @@ export declare const requestExampleSchema: z.ZodObject<{
504
524
  description: z.ZodOptional<z.ZodString>;
505
525
  required: z.ZodOptional<z.ZodBoolean>;
506
526
  enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
527
+ examples: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
507
528
  type: z.ZodOptional<z.ZodString>;
508
529
  format: z.ZodOptional<z.ZodString>;
509
530
  minimum: z.ZodOptional<z.ZodNumber>;
@@ -521,6 +542,7 @@ export declare const requestExampleSchema: z.ZodObject<{
521
542
  required?: boolean | undefined;
522
543
  description?: string | undefined;
523
544
  enum?: string[] | undefined;
545
+ examples?: string[] | undefined;
524
546
  format?: string | undefined;
525
547
  file?: any;
526
548
  nullable?: boolean | undefined;
@@ -533,6 +555,7 @@ export declare const requestExampleSchema: z.ZodObject<{
533
555
  required?: boolean | undefined;
534
556
  description?: string | undefined;
535
557
  enum?: string[] | undefined;
558
+ examples?: string[] | undefined;
536
559
  format?: string | undefined;
537
560
  file?: any;
538
561
  key?: string | undefined;
@@ -547,6 +570,7 @@ export declare const requestExampleSchema: z.ZodObject<{
547
570
  description: z.ZodOptional<z.ZodString>;
548
571
  required: z.ZodOptional<z.ZodBoolean>;
549
572
  enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
573
+ examples: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
550
574
  type: z.ZodOptional<z.ZodString>;
551
575
  format: z.ZodOptional<z.ZodString>;
552
576
  minimum: z.ZodOptional<z.ZodNumber>;
@@ -564,6 +588,7 @@ export declare const requestExampleSchema: z.ZodObject<{
564
588
  required?: boolean | undefined;
565
589
  description?: string | undefined;
566
590
  enum?: string[] | undefined;
591
+ examples?: string[] | undefined;
567
592
  format?: string | undefined;
568
593
  file?: any;
569
594
  nullable?: boolean | undefined;
@@ -576,6 +601,7 @@ export declare const requestExampleSchema: z.ZodObject<{
576
601
  required?: boolean | undefined;
577
602
  description?: string | undefined;
578
603
  enum?: string[] | undefined;
604
+ examples?: string[] | undefined;
579
605
  format?: string | undefined;
580
606
  file?: any;
581
607
  key?: string | undefined;
@@ -590,6 +616,7 @@ export declare const requestExampleSchema: z.ZodObject<{
590
616
  description: z.ZodOptional<z.ZodString>;
591
617
  required: z.ZodOptional<z.ZodBoolean>;
592
618
  enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
619
+ examples: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
593
620
  type: z.ZodOptional<z.ZodString>;
594
621
  format: z.ZodOptional<z.ZodString>;
595
622
  minimum: z.ZodOptional<z.ZodNumber>;
@@ -607,6 +634,7 @@ export declare const requestExampleSchema: z.ZodObject<{
607
634
  required?: boolean | undefined;
608
635
  description?: string | undefined;
609
636
  enum?: string[] | undefined;
637
+ examples?: string[] | undefined;
610
638
  format?: string | undefined;
611
639
  file?: any;
612
640
  nullable?: boolean | undefined;
@@ -619,6 +647,7 @@ export declare const requestExampleSchema: z.ZodObject<{
619
647
  required?: boolean | undefined;
620
648
  description?: string | undefined;
621
649
  enum?: string[] | undefined;
650
+ examples?: string[] | undefined;
622
651
  format?: string | undefined;
623
652
  file?: any;
624
653
  key?: string | undefined;
@@ -637,6 +666,7 @@ export declare const requestExampleSchema: z.ZodObject<{
637
666
  required?: boolean | undefined;
638
667
  description?: string | undefined;
639
668
  enum?: string[] | undefined;
669
+ examples?: string[] | undefined;
640
670
  format?: string | undefined;
641
671
  file?: any;
642
672
  nullable?: boolean | undefined;
@@ -652,6 +682,7 @@ export declare const requestExampleSchema: z.ZodObject<{
652
682
  required?: boolean | undefined;
653
683
  description?: string | undefined;
654
684
  enum?: string[] | undefined;
685
+ examples?: string[] | undefined;
655
686
  format?: string | undefined;
656
687
  file?: any;
657
688
  nullable?: boolean | undefined;
@@ -667,6 +698,7 @@ export declare const requestExampleSchema: z.ZodObject<{
667
698
  required?: boolean | undefined;
668
699
  description?: string | undefined;
669
700
  enum?: string[] | undefined;
701
+ examples?: string[] | undefined;
670
702
  format?: string | undefined;
671
703
  file?: any;
672
704
  nullable?: boolean | undefined;
@@ -682,6 +714,7 @@ export declare const requestExampleSchema: z.ZodObject<{
682
714
  required?: boolean | undefined;
683
715
  description?: string | undefined;
684
716
  enum?: string[] | undefined;
717
+ examples?: string[] | undefined;
685
718
  format?: string | undefined;
686
719
  file?: any;
687
720
  nullable?: boolean | undefined;
@@ -696,6 +729,7 @@ export declare const requestExampleSchema: z.ZodObject<{
696
729
  required?: boolean | undefined;
697
730
  description?: string | undefined;
698
731
  enum?: string[] | undefined;
732
+ examples?: string[] | undefined;
699
733
  format?: string | undefined;
700
734
  file?: any;
701
735
  key?: string | undefined;
@@ -711,6 +745,7 @@ export declare const requestExampleSchema: z.ZodObject<{
711
745
  required?: boolean | undefined;
712
746
  description?: string | undefined;
713
747
  enum?: string[] | undefined;
748
+ examples?: string[] | undefined;
714
749
  format?: string | undefined;
715
750
  file?: any;
716
751
  key?: string | undefined;
@@ -726,6 +761,7 @@ export declare const requestExampleSchema: z.ZodObject<{
726
761
  required?: boolean | undefined;
727
762
  description?: string | undefined;
728
763
  enum?: string[] | undefined;
764
+ examples?: string[] | undefined;
729
765
  format?: string | undefined;
730
766
  file?: any;
731
767
  key?: string | undefined;
@@ -741,6 +777,7 @@ export declare const requestExampleSchema: z.ZodObject<{
741
777
  required?: boolean | undefined;
742
778
  description?: string | undefined;
743
779
  enum?: string[] | undefined;
780
+ examples?: string[] | undefined;
744
781
  format?: string | undefined;
745
782
  file?: any;
746
783
  key?: string | undefined;
@@ -766,6 +803,7 @@ export declare const requestExampleSchema: z.ZodObject<{
766
803
  required?: boolean | undefined;
767
804
  description?: string | undefined;
768
805
  enum?: string[] | undefined;
806
+ examples?: string[] | undefined;
769
807
  format?: string | undefined;
770
808
  file?: any;
771
809
  nullable?: boolean | undefined;
@@ -781,6 +819,7 @@ export declare const requestExampleSchema: z.ZodObject<{
781
819
  required?: boolean | undefined;
782
820
  description?: string | undefined;
783
821
  enum?: string[] | undefined;
822
+ examples?: string[] | undefined;
784
823
  format?: string | undefined;
785
824
  file?: any;
786
825
  nullable?: boolean | undefined;
@@ -796,6 +835,7 @@ export declare const requestExampleSchema: z.ZodObject<{
796
835
  required?: boolean | undefined;
797
836
  description?: string | undefined;
798
837
  enum?: string[] | undefined;
838
+ examples?: string[] | undefined;
799
839
  format?: string | undefined;
800
840
  file?: any;
801
841
  nullable?: boolean | undefined;
@@ -811,6 +851,7 @@ export declare const requestExampleSchema: z.ZodObject<{
811
851
  required?: boolean | undefined;
812
852
  description?: string | undefined;
813
853
  enum?: string[] | undefined;
854
+ examples?: string[] | undefined;
814
855
  format?: string | undefined;
815
856
  file?: any;
816
857
  nullable?: boolean | undefined;
@@ -831,6 +872,7 @@ export declare const requestExampleSchema: z.ZodObject<{
831
872
  required?: boolean | undefined;
832
873
  description?: string | undefined;
833
874
  enum?: string[] | undefined;
875
+ examples?: string[] | undefined;
834
876
  format?: string | undefined;
835
877
  file?: any;
836
878
  nullable?: boolean | undefined;
@@ -858,6 +900,7 @@ export declare const requestExampleSchema: z.ZodObject<{
858
900
  required?: boolean | undefined;
859
901
  description?: string | undefined;
860
902
  enum?: string[] | undefined;
903
+ examples?: string[] | undefined;
861
904
  format?: string | undefined;
862
905
  file?: any;
863
906
  key?: string | undefined;
@@ -873,6 +916,7 @@ export declare const requestExampleSchema: z.ZodObject<{
873
916
  required?: boolean | undefined;
874
917
  description?: string | undefined;
875
918
  enum?: string[] | undefined;
919
+ examples?: string[] | undefined;
876
920
  format?: string | undefined;
877
921
  file?: any;
878
922
  key?: string | undefined;
@@ -888,6 +932,7 @@ export declare const requestExampleSchema: z.ZodObject<{
888
932
  required?: boolean | undefined;
889
933
  description?: string | undefined;
890
934
  enum?: string[] | undefined;
935
+ examples?: string[] | undefined;
891
936
  format?: string | undefined;
892
937
  file?: any;
893
938
  key?: string | undefined;
@@ -903,6 +948,7 @@ export declare const requestExampleSchema: z.ZodObject<{
903
948
  required?: boolean | undefined;
904
949
  description?: string | undefined;
905
950
  enum?: string[] | undefined;
951
+ examples?: string[] | undefined;
906
952
  format?: string | undefined;
907
953
  file?: any;
908
954
  key?: string | undefined;
@@ -922,6 +968,7 @@ export declare const requestExampleSchema: z.ZodObject<{
922
968
  required?: boolean | undefined;
923
969
  description?: string | undefined;
924
970
  enum?: string[] | undefined;
971
+ examples?: string[] | undefined;
925
972
  format?: string | undefined;
926
973
  file?: any;
927
974
  key?: string | undefined;
@@ -931,8 +978,8 @@ export declare const requestExampleSchema: z.ZodObject<{
931
978
  encoding?: "form-data" | "urlencoded" | undefined;
932
979
  } | undefined;
933
980
  raw?: {
981
+ encoding: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
934
982
  value?: string | undefined;
935
- encoding?: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn" | undefined;
936
983
  } | undefined;
937
984
  activeBody?: "binary" | "formData" | "raw" | undefined;
938
985
  } | undefined;
@@ -945,7 +992,7 @@ export declare const xScalarExampleSchema: z.ZodObject<{
945
992
  /** TODO: Should this be required? */
946
993
  name: z.ZodOptional<z.ZodString>;
947
994
  body: z.ZodOptional<z.ZodObject<{
948
- encoding: z.ZodDefault<z.ZodEnum<["application/json", "text/plain", "text/html", "application/javascript", "application/xml", "application/yaml", "application/edn", "application/octet-stream", "application/x-www-form-urlencoded", "multipart/form-data", "binary"]>>;
995
+ encoding: z.ZodEnum<["application/json", "text/plain", "text/html", "application/javascript", "application/xml", "application/yaml", "application/edn", "application/octet-stream", "application/x-www-form-urlencoded", "multipart/form-data", "binary"]>;
949
996
  /**
950
997
  * Body content as an object with a separately specified encoding or a simple pre-encoded string value
951
998
  *
@@ -972,7 +1019,7 @@ export declare const xScalarExampleSchema: z.ZodObject<{
972
1019
  } | null | undefined;
973
1020
  }, {
974
1021
  content: string | Record<string, any>;
975
- encoding?: "application/json" | "text/plain" | "text/html" | "application/javascript" | "application/xml" | "application/yaml" | "application/edn" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "binary" | undefined;
1022
+ encoding: "application/json" | "text/plain" | "text/html" | "application/javascript" | "application/xml" | "application/yaml" | "application/edn" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "binary";
976
1023
  file?: {
977
1024
  url: string;
978
1025
  base64?: string | undefined;
@@ -1020,7 +1067,7 @@ export declare const xScalarExampleSchema: z.ZodObject<{
1020
1067
  name?: string | undefined;
1021
1068
  body?: {
1022
1069
  content: string | Record<string, any>;
1023
- encoding?: "application/json" | "text/plain" | "text/html" | "application/javascript" | "application/xml" | "application/yaml" | "application/edn" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "binary" | undefined;
1070
+ encoding: "application/json" | "text/plain" | "text/html" | "application/javascript" | "application/xml" | "application/yaml" | "application/edn" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "binary";
1024
1071
  file?: {
1025
1072
  url: string;
1026
1073
  base64?: string | undefined;
@@ -1062,6 +1109,7 @@ export declare function createParamInstance(param: RequestParameter): {
1062
1109
  required?: boolean | undefined;
1063
1110
  description?: string | undefined;
1064
1111
  enum?: string[] | undefined;
1112
+ examples?: string[] | undefined;
1065
1113
  format?: string | undefined;
1066
1114
  file?: any;
1067
1115
  nullable?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"request-examples.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/request-examples.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAKtC;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAczC,CAAA;AAUF,kFAAkF;AAClF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,8BAA8B,CACtC,CAAA;AAED,eAAO,MAAM,sBAAsB;;;;;;;;;GAKtB,CAAA;AAEb;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAErE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAS/B,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAKvE;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,uEAQ7B,CAAA;AAEV,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAA;AAEtE,eAAO,MAAM,eAAe,gPAalB,CAAA;AAEV,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAYvD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;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;;EAuD1D;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,GACd,cAAc,CAuGhB"}
@@ -21,6 +21,7 @@ const requestExampleParametersSchema = z.object({
21
21
  description: z.string().optional(),
22
22
  required: z.boolean().optional(),
23
23
  enum: z.array(z.string()).optional(),
24
+ examples: z.array(z.string()).optional(),
24
25
  type: z.string().optional(),
25
26
  format: z.string().optional(),
26
27
  minimum: z.number().optional(),
@@ -103,7 +104,7 @@ const contentMapping = {
103
104
  const exampleRequestBodySchema = z.object({
104
105
  raw: z
105
106
  .object({
106
- encoding: z.enum(exampleRequestBodyEncoding).default('json'),
107
+ encoding: z.enum(exampleRequestBodyEncoding),
107
108
  value: z.string().default(''),
108
109
  })
109
110
  .optional(),
@@ -122,7 +123,7 @@ const exampleRequestBodySchema = z.object({
122
123
  });
123
124
  /** Schema for the OAS serialization of request example bodies */
124
125
  const xScalarExampleBodySchema = z.object({
125
- encoding: z.enum(exampleBodyMime).default('application/json'),
126
+ encoding: z.enum(exampleBodyMime),
126
127
  /**
127
128
  * Body content as an object with a separately specified encoding or a simple pre-encoded string value
128
129
  *
@@ -249,6 +250,10 @@ function createParamInstance(param) {
249
250
  : schema?.items?.enum && schema?.type === 'array'
250
251
  ? schema.items.enum.map(String)
251
252
  : schema?.enum;
253
+ // Handle non-string examples
254
+ const parseExamples = schema?.examples && schema?.type !== 'string'
255
+ ? schema.examples?.map(String)
256
+ : schema?.examples;
252
257
  // safe parse the example
253
258
  const example = schemaModel({
254
259
  ...schema,
@@ -259,6 +264,7 @@ function createParamInstance(param) {
259
264
  /** Initialized all required properties to enabled */
260
265
  enabled: !!param.required,
261
266
  enum: parseEnum,
267
+ examples: parseExamples,
262
268
  }, requestExampleParametersSchema, false);
263
269
  if (!example) {
264
270
  console.warn(`Example at ${param.name} is invalid.`);
@@ -293,10 +299,6 @@ function createExampleFromRequest(request, name, server) {
293
299
  // Handle request body defaulting for various content type encodings
294
300
  const body = {
295
301
  activeBody: 'raw',
296
- raw: {
297
- encoding: 'json',
298
- value: '',
299
- },
300
302
  };
301
303
  if (request.requestBody) {
302
304
  const requestBody = getRequestBodyFromOperation({
@@ -133,7 +133,7 @@ export declare const oasRequestSchema: z.ZodObject<{
133
133
  'x-scalar-examples': z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
134
134
  name: z.ZodOptional<z.ZodString>;
135
135
  body: z.ZodOptional<z.ZodObject<{
136
- encoding: z.ZodDefault<z.ZodEnum<["application/json", "text/plain", "text/html", "application/javascript", "application/xml", "application/yaml", "application/edn", "application/octet-stream", "application/x-www-form-urlencoded", "multipart/form-data", "binary"]>>;
136
+ encoding: z.ZodEnum<["application/json", "text/plain", "text/html", "application/javascript", "application/xml", "application/yaml", "application/edn", "application/octet-stream", "application/x-www-form-urlencoded", "multipart/form-data", "binary"]>;
137
137
  content: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodString]>;
138
138
  file: z.ZodOptional<z.ZodNullable<z.ZodObject<{
139
139
  url: z.ZodString;
@@ -154,7 +154,7 @@ export declare const oasRequestSchema: z.ZodObject<{
154
154
  } | null | undefined;
155
155
  }, {
156
156
  content: string | Record<string, any>;
157
- encoding?: "application/json" | "text/plain" | "text/html" | "application/javascript" | "application/xml" | "application/yaml" | "application/edn" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "binary" | undefined;
157
+ encoding: "application/json" | "text/plain" | "text/html" | "application/javascript" | "application/xml" | "application/yaml" | "application/edn" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "binary";
158
158
  file?: {
159
159
  url: string;
160
160
  base64?: string | undefined;
@@ -202,7 +202,7 @@ export declare const oasRequestSchema: z.ZodObject<{
202
202
  name?: string | undefined;
203
203
  body?: {
204
204
  content: string | Record<string, any>;
205
- encoding?: "application/json" | "text/plain" | "text/html" | "application/javascript" | "application/xml" | "application/yaml" | "application/edn" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "binary" | undefined;
205
+ encoding: "application/json" | "text/plain" | "text/html" | "application/javascript" | "application/xml" | "application/yaml" | "application/edn" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "binary";
206
206
  file?: {
207
207
  url: string;
208
208
  base64?: string | undefined;
@@ -299,7 +299,7 @@ export declare const oasRequestSchema: z.ZodObject<{
299
299
  name?: string | undefined;
300
300
  body?: {
301
301
  content: string | Record<string, any>;
302
- encoding?: "application/json" | "text/plain" | "text/html" | "application/javascript" | "application/xml" | "application/yaml" | "application/edn" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "binary" | undefined;
302
+ encoding: "application/json" | "text/plain" | "text/html" | "application/javascript" | "application/xml" | "application/yaml" | "application/edn" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "binary";
303
303
  file?: {
304
304
  url: string;
305
305
  base64?: string | undefined;
@@ -413,7 +413,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
413
413
  'x-scalar-examples': z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
414
414
  name: z.ZodOptional<z.ZodString>;
415
415
  body: z.ZodOptional<z.ZodObject<{
416
- encoding: z.ZodDefault<z.ZodEnum<["application/json", "text/plain", "text/html", "application/javascript", "application/xml", "application/yaml", "application/edn", "application/octet-stream", "application/x-www-form-urlencoded", "multipart/form-data", "binary"]>>;
416
+ encoding: z.ZodEnum<["application/json", "text/plain", "text/html", "application/javascript", "application/xml", "application/yaml", "application/edn", "application/octet-stream", "application/x-www-form-urlencoded", "multipart/form-data", "binary"]>;
417
417
  content: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodString]>;
418
418
  file: z.ZodOptional<z.ZodNullable<z.ZodObject<{
419
419
  url: z.ZodString;
@@ -434,7 +434,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
434
434
  } | null | undefined;
435
435
  }, {
436
436
  content: string | Record<string, any>;
437
- encoding?: "application/json" | "text/plain" | "text/html" | "application/javascript" | "application/xml" | "application/yaml" | "application/edn" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "binary" | undefined;
437
+ encoding: "application/json" | "text/plain" | "text/html" | "application/javascript" | "application/xml" | "application/yaml" | "application/edn" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "binary";
438
438
  file?: {
439
439
  url: string;
440
440
  base64?: string | undefined;
@@ -482,7 +482,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
482
482
  name?: string | undefined;
483
483
  body?: {
484
484
  content: string | Record<string, any>;
485
- encoding?: "application/json" | "text/plain" | "text/html" | "application/javascript" | "application/xml" | "application/yaml" | "application/edn" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "binary" | undefined;
485
+ encoding: "application/json" | "text/plain" | "text/html" | "application/javascript" | "application/xml" | "application/yaml" | "application/edn" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data" | "binary";
486
486
  file?: {
487
487
  url: string;
488
488
  base64?: string | undefined;
@@ -1,46 +1,77 @@
1
1
  import type { OpenAPIV3_1 } from '@scalar/openapi-types';
2
2
  import { type ZodSchema, z } from 'zod';
3
3
  /**
4
- * Server variables
5
- * An object representing a Server Variable for server URL template substitution.
4
+ * Server Variable Object
6
5
  *
7
- * @see https://spec.openapis.org/oas/v3.1.0#server-variable-object
6
+ * An object representing a Server Variable for server URL template substitution.
8
7
  *
9
- * NOTE: Typecase is required to handle enum string array type
8
+ * @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#server-variable-object
10
9
  */
11
- export declare const oasServerVariableSchema: ZodSchema<Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
12
- enum?: [string, ...string[]];
10
+ export declare const oasServerVariableSchema: z.ZodObject<{
11
+ /**
12
+ * An enumeration of string values to be used if the substitution options are from a limited set. The array MUST NOT be empty.
13
+ */
14
+ enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
15
+ /**
16
+ * REQUIRED. The default value to use for substitution, which SHALL be sent if an alternate value is not supplied.
17
+ * Note this behavior is different than the Schema Object's treatment of default values, because in those cases
18
+ * parameter values are optional. If the enum is defined, the value MUST exist in the enum's values.
19
+ */
20
+ default: z.ZodOptional<z.ZodString>;
21
+ /**
22
+ * An optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
23
+ */
24
+ description: z.ZodOptional<z.ZodString>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ default?: string | undefined;
27
+ description?: string | undefined;
28
+ enum?: string[] | undefined;
29
+ }, {
30
+ default?: string | undefined;
31
+ description?: string | undefined;
32
+ enum?: string[] | undefined;
13
33
  }>;
34
+ /**
35
+ * Server Object
36
+ *
37
+ * An object representing a Server.
38
+ *
39
+ * @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#server-object
40
+ */
14
41
  export declare const oasServerSchema: z.ZodObject<{
15
42
  /**
16
43
  * REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that
17
44
  * the host location is relative to the location where the OpenAPI document is being served. Variable substitutions
18
45
  * will be made when a variable is named in {brackets}.
19
46
  */
20
- url: z.ZodDefault<z.ZodOptional<z.ZodString>>;
47
+ url: z.ZodString;
21
48
  /**
22
49
  * An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text
23
50
  * representation.
24
51
  */
25
52
  description: z.ZodOptional<z.ZodString>;
26
- /** A map between a variable name and its value. The value is used for substitution in the servers URL template. */
53
+ /** A map between a variable name and its value. The value is used for substitution in the server's URL template. */
27
54
  variables: z.ZodOptional<z.ZodRecord<z.ZodString, ZodSchema<Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
28
55
  enum?: [string, ...string[]];
56
+ value?: string;
29
57
  }, z.ZodTypeDef, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
30
58
  enum?: [string, ...string[]];
59
+ value?: string;
31
60
  }>>>;
32
61
  }, "strip", z.ZodTypeAny, {
33
62
  url: string;
34
63
  description?: string | undefined;
35
64
  variables?: Record<string, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
36
65
  enum?: [string, ...string[]];
66
+ value?: string;
37
67
  }> | undefined;
38
68
  }, {
69
+ url: string;
39
70
  description?: string | undefined;
40
71
  variables?: Record<string, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
41
72
  enum?: [string, ...string[]];
73
+ value?: string;
42
74
  }> | undefined;
43
- url?: string | undefined;
44
75
  }>;
45
76
  export declare const serverSchema: z.ZodObject<z.objectUtil.extendShape<{
46
77
  /**
@@ -48,17 +79,19 @@ export declare const serverSchema: z.ZodObject<z.objectUtil.extendShape<{
48
79
  * the host location is relative to the location where the OpenAPI document is being served. Variable substitutions
49
80
  * will be made when a variable is named in {brackets}.
50
81
  */
51
- url: z.ZodDefault<z.ZodOptional<z.ZodString>>;
82
+ url: z.ZodString;
52
83
  /**
53
84
  * An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text
54
85
  * representation.
55
86
  */
56
87
  description: z.ZodOptional<z.ZodString>;
57
- /** A map between a variable name and its value. The value is used for substitution in the servers URL template. */
88
+ /** A map between a variable name and its value. The value is used for substitution in the server's URL template. */
58
89
  variables: z.ZodOptional<z.ZodRecord<z.ZodString, ZodSchema<Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
59
90
  enum?: [string, ...string[]];
91
+ value?: string;
60
92
  }, z.ZodTypeDef, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
61
93
  enum?: [string, ...string[]];
94
+ value?: string;
62
95
  }>>>;
63
96
  }, {
64
97
  uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -68,14 +101,16 @@ export declare const serverSchema: z.ZodObject<z.objectUtil.extendShape<{
68
101
  description?: string | undefined;
69
102
  variables?: Record<string, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
70
103
  enum?: [string, ...string[]];
104
+ value?: string;
71
105
  }> | undefined;
72
106
  }, {
107
+ url: string;
73
108
  uid?: string | undefined;
74
109
  description?: string | undefined;
75
110
  variables?: Record<string, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
76
111
  enum?: [string, ...string[]];
112
+ value?: string;
77
113
  }> | undefined;
78
- url?: string | undefined;
79
114
  }>;
80
115
  export type Server = z.infer<typeof serverSchema>;
81
116
  export type ServerPayload = z.input<typeof serverSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,KAAK,SAAS,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvC;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,EAc9B,SAAS,CACb,IAAI,CAAC,WAAW,CAAC,oBAAoB,EAAE,MAAM,CAAC,GAAG;IAC/C,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAA;CAC7B,CACF,CAAA;AAED,eAAO,MAAM,eAAe;IAC1B;;;;OAIG;;IAEH;;;OAGG;;IAEH,oHAAoH;;eAhB3G,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;eAArB,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;;;;;eAArB,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;;;;eAArB,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;;EAkBgB,CAAA;AAEhD,eAAO,MAAM,YAAY;IAfvB;;;;OAIG;;IAEH;;;OAGG;;IAEH,oHAAoH;;eAhB3G,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;eAArB,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;;;;;;;;eAArB,C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AAM,EAAE,GAAG,MAAM,EAAE,CAAC;gBACpB,MAAM;;EA6BhB,CAAA;AAEF,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AACjD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA"}
@@ -2,42 +2,68 @@ import { z } from 'zod';
2
2
  import { nanoidSchema } from '../shared/utility.js';
3
3
 
4
4
  /**
5
- * Server variables
6
- * An object representing a Server Variable for server URL template substitution.
5
+ * Server Variable Object
7
6
  *
8
- * @see https://spec.openapis.org/oas/v3.1.0#server-variable-object
7
+ * An object representing a Server Variable for server URL template substitution.
9
8
  *
10
- * NOTE: Typecase is required to handle enum string array type
9
+ * @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#server-variable-object
11
10
  */
12
11
  const oasServerVariableSchema = z.object({
13
12
  /**
14
- * An enumeration of string values to be used if the substitution options are from a limited set.
15
- * The array MUST NOT be empty.
13
+ * An enumeration of string values to be used if the substitution options are from a limited set. The array MUST NOT be empty.
16
14
  */
17
- enum: z.string().array().min(1).optional(),
15
+ enum: z.array(z.string()).optional(),
18
16
  /**
19
17
  * REQUIRED. The default value to use for substitution, which SHALL be sent if an alternate value is not supplied.
20
- * Note this behavior is different than the Schema Objects treatment of default values, because in those cases
21
- * parameter values are optional. If the enum is defined, the value MUST exist in the enums values.
18
+ * Note this behavior is different than the Schema Object's treatment of default values, because in those cases
19
+ * parameter values are optional. If the enum is defined, the value MUST exist in the enum's values.
20
+ */
21
+ default: z.string().optional(),
22
+ /**
23
+ * An optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
22
24
  */
23
- default: z.string().optional().default('default'),
24
- /** An optional description for the server variable. CommonMark syntax MAY be used for rich text representation. */
25
25
  description: z.string().optional(),
26
26
  });
27
+ /** Extended schema for server variables */
28
+ const extendedServerVariableSchema = oasServerVariableSchema
29
+ .extend({
30
+ /** The value of the variable */
31
+ value: z.string().optional(),
32
+ })
33
+ .refine((data) => {
34
+ // Set default to the first enum value if invalid
35
+ if (Array.isArray(data.enum) &&
36
+ !data.enum.includes(data.default ?? '') &&
37
+ data.enum.length > 0) {
38
+ data.default = data.enum[0];
39
+ }
40
+ if (Array.isArray(data.enum) && data.enum.length === 0) {
41
+ delete data.enum;
42
+ }
43
+ // Always return true since we’ve modified the data to be valid
44
+ return true;
45
+ });
46
+ /**
47
+ * Server Object
48
+ *
49
+ * An object representing a Server.
50
+ *
51
+ * @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#server-object
52
+ */
27
53
  const oasServerSchema = z.object({
28
54
  /**
29
55
  * REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that
30
56
  * the host location is relative to the location where the OpenAPI document is being served. Variable substitutions
31
57
  * will be made when a variable is named in {brackets}.
32
58
  */
33
- url: z.string().optional().default(''),
59
+ url: z.string(),
34
60
  /**
35
61
  * An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text
36
62
  * representation.
37
63
  */
38
64
  description: z.string().optional(),
39
- /** A map between a variable name and its value. The value is used for substitution in the servers URL template. */
40
- variables: z.record(z.string(), oasServerVariableSchema).optional(),
65
+ /** A map between a variable name and its value. The value is used for substitution in the server's URL template. */
66
+ variables: z.record(z.string(), extendedServerVariableSchema).optional(),
41
67
  });
42
68
  const serverSchema = oasServerSchema.extend({
43
69
  uid: nanoidSchema,
@@ -1,6 +1,6 @@
1
1
  import { type Collection, type CollectionPayload, type Request, type RequestExample, type Server, type Tag } from '../entities/spec/index.js';
2
2
  import { type SecurityScheme } from '../entities/spec/security.js';
3
- import type { OpenAPIV3, OpenAPIV3_1 } from '@scalar/openapi-types';
3
+ import type { OpenAPIV3_1 } from '@scalar/openapi-types';
4
4
  import type { ReferenceConfiguration } from '@scalar/types/legacy';
5
5
  import type { UnknownObject } from '@scalar/types/utils';
6
6
  /** Takes a string or object and parses it into an openapi spec compliant schema */
@@ -11,7 +11,7 @@ export declare const parseSchema: (spec: string | UnknownObject, { shouldLoad }?
11
11
  * Temporary fix for the parser returning an empty array
12
12
  * TODO: remove this once the parser is fixed
13
13
  */
14
- schema: OpenAPIV3.Document | OpenAPIV3_1.Document;
14
+ schema: OpenAPIV3_1.Document;
15
15
  errors: import("@scalar/openapi-parser").ErrorObject[];
16
16
  }>;
17
17
  export type ImportSpecToWorkspaceArgs = Pick<CollectionPayload, 'documentUrl' | 'watchMode'> & Pick<ReferenceConfiguration, 'authentication' | 'baseServerURL' | 'servers'> & {
@@ -33,11 +33,11 @@ export type ImportSpecToWorkspaceArgs = Pick<CollectionPayload, 'documentUrl' |
33
33
  * - Proper linking between related components
34
34
  * - Easy lookup and reference of dependent entities
35
35
  */
36
- export declare function importSpecToWorkspace(spec: string | UnknownObject, { authentication, baseServerURL, documentUrl, servers: overloadServers, setCollectionSecurity, shouldLoad, watchMode, }?: ImportSpecToWorkspaceArgs): Promise<{
36
+ export declare function importSpecToWorkspace(spec: string | UnknownObject, { authentication, baseServerURL, documentUrl, servers: configuredServers, setCollectionSecurity, shouldLoad, watchMode, }?: ImportSpecToWorkspaceArgs): Promise<{
37
37
  error: false;
38
38
  collection: Collection;
39
39
  requests: Request[];
40
- schema: OpenAPIV3.Document | OpenAPIV3_1.Document;
40
+ schema: OpenAPIV3_1.Document;
41
41
  examples: RequestExample[];
42
42
  servers: Server[];
43
43
  tags: Tag[];
@@ -46,4 +46,8 @@ export declare function importSpecToWorkspace(spec: string | UnknownObject, { au
46
46
  error: true;
47
47
  importWarnings: string[];
48
48
  }>;
49
+ /**
50
+ * Retrieves a list of servers from an OpenAPI document and converts them to a list of Server entities.
51
+ */
52
+ export declare function getServersFromOpenApiDocument(servers: OpenAPIV3_1.ServerObject[] | undefined, { baseServerURL }?: Pick<ReferenceConfiguration, 'baseServerURL'>): Server[];
49
53
  //# sourceMappingURL=import-spec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"import-spec.d.ts","sourceRoot":"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EACX,OAAO,EAAE,iBAAiB,EAC1B,qBAA6B,EAC7B,UAAU,EACV,SAAiB,GAClB,GAAE,yBAA8B,GAChC,OAAO,CACN;IACE,KAAK,EAAE,KAAK,CAAA;IACZ,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAA;IAC5B,QAAQ,EAAE,cAAc,EAAE,CAAA;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,IAAI,EAAE,GAAG,EAAE,CAAA;IACX,eAAe,EAAE,cAAc,EAAE,CAAA;CAClC,GACD;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAC5C,CAgUA;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,WAAW,CAAC,YAAY,EAAE,GAAG,SAAS,EAC/C,EAAE,aAAa,EAAE,GAAE,IAAI,CAAC,sBAAsB,EAAE,eAAe,CAAM,GACpE,MAAM,EAAE,CA4CV"}
@@ -8,6 +8,8 @@ import { requestSchema } from '../entities/spec/requests.js';
8
8
  import { tagSchema } from '../entities/spec/spec-objects.js';
9
9
  import { createExampleFromRequest } from '../entities/spec/request-examples.js';
10
10
  import { collectionSchema } from '../entities/spec/collection.js';
11
+ import { concatenateUrlAndPath } from '../helpers/concatenateUrlAndPath.js';
12
+ import { isDefined } from '../helpers/is-defined.js';
11
13
 
12
14
  /** Takes a string or object and parses it into an openapi spec compliant schema */
13
15
  const parseSchema = async (spec, { shouldLoad = true } = {}) => {
@@ -61,7 +63,7 @@ const parseSchema = async (spec, { shouldLoad = true } = {}) => {
61
63
  * - Proper linking between related components
62
64
  * - Easy lookup and reference of dependent entities
63
65
  */
64
- async function importSpecToWorkspace(spec, { authentication, baseServerURL, documentUrl, servers: overloadServers, setCollectionSecurity = false, shouldLoad, watchMode = false, } = {}) {
66
+ async function importSpecToWorkspace(spec, { authentication, baseServerURL, documentUrl, servers: configuredServers, setCollectionSecurity = false, shouldLoad, watchMode = false, } = {}) {
65
67
  const { schema, errors } = await parseSchema(spec, { shouldLoad });
66
68
  const importWarnings = [...errors.map((e) => e.message)];
67
69
  if (!schema)
@@ -70,31 +72,10 @@ async function importSpecToWorkspace(spec, { authentication, baseServerURL, docu
70
72
  // Some entities will be broken out as individual lists for modification in the workspace
71
73
  const start = performance.now();
72
74
  const requests = [];
73
- // Grab the base server URL for relative servers
74
- const backupBaseServerUrl = typeof window === 'undefined' ? 'http://localhost' : window.location.origin;
75
- const _baseServerUrl = baseServerURL ?? backupBaseServerUrl;
76
75
  // Add the base server url to any relative servers
77
- const servers = serverSchema.array().parse((overloadServers ?? schema.servers)?.map((s) => {
78
- // Prepend base server url if relative
79
- if (s?.url?.startsWith('/'))
80
- return {
81
- ...s,
82
- // Ensure we only have one slash between
83
- url: [
84
- _baseServerUrl.replace(/\/$/, ''),
85
- s.url.replace(/^\//, ''),
86
- ].join('/'),
87
- };
88
- // Just return a regular server
89
- if (s.url)
90
- return s;
91
- // Failsafe for no URL, use the base
92
- else
93
- return {
94
- url: _baseServerUrl,
95
- description: 'Replace with your API server',
96
- };
97
- }) ?? []);
76
+ const servers = getServersFromOpenApiDocument(configuredServers || schema.servers, {
77
+ baseServerURL,
78
+ });
98
79
  /**
99
80
  * List of all tag strings. For non compliant specs we may need to
100
81
  * add top level tag objects for missing tag objects
@@ -275,7 +256,7 @@ async function importSpecToWorkspace(spec, { authentication, baseServerURL, docu
275
256
  });
276
257
  // Add the request UIDs to the tag children (or collection root)
277
258
  requests.forEach((r) => {
278
- if (r.tags) {
259
+ if (r.tags?.length) {
279
260
  r.tags.forEach((t) => {
280
261
  tagMap[t].children.push(r.uid);
281
262
  });
@@ -338,5 +319,42 @@ async function importSpecToWorkspace(spec, { authentication, baseServerURL, docu
338
319
  securitySchemes,
339
320
  };
340
321
  }
322
+ /**
323
+ * Retrieves a list of servers from an OpenAPI document and converts them to a list of Server entities.
324
+ */
325
+ function getServersFromOpenApiDocument(servers, { baseServerURL } = {}) {
326
+ if (!servers || !Array.isArray(servers))
327
+ return [];
328
+ return servers
329
+ .map((server) => {
330
+ try {
331
+ // Validate the server against the schema
332
+ const parsedSchema = serverSchema.parse(server);
333
+ // Prepend with the base server URL (if the given URL is relative)
334
+ if (parsedSchema?.url?.startsWith('/')) {
335
+ // Use the base server URL (if provided)
336
+ if (baseServerURL) {
337
+ parsedSchema.url = concatenateUrlAndPath(baseServerURL?.replace(/\/$/, ''), parsedSchema.url.replace(/^\//, ''));
338
+ return parsedSchema;
339
+ }
340
+ // Fallback to the current window origin
341
+ if (typeof window?.location?.origin === 'string') {
342
+ parsedSchema.url = concatenateUrlAndPath(window.location.origin, parsedSchema.url.replace(/^\//, ''));
343
+ return parsedSchema;
344
+ }
345
+ }
346
+ // Must be good, return it
347
+ return parsedSchema;
348
+ }
349
+ catch (error) {
350
+ console.warn(`Oops, that’s an invalid server configuration.`);
351
+ console.warn('Server:', server);
352
+ console.warn('Error:', error);
353
+ // Return undefined to remove the server
354
+ return undefined;
355
+ }
356
+ })
357
+ .filter(isDefined);
358
+ }
341
359
 
342
- export { importSpecToWorkspace, parseSchema };
360
+ export { getServersFromOpenApiDocument, importSpecToWorkspace, parseSchema };
@@ -1,2 +1,2 @@
1
- export { importSpecToWorkspace, parseSchema } from './import-spec.js';
1
+ export { getServersFromOpenApiDocument, importSpecToWorkspace, parseSchema } from './import-spec.js';
2
2
  export { exportSpecFromWorkspace } from './export-spec.js';
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "specification",
17
17
  "yaml"
18
18
  ],
19
- "version": "0.2.99",
19
+ "version": "0.2.101",
20
20
  "engines": {
21
21
  "node": ">=18"
22
22
  },
@@ -122,9 +122,9 @@
122
122
  "yaml": "^2.4.5",
123
123
  "zod": "^3.23.8",
124
124
  "@scalar/object-utils": "1.1.12",
125
- "@scalar/types": "0.0.27",
126
- "@scalar/themes": "0.9.61",
127
- "@scalar/openapi-types": "0.1.6"
125
+ "@scalar/openapi-types": "0.1.6",
126
+ "@scalar/themes": "0.9.63",
127
+ "@scalar/types": "0.0.29"
128
128
  },
129
129
  "devDependencies": {
130
130
  "type-fest": "^4.20.0",