@scalar/oas-utils 0.2.124 → 0.2.125
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 +15 -0
- package/dist/entities/spec/request-examples.d.ts +27 -27
- package/dist/entities/spec/spec-objects.d.ts.map +1 -1
- package/dist/entities/spec/spec-objects.js +8 -1
- package/dist/spec-getters/get-example-from-schema.d.ts.map +1 -1
- package/dist/spec-getters/get-example-from-schema.js +12 -3
- package/dist/transforms/import-spec.d.ts +1 -1
- package/dist/transforms/import-spec.d.ts.map +1 -1
- package/dist/transforms/import-spec.js +1 -1
- package/package.json +6 -6
- package/dist/entities/spec/security.d.ts +0 -1436
- package/dist/entities/spec/security.d.ts.map +0 -1
- package/dist/entities/spec/security.js +0 -179
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @scalar/oas-utils
|
|
2
2
|
|
|
3
|
+
## 0.2.125
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e62e677: feat: make zod remove undefined values recursively
|
|
8
|
+
- 04e27a1: feat: support x-default-scopes
|
|
9
|
+
- 846d015: fix: add cap on horizontal expententially expanding bodys
|
|
10
|
+
- Updated dependencies [e62e677]
|
|
11
|
+
- Updated dependencies [e09dab3]
|
|
12
|
+
- Updated dependencies [82f16a5]
|
|
13
|
+
- Updated dependencies [04e27a1]
|
|
14
|
+
- @scalar/openapi-types@0.2.0
|
|
15
|
+
- @scalar/types@0.1.5
|
|
16
|
+
- @scalar/themes@0.9.83
|
|
17
|
+
|
|
3
18
|
## 0.2.124
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -46,10 +46,10 @@ export declare const requestExampleParametersSchema: z.ZodEffects<z.ZodObject<{
|
|
|
46
46
|
description?: string | undefined;
|
|
47
47
|
default?: any;
|
|
48
48
|
required?: boolean | undefined;
|
|
49
|
+
key?: string | undefined;
|
|
49
50
|
examples?: string[] | undefined;
|
|
50
51
|
format?: string | undefined;
|
|
51
52
|
enum?: string[] | undefined;
|
|
52
|
-
key?: string | undefined;
|
|
53
53
|
enabled?: boolean | undefined;
|
|
54
54
|
file?: any;
|
|
55
55
|
nullable?: boolean | undefined;
|
|
@@ -76,10 +76,10 @@ export declare const requestExampleParametersSchema: z.ZodEffects<z.ZodObject<{
|
|
|
76
76
|
description?: string | undefined;
|
|
77
77
|
default?: any;
|
|
78
78
|
required?: boolean | undefined;
|
|
79
|
+
key?: string | undefined;
|
|
79
80
|
examples?: string[] | undefined;
|
|
80
81
|
format?: string | undefined;
|
|
81
82
|
enum?: string[] | undefined;
|
|
82
|
-
key?: string | undefined;
|
|
83
83
|
enabled?: boolean | undefined;
|
|
84
84
|
file?: any;
|
|
85
85
|
nullable?: boolean | undefined;
|
|
@@ -211,10 +211,10 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
|
|
|
211
211
|
description?: string | undefined;
|
|
212
212
|
default?: any;
|
|
213
213
|
required?: boolean | undefined;
|
|
214
|
+
key?: string | undefined;
|
|
214
215
|
examples?: string[] | undefined;
|
|
215
216
|
format?: string | undefined;
|
|
216
217
|
enum?: string[] | undefined;
|
|
217
|
-
key?: string | undefined;
|
|
218
218
|
enabled?: boolean | undefined;
|
|
219
219
|
file?: any;
|
|
220
220
|
nullable?: boolean | undefined;
|
|
@@ -241,10 +241,10 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
|
|
|
241
241
|
description?: string | undefined;
|
|
242
242
|
default?: any;
|
|
243
243
|
required?: boolean | undefined;
|
|
244
|
+
key?: string | undefined;
|
|
244
245
|
examples?: string[] | undefined;
|
|
245
246
|
format?: string | undefined;
|
|
246
247
|
enum?: string[] | undefined;
|
|
247
|
-
key?: string | undefined;
|
|
248
248
|
enabled?: boolean | undefined;
|
|
249
249
|
file?: any;
|
|
250
250
|
nullable?: boolean | undefined;
|
|
@@ -276,10 +276,10 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
|
|
|
276
276
|
description?: string | undefined;
|
|
277
277
|
default?: any;
|
|
278
278
|
required?: boolean | undefined;
|
|
279
|
+
key?: string | undefined;
|
|
279
280
|
examples?: string[] | undefined;
|
|
280
281
|
format?: string | undefined;
|
|
281
282
|
enum?: string[] | undefined;
|
|
282
|
-
key?: string | undefined;
|
|
283
283
|
enabled?: boolean | undefined;
|
|
284
284
|
file?: any;
|
|
285
285
|
nullable?: boolean | undefined;
|
|
@@ -325,10 +325,10 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
|
|
|
325
325
|
description?: string | undefined;
|
|
326
326
|
default?: any;
|
|
327
327
|
required?: boolean | undefined;
|
|
328
|
+
key?: string | undefined;
|
|
328
329
|
examples?: string[] | undefined;
|
|
329
330
|
format?: string | undefined;
|
|
330
331
|
enum?: string[] | undefined;
|
|
331
|
-
key?: string | undefined;
|
|
332
332
|
enabled?: boolean | undefined;
|
|
333
333
|
file?: any;
|
|
334
334
|
nullable?: boolean | undefined;
|
|
@@ -439,10 +439,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
439
439
|
description?: string | undefined;
|
|
440
440
|
default?: any;
|
|
441
441
|
required?: boolean | undefined;
|
|
442
|
+
key?: string | undefined;
|
|
442
443
|
examples?: string[] | undefined;
|
|
443
444
|
format?: string | undefined;
|
|
444
445
|
enum?: string[] | undefined;
|
|
445
|
-
key?: string | undefined;
|
|
446
446
|
enabled?: boolean | undefined;
|
|
447
447
|
file?: any;
|
|
448
448
|
nullable?: boolean | undefined;
|
|
@@ -469,10 +469,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
469
469
|
description?: string | undefined;
|
|
470
470
|
default?: any;
|
|
471
471
|
required?: boolean | undefined;
|
|
472
|
+
key?: string | undefined;
|
|
472
473
|
examples?: string[] | undefined;
|
|
473
474
|
format?: string | undefined;
|
|
474
475
|
enum?: string[] | undefined;
|
|
475
|
-
key?: string | undefined;
|
|
476
476
|
enabled?: boolean | undefined;
|
|
477
477
|
file?: any;
|
|
478
478
|
nullable?: boolean | undefined;
|
|
@@ -504,10 +504,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
504
504
|
description?: string | undefined;
|
|
505
505
|
default?: any;
|
|
506
506
|
required?: boolean | undefined;
|
|
507
|
+
key?: string | undefined;
|
|
507
508
|
examples?: string[] | undefined;
|
|
508
509
|
format?: string | undefined;
|
|
509
510
|
enum?: string[] | undefined;
|
|
510
|
-
key?: string | undefined;
|
|
511
511
|
enabled?: boolean | undefined;
|
|
512
512
|
file?: any;
|
|
513
513
|
nullable?: boolean | undefined;
|
|
@@ -553,10 +553,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
553
553
|
description?: string | undefined;
|
|
554
554
|
default?: any;
|
|
555
555
|
required?: boolean | undefined;
|
|
556
|
+
key?: string | undefined;
|
|
556
557
|
examples?: string[] | undefined;
|
|
557
558
|
format?: string | undefined;
|
|
558
559
|
enum?: string[] | undefined;
|
|
559
|
-
key?: string | undefined;
|
|
560
560
|
enabled?: boolean | undefined;
|
|
561
561
|
file?: any;
|
|
562
562
|
nullable?: boolean | undefined;
|
|
@@ -610,10 +610,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
610
610
|
description?: string | undefined;
|
|
611
611
|
default?: any;
|
|
612
612
|
required?: boolean | undefined;
|
|
613
|
+
key?: string | undefined;
|
|
613
614
|
examples?: string[] | undefined;
|
|
614
615
|
format?: string | undefined;
|
|
615
616
|
enum?: string[] | undefined;
|
|
616
|
-
key?: string | undefined;
|
|
617
617
|
enabled?: boolean | undefined;
|
|
618
618
|
file?: any;
|
|
619
619
|
nullable?: boolean | undefined;
|
|
@@ -640,10 +640,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
640
640
|
description?: string | undefined;
|
|
641
641
|
default?: any;
|
|
642
642
|
required?: boolean | undefined;
|
|
643
|
+
key?: string | undefined;
|
|
643
644
|
examples?: string[] | undefined;
|
|
644
645
|
format?: string | undefined;
|
|
645
646
|
enum?: string[] | undefined;
|
|
646
|
-
key?: string | undefined;
|
|
647
647
|
enabled?: boolean | undefined;
|
|
648
648
|
file?: any;
|
|
649
649
|
nullable?: boolean | undefined;
|
|
@@ -686,10 +686,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
686
686
|
description?: string | undefined;
|
|
687
687
|
default?: any;
|
|
688
688
|
required?: boolean | undefined;
|
|
689
|
+
key?: string | undefined;
|
|
689
690
|
examples?: string[] | undefined;
|
|
690
691
|
format?: string | undefined;
|
|
691
692
|
enum?: string[] | undefined;
|
|
692
|
-
key?: string | undefined;
|
|
693
693
|
enabled?: boolean | undefined;
|
|
694
694
|
file?: any;
|
|
695
695
|
nullable?: boolean | undefined;
|
|
@@ -716,10 +716,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
716
716
|
description?: string | undefined;
|
|
717
717
|
default?: any;
|
|
718
718
|
required?: boolean | undefined;
|
|
719
|
+
key?: string | undefined;
|
|
719
720
|
examples?: string[] | undefined;
|
|
720
721
|
format?: string | undefined;
|
|
721
722
|
enum?: string[] | undefined;
|
|
722
|
-
key?: string | undefined;
|
|
723
723
|
enabled?: boolean | undefined;
|
|
724
724
|
file?: any;
|
|
725
725
|
nullable?: boolean | undefined;
|
|
@@ -762,10 +762,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
762
762
|
description?: string | undefined;
|
|
763
763
|
default?: any;
|
|
764
764
|
required?: boolean | undefined;
|
|
765
|
+
key?: string | undefined;
|
|
765
766
|
examples?: string[] | undefined;
|
|
766
767
|
format?: string | undefined;
|
|
767
768
|
enum?: string[] | undefined;
|
|
768
|
-
key?: string | undefined;
|
|
769
769
|
enabled?: boolean | undefined;
|
|
770
770
|
file?: any;
|
|
771
771
|
nullable?: boolean | undefined;
|
|
@@ -792,10 +792,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
792
792
|
description?: string | undefined;
|
|
793
793
|
default?: any;
|
|
794
794
|
required?: boolean | undefined;
|
|
795
|
+
key?: string | undefined;
|
|
795
796
|
examples?: string[] | undefined;
|
|
796
797
|
format?: string | undefined;
|
|
797
798
|
enum?: string[] | undefined;
|
|
798
|
-
key?: string | undefined;
|
|
799
799
|
enabled?: boolean | undefined;
|
|
800
800
|
file?: any;
|
|
801
801
|
nullable?: boolean | undefined;
|
|
@@ -838,10 +838,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
838
838
|
description?: string | undefined;
|
|
839
839
|
default?: any;
|
|
840
840
|
required?: boolean | undefined;
|
|
841
|
+
key?: string | undefined;
|
|
841
842
|
examples?: string[] | undefined;
|
|
842
843
|
format?: string | undefined;
|
|
843
844
|
enum?: string[] | undefined;
|
|
844
|
-
key?: string | undefined;
|
|
845
845
|
enabled?: boolean | undefined;
|
|
846
846
|
file?: any;
|
|
847
847
|
nullable?: boolean | undefined;
|
|
@@ -868,10 +868,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
868
868
|
description?: string | undefined;
|
|
869
869
|
default?: any;
|
|
870
870
|
required?: boolean | undefined;
|
|
871
|
+
key?: string | undefined;
|
|
871
872
|
examples?: string[] | undefined;
|
|
872
873
|
format?: string | undefined;
|
|
873
874
|
enum?: string[] | undefined;
|
|
874
|
-
key?: string | undefined;
|
|
875
875
|
enabled?: boolean | undefined;
|
|
876
876
|
file?: any;
|
|
877
877
|
nullable?: boolean | undefined;
|
|
@@ -950,10 +950,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
950
950
|
description?: string | undefined;
|
|
951
951
|
default?: any;
|
|
952
952
|
required?: boolean | undefined;
|
|
953
|
+
key?: string | undefined;
|
|
953
954
|
examples?: string[] | undefined;
|
|
954
955
|
format?: string | undefined;
|
|
955
956
|
enum?: string[] | undefined;
|
|
956
|
-
key?: string | undefined;
|
|
957
957
|
enabled?: boolean | undefined;
|
|
958
958
|
file?: any;
|
|
959
959
|
nullable?: boolean | undefined;
|
|
@@ -966,10 +966,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
966
966
|
description?: string | undefined;
|
|
967
967
|
default?: any;
|
|
968
968
|
required?: boolean | undefined;
|
|
969
|
+
key?: string | undefined;
|
|
969
970
|
examples?: string[] | undefined;
|
|
970
971
|
format?: string | undefined;
|
|
971
972
|
enum?: string[] | undefined;
|
|
972
|
-
key?: string | undefined;
|
|
973
973
|
enabled?: boolean | undefined;
|
|
974
974
|
file?: any;
|
|
975
975
|
nullable?: boolean | undefined;
|
|
@@ -982,10 +982,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
982
982
|
description?: string | undefined;
|
|
983
983
|
default?: any;
|
|
984
984
|
required?: boolean | undefined;
|
|
985
|
+
key?: string | undefined;
|
|
985
986
|
examples?: string[] | undefined;
|
|
986
987
|
format?: string | undefined;
|
|
987
988
|
enum?: string[] | undefined;
|
|
988
|
-
key?: string | undefined;
|
|
989
989
|
enabled?: boolean | undefined;
|
|
990
990
|
file?: any;
|
|
991
991
|
nullable?: boolean | undefined;
|
|
@@ -998,10 +998,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
998
998
|
description?: string | undefined;
|
|
999
999
|
default?: any;
|
|
1000
1000
|
required?: boolean | undefined;
|
|
1001
|
+
key?: string | undefined;
|
|
1001
1002
|
examples?: string[] | undefined;
|
|
1002
1003
|
format?: string | undefined;
|
|
1003
1004
|
enum?: string[] | undefined;
|
|
1004
|
-
key?: string | undefined;
|
|
1005
1005
|
enabled?: boolean | undefined;
|
|
1006
1006
|
file?: any;
|
|
1007
1007
|
nullable?: boolean | undefined;
|
|
@@ -1123,10 +1123,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
1123
1123
|
description?: string | undefined;
|
|
1124
1124
|
default?: any;
|
|
1125
1125
|
required?: boolean | undefined;
|
|
1126
|
+
key?: string | undefined;
|
|
1126
1127
|
examples?: string[] | undefined;
|
|
1127
1128
|
format?: string | undefined;
|
|
1128
1129
|
enum?: string[] | undefined;
|
|
1129
|
-
key?: string | undefined;
|
|
1130
1130
|
enabled?: boolean | undefined;
|
|
1131
1131
|
file?: any;
|
|
1132
1132
|
nullable?: boolean | undefined;
|
|
@@ -1151,10 +1151,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
1151
1151
|
description?: string | undefined;
|
|
1152
1152
|
default?: any;
|
|
1153
1153
|
required?: boolean | undefined;
|
|
1154
|
+
key?: string | undefined;
|
|
1154
1155
|
examples?: string[] | undefined;
|
|
1155
1156
|
format?: string | undefined;
|
|
1156
1157
|
enum?: string[] | undefined;
|
|
1157
|
-
key?: string | undefined;
|
|
1158
1158
|
enabled?: boolean | undefined;
|
|
1159
1159
|
file?: any;
|
|
1160
1160
|
nullable?: boolean | undefined;
|
|
@@ -1167,10 +1167,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
1167
1167
|
description?: string | undefined;
|
|
1168
1168
|
default?: any;
|
|
1169
1169
|
required?: boolean | undefined;
|
|
1170
|
+
key?: string | undefined;
|
|
1170
1171
|
examples?: string[] | undefined;
|
|
1171
1172
|
format?: string | undefined;
|
|
1172
1173
|
enum?: string[] | undefined;
|
|
1173
|
-
key?: string | undefined;
|
|
1174
1174
|
enabled?: boolean | undefined;
|
|
1175
1175
|
file?: any;
|
|
1176
1176
|
nullable?: boolean | undefined;
|
|
@@ -1183,10 +1183,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
1183
1183
|
description?: string | undefined;
|
|
1184
1184
|
default?: any;
|
|
1185
1185
|
required?: boolean | undefined;
|
|
1186
|
+
key?: string | undefined;
|
|
1186
1187
|
examples?: string[] | undefined;
|
|
1187
1188
|
format?: string | undefined;
|
|
1188
1189
|
enum?: string[] | undefined;
|
|
1189
|
-
key?: string | undefined;
|
|
1190
1190
|
enabled?: boolean | undefined;
|
|
1191
1191
|
file?: any;
|
|
1192
1192
|
nullable?: boolean | undefined;
|
|
@@ -1199,10 +1199,10 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
1199
1199
|
description?: string | undefined;
|
|
1200
1200
|
default?: any;
|
|
1201
1201
|
required?: boolean | undefined;
|
|
1202
|
+
key?: string | undefined;
|
|
1202
1203
|
examples?: string[] | undefined;
|
|
1203
1204
|
format?: string | undefined;
|
|
1204
1205
|
enum?: string[] | undefined;
|
|
1205
|
-
key?: string | undefined;
|
|
1206
1206
|
enabled?: boolean | undefined;
|
|
1207
1207
|
file?: any;
|
|
1208
1208
|
nullable?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec-objects.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/spec-objects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,MAAM,QAAQ,CAAC,KAAG,
|
|
1
|
+
{"version":3,"file":"spec-objects.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/spec-objects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,MAAM,QAAQ,CAAC,KAAG,CAW/D,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;IAEzB,mDAAmD;;IAEnD,2GAA2G;;IAE3G;;OAEG;;;;;;;;;;;;;;;;;;EAG0B,CAAA;AAEjC;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;IAEzB,+DAA+D;;IAE/D,sFAAsF;;IAEtF,0GAA0G;;;;;;;;;;;;;;;;;;EAG7E,CAAA;AAEjC;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;IAEtB,sCAAsC;;IAEtC,kCAAkC;;IAElC,4FAA4F;;IAE5F,oFAAoF;;IAEpF,mDAAmD;;QA3BnD,+DAA+D;;QAE/D,sFAAsF;;QAEtF,0GAA0G;;;;;;;;;;;;;;;;;;;IAyB1G,mDAAmD;;QAjDnD,mDAAmD;;QAEnD,2GAA2G;;QAE3G;;WAEG;;;;;;;;;;;;;;;;;;;IA6CH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG0B,CAAA;AAEjC;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B;IAEvC,6GAA6G;;IAE7G,yFAAyF;;;;;;;;;;;;;;EAG5D,CAAA;AAEjC,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAA;AAElF,eAAO,MAAM,mBAAmB;;;;;;WAItB,CAAA;AAEV;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;IAEvB;;OAEG;;IAEH,qCAAqC;;IAErC,6FAA6F;;IAE7F,sDAAsD;;QAjCpD,6GAA6G;;QAE7G,yFAAyF;;;;;;;;;;;;;;;;;;;;;;IAkC3F,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGvB,CAAA;AAEF,eAAO,MAAM,SAAS;IAhBpB;;OAEG;;IAEH,qCAAqC;;IAErC,6FAA6F;;IAE7F,sDAAsD;;QAjCpD,6GAA6G;;QAE7G,yFAAyF;;;;;;;;;;;;;;;;;;;;;;IAkC3F,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWvB,CAAA;AAEF,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAC3C,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA"}
|
|
@@ -7,7 +7,14 @@ import { z } from 'zod';
|
|
|
7
7
|
* Can be used as a transform function for any Zod schema.
|
|
8
8
|
*/
|
|
9
9
|
const omitUndefinedValues = (data) => {
|
|
10
|
-
return Object.fromEntries(Object.entries(data)
|
|
10
|
+
return Object.fromEntries(Object.entries(data)
|
|
11
|
+
.filter(([_, value]) => value !== undefined)
|
|
12
|
+
.map(([key, value]) => {
|
|
13
|
+
if (typeof value === 'object' && value !== null) {
|
|
14
|
+
return [key, omitUndefinedValues(value)];
|
|
15
|
+
}
|
|
16
|
+
return [key, value];
|
|
17
|
+
}));
|
|
11
18
|
};
|
|
12
19
|
/**
|
|
13
20
|
* License Object
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-example-from-schema.d.ts","sourceRoot":"","sources":["../../src/spec-getters/get-example-from-schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-example-from-schema.d.ts","sourceRoot":"","sources":["../../src/spec-getters/get-example-from-schema.ts"],"names":[],"mappings":"AA2DA;;GAEG;AACH,eAAO,MAAM,oBAAoB,WACvB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YACjB;IACR;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC/B;;;OAGG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAA;CACzC,UACM,MAAM,iBACE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,SAC3B,MAAM,KACZ,GAgRF,CAAA"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** Hard limit for rendering circular references */
|
|
2
2
|
const MAX_LEVELS_DEEP = 5;
|
|
3
|
+
/** Sets the max number of properties after the third level to prevent exponential horizontal growth */
|
|
4
|
+
const MAX_PROPERTIES = 10;
|
|
3
5
|
const genericExampleValues = {
|
|
4
6
|
// 'date-time': '1970-01-01T00:00:00Z',
|
|
5
7
|
'date-time': new Date().toISOString(),
|
|
@@ -118,15 +120,22 @@ const getExampleFromSchema = (schema, options, level = 0, parentSchema, name) =>
|
|
|
118
120
|
// Object
|
|
119
121
|
if (schema.type === 'object' || schema.properties !== undefined) {
|
|
120
122
|
const response = {};
|
|
123
|
+
let propertyCount = 0;
|
|
121
124
|
// Regular properties
|
|
122
125
|
if (schema.properties !== undefined) {
|
|
123
126
|
for (const propertyName in schema.properties) {
|
|
124
127
|
if (Object.prototype.hasOwnProperty.call(schema.properties, propertyName)) {
|
|
128
|
+
// Only apply property limit for nested levels (level > 0)
|
|
129
|
+
if (level > 3 && propertyCount >= MAX_PROPERTIES) {
|
|
130
|
+
response['...'] = '[Additional Properties Truncated]';
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
125
133
|
const property = schema.properties[propertyName];
|
|
126
134
|
const propertyXmlTagName = options?.xml ? property.xml?.name : undefined;
|
|
127
|
-
|
|
128
|
-
if (typeof
|
|
129
|
-
|
|
135
|
+
const value = getExampleFromSchema(property, options, level + 1, schema, propertyName);
|
|
136
|
+
if (typeof value !== 'undefined') {
|
|
137
|
+
response[propertyXmlTagName ?? propertyName] = value;
|
|
138
|
+
propertyCount++;
|
|
130
139
|
}
|
|
131
140
|
}
|
|
132
141
|
}
|
|
@@ -5,9 +5,9 @@ import type { SelectedSecuritySchemeUids } from '../entities/shared/utility.ts';
|
|
|
5
5
|
import { type Collection, type CollectionPayload } from '../entities/spec/collection.ts';
|
|
6
6
|
import { type RequestExample } from '../entities/spec/request-examples.ts';
|
|
7
7
|
import { type Request } from '../entities/spec/requests.ts';
|
|
8
|
-
import { type SecurityScheme } from '../entities/spec/security.ts';
|
|
9
8
|
import { type Server } from '../entities/spec/server.ts';
|
|
10
9
|
import { type Tag } from '../entities/spec/spec-objects.ts';
|
|
10
|
+
import { type SecurityScheme } from '@scalar/types/entities';
|
|
11
11
|
/** Takes a string or object and parses it into an openapi spec compliant schema */
|
|
12
12
|
export declare const parseSchema: (spec: string | UnknownObject, { shouldLoad }?: {
|
|
13
13
|
shouldLoad?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-spec.d.ts","sourceRoot":"","sources":["../../src/transforms/import-spec.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGxD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA;AAC9E,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAoB,MAAM,+BAA+B,CAAA;AAEzG,OAAO,EAAE,KAAK,cAAc,EAA4B,MAAM,qCAAqC,CAAA;AACnG,OAAO,EAAE,KAAK,OAAO,EAAsC,MAAM,6BAA6B,CAAA;AAC9F,OAAO,
|
|
1
|
+
{"version":3,"file":"import-spec.d.ts","sourceRoot":"","sources":["../../src/transforms/import-spec.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGxD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA;AAC9E,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAoB,MAAM,+BAA+B,CAAA;AAEzG,OAAO,EAAE,KAAK,cAAc,EAA4B,MAAM,qCAAqC,CAAA;AACnG,OAAO,EAAE,KAAK,OAAO,EAAsC,MAAM,6BAA6B,CAAA;AAC9F,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,2BAA2B,CAAA;AACrE,OAAO,EAAE,KAAK,GAAG,EAAa,MAAM,iCAAiC,CAAA;AAKrE,OAAO,EAEL,KAAK,cAAc,EAGpB,MAAM,wBAAwB,CAAA;AAE/B,mFAAmF;AACnF,eAAO,MAAM,WAAW,SAAgB,MAAM,GAAG,aAAa;;;IAoC1D;;;OAGG;YAC8C,WAAW,CAAC,QAAQ;;EAGxE,CAAA;AAED,sDAAsD;AACtD,eAAO,MAAM,6BAA6B,yBAClB,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,0BACnB,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,iCAC1B,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,KACvD,0BAaF,CAAA;AAED,iCAAiC;AACjC,eAAO,MAAM,UAAU,SAAU,MAAM,KAA2B,UAAU,CAAC,KAAK,CAAC,CAAA;AAEnF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,WAAW,CAAC,GAC1F,IAAI,CAAC,yBAAyB,EAAE,gBAAgB,GAAG,eAAe,GAAG,SAAS,GAAG,MAAM,CAAC,GAAG;IACzF,mFAAmF;IACnF,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,yCAAyC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,MAAM,GAAG,aAAa,EAC5B,EACE,cAAc,EACd,aAAa,EACb,WAAW,EACX,OAAO,EAAE,iBAAiB,EAC1B,qBAA6B,EAC7B,IAAI,EACJ,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,CAAC;IAAC,UAAU,EAAE,SAAS,CAAA;CAAE,CACnE,CAyWA;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,WAAW,CAAC,YAAY,EAAE,GAAG,SAAS,EAC/C,EAAE,aAAa,EAAE,GAAE,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAM,GACvE,MAAM,EAAE,CA0CV"}
|
|
@@ -3,13 +3,13 @@ import { load, upgrade, dereference } from '@scalar/openapi-parser';
|
|
|
3
3
|
import { collectionSchema } from '../entities/spec/collection.js';
|
|
4
4
|
import { createExampleFromRequest } from '../entities/spec/request-examples.js';
|
|
5
5
|
import { requestSchema } from '../entities/spec/requests.js';
|
|
6
|
-
import { securitySchemeSchema } from '../entities/spec/security.js';
|
|
7
6
|
import { serverSchema } from '../entities/spec/server.js';
|
|
8
7
|
import { tagSchema } from '../entities/spec/spec-objects.js';
|
|
9
8
|
import { isHttpMethod } from '../helpers/http-methods.js';
|
|
10
9
|
import { isDefined } from '../helpers/is-defined.js';
|
|
11
10
|
import { combineUrlAndPath } from '../helpers/merge-urls.js';
|
|
12
11
|
import { schemaModel } from '../helpers/schema-model.js';
|
|
12
|
+
import { securitySchemeSchema } from '@scalar/types/entities';
|
|
13
13
|
|
|
14
14
|
/** Takes a string or object and parses it into an openapi spec compliant schema */
|
|
15
15
|
const parseSchema = async (spec, { shouldLoad = true } = {}) => {
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"specification",
|
|
17
17
|
"yaml"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.2.
|
|
19
|
+
"version": "0.2.125",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=18"
|
|
22
22
|
},
|
|
@@ -88,9 +88,9 @@
|
|
|
88
88
|
"yaml": "^2.4.5",
|
|
89
89
|
"zod": "^3.23.8",
|
|
90
90
|
"@scalar/object-utils": "1.1.13",
|
|
91
|
-
"@scalar/openapi-types": "0.
|
|
92
|
-
"@scalar/themes": "0.9.
|
|
93
|
-
"@scalar/types": "0.1.
|
|
91
|
+
"@scalar/openapi-types": "0.2.0",
|
|
92
|
+
"@scalar/themes": "0.9.83",
|
|
93
|
+
"@scalar/types": "0.1.5"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@types/node": "^20.17.10",
|
|
@@ -99,8 +99,8 @@
|
|
|
99
99
|
"vitest": "^1.6.0",
|
|
100
100
|
"zod-to-ts": "github:amritk/zod-to-ts#build",
|
|
101
101
|
"@scalar/build-tooling": "0.1.17",
|
|
102
|
-
"@scalar/openapi-
|
|
103
|
-
"@scalar/openapi-
|
|
102
|
+
"@scalar/openapi-types": "0.2.0",
|
|
103
|
+
"@scalar/openapi-parser": "0.10.13"
|
|
104
104
|
},
|
|
105
105
|
"scripts": {
|
|
106
106
|
"build": "scalar-build-rollup",
|