@scalar/oas-utils 0.2.39 → 0.2.41
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 +16 -0
- package/dist/entities/workspace/spec/components.d.ts +1 -1
- package/dist/entities/workspace/spec/components.d.ts.map +1 -1
- package/dist/entities/workspace/spec/request-examples.d.ts +87 -87
- package/dist/entities/workspace/spec/requests.d.ts +8 -3
- package/dist/entities/workspace/spec/requests.d.ts.map +1 -1
- package/dist/entities/workspace/workspace.d.ts +5 -0
- package/dist/entities/workspace/workspace.d.ts.map +1 -1
- package/dist/entities/workspace/workspace.js +2 -0
- package/dist/helpers/replaceVariables.js +1 -1
- package/dist/spec-getters/getExampleFromSchema.d.ts.map +1 -1
- package/dist/spec-getters/getExampleFromSchema.js +2 -2
- package/dist/spec-getters/getRequestBodyFromOperation.d.ts +4 -1
- package/dist/spec-getters/getRequestBodyFromOperation.d.ts.map +1 -1
- package/dist/spec-getters/getRequestBodyFromOperation.js +23 -26
- package/package.json +5 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @scalar/oas-utils
|
|
2
2
|
|
|
3
|
+
## 0.2.41
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f931ac7: fix: displays variable in curly braces when empty
|
|
8
|
+
|
|
9
|
+
## 0.2.40
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 0afb293: feat: request bodies for multipart form data and url encoded form data
|
|
14
|
+
- e67f5a8: chore(api-client): removed axios dependency
|
|
15
|
+
- b63be39: fix: incorrect example for schemas with anyOf
|
|
16
|
+
- 152c016: feat: add environment selector to addressbar
|
|
17
|
+
- @scalar/types@0.0.6
|
|
18
|
+
|
|
3
19
|
## 0.2.39
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/spec/components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/spec/components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,YAAY,CAAA"}
|
|
@@ -26,10 +26,10 @@ declare const requestExampleParametersSchema: z.ZodObject<{
|
|
|
26
26
|
required?: boolean | undefined;
|
|
27
27
|
description?: string | undefined;
|
|
28
28
|
enum?: string[] | undefined;
|
|
29
|
+
nullable?: boolean | undefined;
|
|
30
|
+
format?: string | undefined;
|
|
29
31
|
file?: any;
|
|
30
32
|
refUid?: string | undefined;
|
|
31
|
-
format?: string | undefined;
|
|
32
|
-
nullable?: boolean | undefined;
|
|
33
33
|
}, {
|
|
34
34
|
minimum?: number | undefined;
|
|
35
35
|
type?: string | undefined;
|
|
@@ -40,11 +40,11 @@ declare const requestExampleParametersSchema: z.ZodObject<{
|
|
|
40
40
|
description?: string | undefined;
|
|
41
41
|
key?: string | undefined;
|
|
42
42
|
enum?: string[] | undefined;
|
|
43
|
+
nullable?: boolean | undefined;
|
|
44
|
+
format?: string | undefined;
|
|
43
45
|
enabled?: boolean | undefined;
|
|
44
46
|
file?: any;
|
|
45
47
|
refUid?: string | undefined;
|
|
46
|
-
format?: string | undefined;
|
|
47
|
-
nullable?: boolean | undefined;
|
|
48
48
|
}>;
|
|
49
49
|
/** Request examples - formerly known as instances - are "children" of requests */
|
|
50
50
|
export type RequestExampleParameter = z.infer<typeof requestExampleParametersSchema>;
|
|
@@ -61,10 +61,10 @@ export declare const createRequestExampleParameter: (payload: RequestExamplePara
|
|
|
61
61
|
required?: boolean | undefined;
|
|
62
62
|
description?: string | undefined;
|
|
63
63
|
enum?: string[] | undefined;
|
|
64
|
+
nullable?: boolean | undefined;
|
|
65
|
+
format?: string | undefined;
|
|
64
66
|
file?: any;
|
|
65
67
|
refUid?: string | undefined;
|
|
66
|
-
format?: string | undefined;
|
|
67
|
-
nullable?: boolean | undefined;
|
|
68
68
|
};
|
|
69
69
|
declare const requestExampleSchema: z.ZodObject<{
|
|
70
70
|
uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -77,10 +77,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
77
77
|
value: z.ZodDefault<z.ZodString>;
|
|
78
78
|
}, "strip", z.ZodTypeAny, {
|
|
79
79
|
value: string;
|
|
80
|
-
encoding: "
|
|
80
|
+
encoding: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn";
|
|
81
81
|
}, {
|
|
82
82
|
value?: string | undefined;
|
|
83
|
-
encoding?: "
|
|
83
|
+
encoding?: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn" | undefined;
|
|
84
84
|
}>>;
|
|
85
85
|
formData: z.ZodDefault<z.ZodObject<{
|
|
86
86
|
encoding: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"form-data">, z.ZodLiteral<"urlencoded">]>>;
|
|
@@ -111,10 +111,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
111
111
|
required?: boolean | undefined;
|
|
112
112
|
description?: string | undefined;
|
|
113
113
|
enum?: string[] | undefined;
|
|
114
|
+
nullable?: boolean | undefined;
|
|
115
|
+
format?: string | undefined;
|
|
114
116
|
file?: any;
|
|
115
117
|
refUid?: string | undefined;
|
|
116
|
-
format?: string | undefined;
|
|
117
|
-
nullable?: boolean | undefined;
|
|
118
118
|
}, {
|
|
119
119
|
minimum?: number | undefined;
|
|
120
120
|
type?: string | undefined;
|
|
@@ -125,11 +125,11 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
125
125
|
description?: string | undefined;
|
|
126
126
|
key?: string | undefined;
|
|
127
127
|
enum?: string[] | undefined;
|
|
128
|
+
nullable?: boolean | undefined;
|
|
129
|
+
format?: string | undefined;
|
|
128
130
|
enabled?: boolean | undefined;
|
|
129
131
|
file?: any;
|
|
130
132
|
refUid?: string | undefined;
|
|
131
|
-
format?: string | undefined;
|
|
132
|
-
nullable?: boolean | undefined;
|
|
133
133
|
}>, "many">>;
|
|
134
134
|
}, "strip", z.ZodTypeAny, {
|
|
135
135
|
value: {
|
|
@@ -143,10 +143,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
143
143
|
required?: boolean | undefined;
|
|
144
144
|
description?: string | undefined;
|
|
145
145
|
enum?: string[] | undefined;
|
|
146
|
+
nullable?: boolean | undefined;
|
|
147
|
+
format?: string | undefined;
|
|
146
148
|
file?: any;
|
|
147
149
|
refUid?: string | undefined;
|
|
148
|
-
format?: string | undefined;
|
|
149
|
-
nullable?: boolean | undefined;
|
|
150
150
|
}[];
|
|
151
151
|
encoding: "form-data" | "urlencoded";
|
|
152
152
|
}, {
|
|
@@ -160,11 +160,11 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
160
160
|
description?: string | undefined;
|
|
161
161
|
key?: string | undefined;
|
|
162
162
|
enum?: string[] | undefined;
|
|
163
|
+
nullable?: boolean | undefined;
|
|
164
|
+
format?: string | undefined;
|
|
163
165
|
enabled?: boolean | undefined;
|
|
164
166
|
file?: any;
|
|
165
167
|
refUid?: string | undefined;
|
|
166
|
-
format?: string | undefined;
|
|
167
|
-
nullable?: boolean | undefined;
|
|
168
168
|
}[] | undefined;
|
|
169
169
|
encoding?: "form-data" | "urlencoded" | undefined;
|
|
170
170
|
}>>;
|
|
@@ -173,7 +173,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
173
173
|
}, "strip", z.ZodTypeAny, {
|
|
174
174
|
raw: {
|
|
175
175
|
value: string;
|
|
176
|
-
encoding: "
|
|
176
|
+
encoding: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn";
|
|
177
177
|
};
|
|
178
178
|
formData: {
|
|
179
179
|
value: {
|
|
@@ -187,10 +187,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
187
187
|
required?: boolean | undefined;
|
|
188
188
|
description?: string | undefined;
|
|
189
189
|
enum?: string[] | undefined;
|
|
190
|
+
nullable?: boolean | undefined;
|
|
191
|
+
format?: string | undefined;
|
|
190
192
|
file?: any;
|
|
191
193
|
refUid?: string | undefined;
|
|
192
|
-
format?: string | undefined;
|
|
193
|
-
nullable?: boolean | undefined;
|
|
194
194
|
}[];
|
|
195
195
|
encoding: "form-data" | "urlencoded";
|
|
196
196
|
};
|
|
@@ -199,7 +199,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
199
199
|
}, {
|
|
200
200
|
raw?: {
|
|
201
201
|
value?: string | undefined;
|
|
202
|
-
encoding?: "
|
|
202
|
+
encoding?: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn" | undefined;
|
|
203
203
|
} | undefined;
|
|
204
204
|
formData?: {
|
|
205
205
|
value?: {
|
|
@@ -212,11 +212,11 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
212
212
|
description?: string | undefined;
|
|
213
213
|
key?: string | undefined;
|
|
214
214
|
enum?: string[] | undefined;
|
|
215
|
+
nullable?: boolean | undefined;
|
|
216
|
+
format?: string | undefined;
|
|
215
217
|
enabled?: boolean | undefined;
|
|
216
218
|
file?: any;
|
|
217
219
|
refUid?: string | undefined;
|
|
218
|
-
format?: string | undefined;
|
|
219
|
-
nullable?: boolean | undefined;
|
|
220
220
|
}[] | undefined;
|
|
221
221
|
encoding?: "form-data" | "urlencoded" | undefined;
|
|
222
222
|
} | undefined;
|
|
@@ -251,10 +251,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
251
251
|
required?: boolean | undefined;
|
|
252
252
|
description?: string | undefined;
|
|
253
253
|
enum?: string[] | undefined;
|
|
254
|
+
nullable?: boolean | undefined;
|
|
255
|
+
format?: string | undefined;
|
|
254
256
|
file?: any;
|
|
255
257
|
refUid?: string | undefined;
|
|
256
|
-
format?: string | undefined;
|
|
257
|
-
nullable?: boolean | undefined;
|
|
258
258
|
}, {
|
|
259
259
|
minimum?: number | undefined;
|
|
260
260
|
type?: string | undefined;
|
|
@@ -265,11 +265,11 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
265
265
|
description?: string | undefined;
|
|
266
266
|
key?: string | undefined;
|
|
267
267
|
enum?: string[] | undefined;
|
|
268
|
+
nullable?: boolean | undefined;
|
|
269
|
+
format?: string | undefined;
|
|
268
270
|
enabled?: boolean | undefined;
|
|
269
271
|
file?: any;
|
|
270
272
|
refUid?: string | undefined;
|
|
271
|
-
format?: string | undefined;
|
|
272
|
-
nullable?: boolean | undefined;
|
|
273
273
|
}>, "many">>;
|
|
274
274
|
query: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
275
275
|
key: z.ZodDefault<z.ZodString>;
|
|
@@ -298,10 +298,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
298
298
|
required?: boolean | undefined;
|
|
299
299
|
description?: string | undefined;
|
|
300
300
|
enum?: string[] | undefined;
|
|
301
|
+
nullable?: boolean | undefined;
|
|
302
|
+
format?: string | undefined;
|
|
301
303
|
file?: any;
|
|
302
304
|
refUid?: string | undefined;
|
|
303
|
-
format?: string | undefined;
|
|
304
|
-
nullable?: boolean | undefined;
|
|
305
305
|
}, {
|
|
306
306
|
minimum?: number | undefined;
|
|
307
307
|
type?: string | undefined;
|
|
@@ -312,11 +312,11 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
312
312
|
description?: string | undefined;
|
|
313
313
|
key?: string | undefined;
|
|
314
314
|
enum?: string[] | undefined;
|
|
315
|
+
nullable?: boolean | undefined;
|
|
316
|
+
format?: string | undefined;
|
|
315
317
|
enabled?: boolean | undefined;
|
|
316
318
|
file?: any;
|
|
317
319
|
refUid?: string | undefined;
|
|
318
|
-
format?: string | undefined;
|
|
319
|
-
nullable?: boolean | undefined;
|
|
320
320
|
}>, "many">>;
|
|
321
321
|
headers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
322
322
|
key: z.ZodDefault<z.ZodString>;
|
|
@@ -345,10 +345,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
345
345
|
required?: boolean | undefined;
|
|
346
346
|
description?: string | undefined;
|
|
347
347
|
enum?: string[] | undefined;
|
|
348
|
+
nullable?: boolean | undefined;
|
|
349
|
+
format?: string | undefined;
|
|
348
350
|
file?: any;
|
|
349
351
|
refUid?: string | undefined;
|
|
350
|
-
format?: string | undefined;
|
|
351
|
-
nullable?: boolean | undefined;
|
|
352
352
|
}, {
|
|
353
353
|
minimum?: number | undefined;
|
|
354
354
|
type?: string | undefined;
|
|
@@ -359,11 +359,11 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
359
359
|
description?: string | undefined;
|
|
360
360
|
key?: string | undefined;
|
|
361
361
|
enum?: string[] | undefined;
|
|
362
|
+
nullable?: boolean | undefined;
|
|
363
|
+
format?: string | undefined;
|
|
362
364
|
enabled?: boolean | undefined;
|
|
363
365
|
file?: any;
|
|
364
366
|
refUid?: string | undefined;
|
|
365
|
-
format?: string | undefined;
|
|
366
|
-
nullable?: boolean | undefined;
|
|
367
367
|
}>, "many">>;
|
|
368
368
|
cookies: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
369
369
|
key: z.ZodDefault<z.ZodString>;
|
|
@@ -392,10 +392,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
392
392
|
required?: boolean | undefined;
|
|
393
393
|
description?: string | undefined;
|
|
394
394
|
enum?: string[] | undefined;
|
|
395
|
+
nullable?: boolean | undefined;
|
|
396
|
+
format?: string | undefined;
|
|
395
397
|
file?: any;
|
|
396
398
|
refUid?: string | undefined;
|
|
397
|
-
format?: string | undefined;
|
|
398
|
-
nullable?: boolean | undefined;
|
|
399
399
|
}, {
|
|
400
400
|
minimum?: number | undefined;
|
|
401
401
|
type?: string | undefined;
|
|
@@ -406,11 +406,11 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
406
406
|
description?: string | undefined;
|
|
407
407
|
key?: string | undefined;
|
|
408
408
|
enum?: string[] | undefined;
|
|
409
|
+
nullable?: boolean | undefined;
|
|
410
|
+
format?: string | undefined;
|
|
409
411
|
enabled?: boolean | undefined;
|
|
410
412
|
file?: any;
|
|
411
413
|
refUid?: string | undefined;
|
|
412
|
-
format?: string | undefined;
|
|
413
|
-
nullable?: boolean | undefined;
|
|
414
414
|
}>, "many">>;
|
|
415
415
|
}, "strip", z.ZodTypeAny, {
|
|
416
416
|
path: {
|
|
@@ -424,10 +424,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
424
424
|
required?: boolean | undefined;
|
|
425
425
|
description?: string | undefined;
|
|
426
426
|
enum?: string[] | undefined;
|
|
427
|
+
nullable?: boolean | undefined;
|
|
428
|
+
format?: string | undefined;
|
|
427
429
|
file?: any;
|
|
428
430
|
refUid?: string | undefined;
|
|
429
|
-
format?: string | undefined;
|
|
430
|
-
nullable?: boolean | undefined;
|
|
431
431
|
}[];
|
|
432
432
|
query: {
|
|
433
433
|
value: string;
|
|
@@ -440,10 +440,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
440
440
|
required?: boolean | undefined;
|
|
441
441
|
description?: string | undefined;
|
|
442
442
|
enum?: string[] | undefined;
|
|
443
|
+
nullable?: boolean | undefined;
|
|
444
|
+
format?: string | undefined;
|
|
443
445
|
file?: any;
|
|
444
446
|
refUid?: string | undefined;
|
|
445
|
-
format?: string | undefined;
|
|
446
|
-
nullable?: boolean | undefined;
|
|
447
447
|
}[];
|
|
448
448
|
headers: {
|
|
449
449
|
value: string;
|
|
@@ -456,10 +456,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
456
456
|
required?: boolean | undefined;
|
|
457
457
|
description?: string | undefined;
|
|
458
458
|
enum?: string[] | undefined;
|
|
459
|
+
nullable?: boolean | undefined;
|
|
460
|
+
format?: string | undefined;
|
|
459
461
|
file?: any;
|
|
460
462
|
refUid?: string | undefined;
|
|
461
|
-
format?: string | undefined;
|
|
462
|
-
nullable?: boolean | undefined;
|
|
463
463
|
}[];
|
|
464
464
|
cookies: {
|
|
465
465
|
value: string;
|
|
@@ -472,10 +472,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
472
472
|
required?: boolean | undefined;
|
|
473
473
|
description?: string | undefined;
|
|
474
474
|
enum?: string[] | undefined;
|
|
475
|
+
nullable?: boolean | undefined;
|
|
476
|
+
format?: string | undefined;
|
|
475
477
|
file?: any;
|
|
476
478
|
refUid?: string | undefined;
|
|
477
|
-
format?: string | undefined;
|
|
478
|
-
nullable?: boolean | undefined;
|
|
479
479
|
}[];
|
|
480
480
|
}, {
|
|
481
481
|
path?: {
|
|
@@ -488,11 +488,11 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
488
488
|
description?: string | undefined;
|
|
489
489
|
key?: string | undefined;
|
|
490
490
|
enum?: string[] | undefined;
|
|
491
|
+
nullable?: boolean | undefined;
|
|
492
|
+
format?: string | undefined;
|
|
491
493
|
enabled?: boolean | undefined;
|
|
492
494
|
file?: any;
|
|
493
495
|
refUid?: string | undefined;
|
|
494
|
-
format?: string | undefined;
|
|
495
|
-
nullable?: boolean | undefined;
|
|
496
496
|
}[] | undefined;
|
|
497
497
|
query?: {
|
|
498
498
|
minimum?: number | undefined;
|
|
@@ -504,11 +504,11 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
504
504
|
description?: string | undefined;
|
|
505
505
|
key?: string | undefined;
|
|
506
506
|
enum?: string[] | undefined;
|
|
507
|
+
nullable?: boolean | undefined;
|
|
508
|
+
format?: string | undefined;
|
|
507
509
|
enabled?: boolean | undefined;
|
|
508
510
|
file?: any;
|
|
509
511
|
refUid?: string | undefined;
|
|
510
|
-
format?: string | undefined;
|
|
511
|
-
nullable?: boolean | undefined;
|
|
512
512
|
}[] | undefined;
|
|
513
513
|
headers?: {
|
|
514
514
|
minimum?: number | undefined;
|
|
@@ -520,11 +520,11 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
520
520
|
description?: string | undefined;
|
|
521
521
|
key?: string | undefined;
|
|
522
522
|
enum?: string[] | undefined;
|
|
523
|
+
nullable?: boolean | undefined;
|
|
524
|
+
format?: string | undefined;
|
|
523
525
|
enabled?: boolean | undefined;
|
|
524
526
|
file?: any;
|
|
525
527
|
refUid?: string | undefined;
|
|
526
|
-
format?: string | undefined;
|
|
527
|
-
nullable?: boolean | undefined;
|
|
528
528
|
}[] | undefined;
|
|
529
529
|
cookies?: {
|
|
530
530
|
minimum?: number | undefined;
|
|
@@ -536,11 +536,11 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
536
536
|
description?: string | undefined;
|
|
537
537
|
key?: string | undefined;
|
|
538
538
|
enum?: string[] | undefined;
|
|
539
|
+
nullable?: boolean | undefined;
|
|
540
|
+
format?: string | undefined;
|
|
539
541
|
enabled?: boolean | undefined;
|
|
540
542
|
file?: any;
|
|
541
543
|
refUid?: string | undefined;
|
|
542
|
-
format?: string | undefined;
|
|
543
|
-
nullable?: boolean | undefined;
|
|
544
544
|
}[] | undefined;
|
|
545
545
|
}>>>;
|
|
546
546
|
auth: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -552,7 +552,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
552
552
|
body: {
|
|
553
553
|
raw: {
|
|
554
554
|
value: string;
|
|
555
|
-
encoding: "
|
|
555
|
+
encoding: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn";
|
|
556
556
|
};
|
|
557
557
|
formData: {
|
|
558
558
|
value: {
|
|
@@ -566,10 +566,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
566
566
|
required?: boolean | undefined;
|
|
567
567
|
description?: string | undefined;
|
|
568
568
|
enum?: string[] | undefined;
|
|
569
|
+
nullable?: boolean | undefined;
|
|
570
|
+
format?: string | undefined;
|
|
569
571
|
file?: any;
|
|
570
572
|
refUid?: string | undefined;
|
|
571
|
-
format?: string | undefined;
|
|
572
|
-
nullable?: boolean | undefined;
|
|
573
573
|
}[];
|
|
574
574
|
encoding: "form-data" | "urlencoded";
|
|
575
575
|
};
|
|
@@ -588,10 +588,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
588
588
|
required?: boolean | undefined;
|
|
589
589
|
description?: string | undefined;
|
|
590
590
|
enum?: string[] | undefined;
|
|
591
|
+
nullable?: boolean | undefined;
|
|
592
|
+
format?: string | undefined;
|
|
591
593
|
file?: any;
|
|
592
594
|
refUid?: string | undefined;
|
|
593
|
-
format?: string | undefined;
|
|
594
|
-
nullable?: boolean | undefined;
|
|
595
595
|
}[];
|
|
596
596
|
query: {
|
|
597
597
|
value: string;
|
|
@@ -604,10 +604,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
604
604
|
required?: boolean | undefined;
|
|
605
605
|
description?: string | undefined;
|
|
606
606
|
enum?: string[] | undefined;
|
|
607
|
+
nullable?: boolean | undefined;
|
|
608
|
+
format?: string | undefined;
|
|
607
609
|
file?: any;
|
|
608
610
|
refUid?: string | undefined;
|
|
609
|
-
format?: string | undefined;
|
|
610
|
-
nullable?: boolean | undefined;
|
|
611
611
|
}[];
|
|
612
612
|
headers: {
|
|
613
613
|
value: string;
|
|
@@ -620,10 +620,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
620
620
|
required?: boolean | undefined;
|
|
621
621
|
description?: string | undefined;
|
|
622
622
|
enum?: string[] | undefined;
|
|
623
|
+
nullable?: boolean | undefined;
|
|
624
|
+
format?: string | undefined;
|
|
623
625
|
file?: any;
|
|
624
626
|
refUid?: string | undefined;
|
|
625
|
-
format?: string | undefined;
|
|
626
|
-
nullable?: boolean | undefined;
|
|
627
627
|
}[];
|
|
628
628
|
cookies: {
|
|
629
629
|
value: string;
|
|
@@ -636,10 +636,10 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
636
636
|
required?: boolean | undefined;
|
|
637
637
|
description?: string | undefined;
|
|
638
638
|
enum?: string[] | undefined;
|
|
639
|
+
nullable?: boolean | undefined;
|
|
640
|
+
format?: string | undefined;
|
|
639
641
|
file?: any;
|
|
640
642
|
refUid?: string | undefined;
|
|
641
|
-
format?: string | undefined;
|
|
642
|
-
nullable?: boolean | undefined;
|
|
643
643
|
}[];
|
|
644
644
|
};
|
|
645
645
|
auth: Record<string, any>;
|
|
@@ -651,7 +651,7 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
651
651
|
body?: {
|
|
652
652
|
raw?: {
|
|
653
653
|
value?: string | undefined;
|
|
654
|
-
encoding?: "
|
|
654
|
+
encoding?: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn" | undefined;
|
|
655
655
|
} | undefined;
|
|
656
656
|
formData?: {
|
|
657
657
|
value?: {
|
|
@@ -664,11 +664,11 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
664
664
|
description?: string | undefined;
|
|
665
665
|
key?: string | undefined;
|
|
666
666
|
enum?: string[] | undefined;
|
|
667
|
+
nullable?: boolean | undefined;
|
|
668
|
+
format?: string | undefined;
|
|
667
669
|
enabled?: boolean | undefined;
|
|
668
670
|
file?: any;
|
|
669
671
|
refUid?: string | undefined;
|
|
670
|
-
format?: string | undefined;
|
|
671
|
-
nullable?: boolean | undefined;
|
|
672
672
|
}[] | undefined;
|
|
673
673
|
encoding?: "form-data" | "urlencoded" | undefined;
|
|
674
674
|
} | undefined;
|
|
@@ -686,11 +686,11 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
686
686
|
description?: string | undefined;
|
|
687
687
|
key?: string | undefined;
|
|
688
688
|
enum?: string[] | undefined;
|
|
689
|
+
nullable?: boolean | undefined;
|
|
690
|
+
format?: string | undefined;
|
|
689
691
|
enabled?: boolean | undefined;
|
|
690
692
|
file?: any;
|
|
691
693
|
refUid?: string | undefined;
|
|
692
|
-
format?: string | undefined;
|
|
693
|
-
nullable?: boolean | undefined;
|
|
694
694
|
}[] | undefined;
|
|
695
695
|
query?: {
|
|
696
696
|
minimum?: number | undefined;
|
|
@@ -702,11 +702,11 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
702
702
|
description?: string | undefined;
|
|
703
703
|
key?: string | undefined;
|
|
704
704
|
enum?: string[] | undefined;
|
|
705
|
+
nullable?: boolean | undefined;
|
|
706
|
+
format?: string | undefined;
|
|
705
707
|
enabled?: boolean | undefined;
|
|
706
708
|
file?: any;
|
|
707
709
|
refUid?: string | undefined;
|
|
708
|
-
format?: string | undefined;
|
|
709
|
-
nullable?: boolean | undefined;
|
|
710
710
|
}[] | undefined;
|
|
711
711
|
headers?: {
|
|
712
712
|
minimum?: number | undefined;
|
|
@@ -718,11 +718,11 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
718
718
|
description?: string | undefined;
|
|
719
719
|
key?: string | undefined;
|
|
720
720
|
enum?: string[] | undefined;
|
|
721
|
+
nullable?: boolean | undefined;
|
|
722
|
+
format?: string | undefined;
|
|
721
723
|
enabled?: boolean | undefined;
|
|
722
724
|
file?: any;
|
|
723
725
|
refUid?: string | undefined;
|
|
724
|
-
format?: string | undefined;
|
|
725
|
-
nullable?: boolean | undefined;
|
|
726
726
|
}[] | undefined;
|
|
727
727
|
cookies?: {
|
|
728
728
|
minimum?: number | undefined;
|
|
@@ -734,11 +734,11 @@ declare const requestExampleSchema: z.ZodObject<{
|
|
|
734
734
|
description?: string | undefined;
|
|
735
735
|
key?: string | undefined;
|
|
736
736
|
enum?: string[] | undefined;
|
|
737
|
+
nullable?: boolean | undefined;
|
|
738
|
+
format?: string | undefined;
|
|
737
739
|
enabled?: boolean | undefined;
|
|
738
740
|
file?: any;
|
|
739
741
|
refUid?: string | undefined;
|
|
740
|
-
format?: string | undefined;
|
|
741
|
-
nullable?: boolean | undefined;
|
|
742
742
|
}[] | undefined;
|
|
743
743
|
} | undefined;
|
|
744
744
|
auth?: Record<string, any> | undefined;
|
|
@@ -755,7 +755,7 @@ export declare const createRequestExample: (payload: RequestExamplePayload) => {
|
|
|
755
755
|
body: {
|
|
756
756
|
raw: {
|
|
757
757
|
value: string;
|
|
758
|
-
encoding: "
|
|
758
|
+
encoding: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn";
|
|
759
759
|
};
|
|
760
760
|
formData: {
|
|
761
761
|
value: {
|
|
@@ -769,10 +769,10 @@ export declare const createRequestExample: (payload: RequestExamplePayload) => {
|
|
|
769
769
|
required?: boolean | undefined;
|
|
770
770
|
description?: string | undefined;
|
|
771
771
|
enum?: string[] | undefined;
|
|
772
|
+
nullable?: boolean | undefined;
|
|
773
|
+
format?: string | undefined;
|
|
772
774
|
file?: any;
|
|
773
775
|
refUid?: string | undefined;
|
|
774
|
-
format?: string | undefined;
|
|
775
|
-
nullable?: boolean | undefined;
|
|
776
776
|
}[];
|
|
777
777
|
encoding: "form-data" | "urlencoded";
|
|
778
778
|
};
|
|
@@ -791,10 +791,10 @@ export declare const createRequestExample: (payload: RequestExamplePayload) => {
|
|
|
791
791
|
required?: boolean | undefined;
|
|
792
792
|
description?: string | undefined;
|
|
793
793
|
enum?: string[] | undefined;
|
|
794
|
+
nullable?: boolean | undefined;
|
|
795
|
+
format?: string | undefined;
|
|
794
796
|
file?: any;
|
|
795
797
|
refUid?: string | undefined;
|
|
796
|
-
format?: string | undefined;
|
|
797
|
-
nullable?: boolean | undefined;
|
|
798
798
|
}[];
|
|
799
799
|
query: {
|
|
800
800
|
value: string;
|
|
@@ -807,10 +807,10 @@ export declare const createRequestExample: (payload: RequestExamplePayload) => {
|
|
|
807
807
|
required?: boolean | undefined;
|
|
808
808
|
description?: string | undefined;
|
|
809
809
|
enum?: string[] | undefined;
|
|
810
|
+
nullable?: boolean | undefined;
|
|
811
|
+
format?: string | undefined;
|
|
810
812
|
file?: any;
|
|
811
813
|
refUid?: string | undefined;
|
|
812
|
-
format?: string | undefined;
|
|
813
|
-
nullable?: boolean | undefined;
|
|
814
814
|
}[];
|
|
815
815
|
headers: {
|
|
816
816
|
value: string;
|
|
@@ -823,10 +823,10 @@ export declare const createRequestExample: (payload: RequestExamplePayload) => {
|
|
|
823
823
|
required?: boolean | undefined;
|
|
824
824
|
description?: string | undefined;
|
|
825
825
|
enum?: string[] | undefined;
|
|
826
|
+
nullable?: boolean | undefined;
|
|
827
|
+
format?: string | undefined;
|
|
826
828
|
file?: any;
|
|
827
829
|
refUid?: string | undefined;
|
|
828
|
-
format?: string | undefined;
|
|
829
|
-
nullable?: boolean | undefined;
|
|
830
830
|
}[];
|
|
831
831
|
cookies: {
|
|
832
832
|
value: string;
|
|
@@ -839,10 +839,10 @@ export declare const createRequestExample: (payload: RequestExamplePayload) => {
|
|
|
839
839
|
required?: boolean | undefined;
|
|
840
840
|
description?: string | undefined;
|
|
841
841
|
enum?: string[] | undefined;
|
|
842
|
+
nullable?: boolean | undefined;
|
|
843
|
+
format?: string | undefined;
|
|
842
844
|
file?: any;
|
|
843
845
|
refUid?: string | undefined;
|
|
844
|
-
format?: string | undefined;
|
|
845
|
-
nullable?: boolean | undefined;
|
|
846
846
|
}[];
|
|
847
847
|
};
|
|
848
848
|
auth: Record<string, any>;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import type { OpenAPIV3_1 } from '@scalar/openapi-
|
|
2
|
-
import type { AxiosResponse } from 'axios';
|
|
1
|
+
import type { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
3
2
|
import { z } from 'zod';
|
|
4
3
|
import type { RequestExample } from './request-examples.js';
|
|
5
4
|
/** A single set of populated values for a sent request */
|
|
6
|
-
export type ResponseInstance =
|
|
5
|
+
export type ResponseInstance = Omit<Response, 'headers'> & {
|
|
6
|
+
/** Store headers as an object to match what we had with axios */
|
|
7
|
+
headers: Record<string, string>;
|
|
8
|
+
/** Keys of headers which set cookies */
|
|
9
|
+
cookieHeaderKeys: string[];
|
|
7
10
|
/** Time in ms the request took */
|
|
8
11
|
duration: number;
|
|
12
|
+
/** The response data */
|
|
13
|
+
data: unknown;
|
|
9
14
|
};
|
|
10
15
|
/** A single request/response set to save to the history stack */
|
|
11
16
|
export type RequestEvent = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/spec/requests.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/spec/requests.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAkB,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,0DAA0D;AAC1D,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG;IACzD,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,wCAAwC;IACxC,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,wBAAwB;IACxB,IAAI,EAAE,OAAO,CAAA;CACd,CAAA;AAED,iEAAiE;AACjE,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,cAAc,CAAA;IACvB,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAQD,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;IAQjB;;;OAGG;;IAEH,kDAAkD;;IAElD,mHAAmH;;IAEnH;;;;OAIG;;;;;;;;;;;;;;;;;;IAUH;;;;;;OAMG;;IAEH,6EAA6E;;IAE7E,mEAAmE;;IAEnE;;;;;OAKG;;IAEH,0CAA0C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG1C,CAAA;AAEF;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,GAAG;IACpD,YAAY,CAAC,EAAE,WAAW,CAAC,2BAA2B,CAAA;CACvD,CAAA;AACD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,GAAG;IAC3D,YAAY,CAAC,EAAE,WAAW,CAAC,2BAA2B,CAAA;CACvD,CAAA;AAED,4BAA4B;AAC5B,eAAO,MAAM,aAAa,YAAa,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;CACY,CAAA"}
|
|
@@ -49,6 +49,8 @@ declare const workspaceSchema: z.ZodObject<{
|
|
|
49
49
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default" | undefined)[] | undefined;
|
|
50
50
|
}>> | undefined;
|
|
51
51
|
}>>;
|
|
52
|
+
/** Active Environment ID to use for requests */
|
|
53
|
+
activeEnvironmentId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
52
54
|
/** List of all cookie uids in a given workspace */
|
|
53
55
|
cookieUids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
54
56
|
/** Workspace level proxy for all requests to be sent through */
|
|
@@ -62,6 +64,7 @@ declare const workspaceSchema: z.ZodObject<{
|
|
|
62
64
|
isReadOnly: boolean;
|
|
63
65
|
collectionUids: string[];
|
|
64
66
|
environmentUids: string[];
|
|
67
|
+
activeEnvironmentId: string;
|
|
65
68
|
cookieUids: string[];
|
|
66
69
|
themeId: "default" | "alternate" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "mars" | "none";
|
|
67
70
|
hotKeyConfig?: {
|
|
@@ -86,6 +89,7 @@ declare const workspaceSchema: z.ZodObject<{
|
|
|
86
89
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default" | undefined)[] | undefined;
|
|
87
90
|
}>> | undefined;
|
|
88
91
|
} | undefined;
|
|
92
|
+
activeEnvironmentId?: string | undefined;
|
|
89
93
|
cookieUids?: string[] | undefined;
|
|
90
94
|
proxyUrl?: string | undefined;
|
|
91
95
|
themeId?: "default" | "alternate" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "mars" | "none" | undefined;
|
|
@@ -100,6 +104,7 @@ export declare const createWorkspace: (payload: WorkspacePayload) => {
|
|
|
100
104
|
isReadOnly: boolean;
|
|
101
105
|
collectionUids: string[];
|
|
102
106
|
environmentUids: string[];
|
|
107
|
+
activeEnvironmentId: string;
|
|
103
108
|
cookieUids: string[];
|
|
104
109
|
themeId: "default" | "alternate" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "mars" | "none";
|
|
105
110
|
hotKeyConfig?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/entities/workspace/workspace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAQvB,QAAA,MAAM,SAAS,yIAAoD,CAAA;AAEnE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAEvD,QAAA,MAAM,OAAO;;;;;;;;;GAMZ,CAAA;AACD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAA;AASlD,QAAA,MAAM,eAAe;;;IAGnB,4BAA4B;;IAE5B,6EAA6E;;IAE7E,uDAAuD;;IAEvD,wDAAwD;;IAExD,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;IAExB,mDAAmD;;IAEnD,gEAAgE;;IAEhE,oEAAoE
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/entities/workspace/workspace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAQvB,QAAA,MAAM,SAAS,yIAAoD,CAAA;AAEnE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAEvD,QAAA,MAAM,OAAO;;;;;;;;;GAMZ,CAAA;AACD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAA;AASlD,QAAA,MAAM,eAAe;;;IAGnB,4BAA4B;;IAE5B,6EAA6E;;IAE7E,uDAAuD;;IAEvD,wDAAwD;;IAExD,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;IAExB,iDAAiD;;IAEjD,mDAAmD;;IAEnD,gEAAgE;;IAEhE,oEAAoE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEpE,CAAA;AAEF,gCAAgC;AAChC,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AACvD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAE9D,eAAO,MAAM,eAAe,YAAa,gBAAgB;;;;;;;;;;;;;;;;;;CACzB,CAAA"}
|
|
@@ -31,6 +31,8 @@ const workspaceSchema = z.object({
|
|
|
31
31
|
environmentUids: z.array(z.string()).default([]),
|
|
32
32
|
/** Customize hotkeys */
|
|
33
33
|
hotKeyConfig: hotKeyConfigSchema,
|
|
34
|
+
/** Active Environment ID to use for requests */
|
|
35
|
+
activeEnvironmentId: z.string().optional().default('default'),
|
|
34
36
|
/** List of all cookie uids in a given workspace */
|
|
35
37
|
cookieUids: z.array(z.string()).default([]),
|
|
36
38
|
/** Workspace level proxy for all requests to be sent through */
|
|
@@ -10,7 +10,7 @@ function replaceVariables(value, variablesOrCallback) {
|
|
|
10
10
|
return variablesOrCallback(match);
|
|
11
11
|
}
|
|
12
12
|
else {
|
|
13
|
-
return variablesOrCallback[match]?.toString()
|
|
13
|
+
return variablesOrCallback[match]?.toString() || `{${match}}`;
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
// Loop through all matches and replace the match with the variable value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getExampleFromSchema.d.ts","sourceRoot":"","sources":["../../src/spec-getters/getExampleFromSchema.ts"],"names":[],"mappings":"AAsCA;;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;;OAEG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAA;CACzC,UACM,MAAM,iBACE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,SAC3B,MAAM,KACZ,
|
|
1
|
+
{"version":3,"file":"getExampleFromSchema.d.ts","sourceRoot":"","sources":["../../src/spec-getters/getExampleFromSchema.ts"],"names":[],"mappings":"AAsCA;;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;;OAEG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAA;CACzC,UACM,MAAM,iBACE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,SAC3B,MAAM,KACZ,GAiQF,CAAA"}
|
|
@@ -121,10 +121,10 @@ const getExampleFromSchema = (schema, options, level = 0, parentSchema, name) =>
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
if (schema.anyOf !== undefined) {
|
|
124
|
-
Object.assign(response, getExampleFromSchema(schema.anyOf[0]
|
|
124
|
+
Object.assign(response, getExampleFromSchema(schema.anyOf[0], options, level + 1));
|
|
125
125
|
}
|
|
126
126
|
else if (schema.oneOf !== undefined) {
|
|
127
|
-
Object.assign(response, getExampleFromSchema(schema.oneOf[0]
|
|
127
|
+
Object.assign(response, getExampleFromSchema(schema.oneOf[0], options, level + 1));
|
|
128
128
|
}
|
|
129
129
|
else if (schema.allOf !== undefined) {
|
|
130
130
|
Object.assign(response, ...schema.allOf
|
|
@@ -39,8 +39,11 @@ export declare function getRequestBodyFromOperation(operation: TransformedOperat
|
|
|
39
39
|
}[];
|
|
40
40
|
postData: {
|
|
41
41
|
mimeType: string;
|
|
42
|
+
params: {
|
|
43
|
+
name: string;
|
|
44
|
+
value: any;
|
|
45
|
+
}[];
|
|
42
46
|
text?: undefined;
|
|
43
|
-
params?: undefined;
|
|
44
47
|
};
|
|
45
48
|
} | undefined;
|
|
46
49
|
//# sourceMappingURL=getRequestBodyFromOperation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRequestBodyFromOperation.d.ts","sourceRoot":"","sources":["../../src/spec-getters/getRequestBodyFromOperation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"getRequestBodyFromOperation.d.ts","sourceRoot":"","sources":["../../src/spec-getters/getRequestBodyFromOperation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAgC7E;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,oBAAoB,EAC/B,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAnB9B,MAAM;mBACL,GAAG;;;;cAiOX"}
|
|
@@ -4,6 +4,19 @@ import { prettyPrintJson } from '../helpers/prettyPrintJson.js';
|
|
|
4
4
|
import { getExampleFromSchema } from './getExampleFromSchema.js';
|
|
5
5
|
import { getParametersFromOperation } from './getParametersFromOperation.js';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Transform the object into a nested array of objects
|
|
9
|
+
* that represent the key-value pairs of the object.
|
|
10
|
+
*/
|
|
11
|
+
function getParamsFromObject(obj, prefix = '') {
|
|
12
|
+
return Object.entries(obj).flatMap(([key, value]) => {
|
|
13
|
+
const newKey = prefix ? `${prefix}[${key}]` : key;
|
|
14
|
+
if (typeof value === 'object' && value !== null) {
|
|
15
|
+
return getParamsFromObject(value, newKey);
|
|
16
|
+
}
|
|
17
|
+
return [{ name: newKey, value }];
|
|
18
|
+
});
|
|
19
|
+
}
|
|
7
20
|
/**
|
|
8
21
|
* Get the request body from the operation.
|
|
9
22
|
*/
|
|
@@ -160,36 +173,20 @@ function getRequestBodyFromOperation(operation, selectedExampleKey) {
|
|
|
160
173
|
};
|
|
161
174
|
}
|
|
162
175
|
// URL encoded data
|
|
163
|
-
if (mimeType === '
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
// name: 'foo',
|
|
173
|
-
// value: 'bar',
|
|
174
|
-
// },
|
|
175
|
-
// ],
|
|
176
|
-
},
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
// URL encoded data
|
|
180
|
-
if (mimeType === 'multipart/form-data') {
|
|
176
|
+
if (mimeType === 'multipart/form-data' ||
|
|
177
|
+
mimeType === 'application/x-www-form-urlencoded') {
|
|
178
|
+
const exampleFromSchema = requestBodyObject?.schema
|
|
179
|
+
? getExampleFromSchema(requestBodyObject?.schema, {
|
|
180
|
+
xml: true,
|
|
181
|
+
mode: 'write',
|
|
182
|
+
omitEmptyAndOptionalProperties: true,
|
|
183
|
+
})
|
|
184
|
+
: null;
|
|
181
185
|
return {
|
|
182
186
|
headers,
|
|
183
187
|
postData: {
|
|
184
188
|
mimeType: mimeType,
|
|
185
|
-
|
|
186
|
-
// Don’t forget to include nested properties … :|
|
|
187
|
-
// params: [
|
|
188
|
-
// {
|
|
189
|
-
// name: 'foo',
|
|
190
|
-
// value: 'bar',
|
|
191
|
-
// },
|
|
192
|
-
// ],
|
|
189
|
+
params: getParamsFromObject(example ?? exampleFromSchema ?? {}),
|
|
193
190
|
},
|
|
194
191
|
};
|
|
195
192
|
}
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"specification",
|
|
17
17
|
"yaml"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.2.
|
|
19
|
+
"version": "0.2.41",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=18"
|
|
22
22
|
},
|
|
@@ -86,22 +86,21 @@
|
|
|
86
86
|
],
|
|
87
87
|
"module": "dist/index.js",
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"axios": "^1.6.8",
|
|
90
89
|
"nanoid": "^5.0.7",
|
|
91
90
|
"yaml": "^2.4.5",
|
|
92
91
|
"zod": "^3.22.4",
|
|
93
92
|
"@scalar/object-utils": "1.1.7",
|
|
94
93
|
"@scalar/themes": "0.9.28",
|
|
95
|
-
"@scalar/types": "0.0.
|
|
94
|
+
"@scalar/types": "0.0.6"
|
|
96
95
|
},
|
|
97
96
|
"devDependencies": {
|
|
98
|
-
"@scalar/openapi-parser": "^0.7.2",
|
|
99
|
-
"axios": "^1.6.8",
|
|
100
97
|
"rollup": "^4.16.4",
|
|
101
98
|
"type-fest": "^4.20.0",
|
|
102
99
|
"vite": "^5.2.10",
|
|
103
100
|
"vitest": "^1.6.0",
|
|
104
|
-
"@scalar/build-tooling": "0.1.10"
|
|
101
|
+
"@scalar/build-tooling": "0.1.10",
|
|
102
|
+
"@scalar/openapi-parser": "0.8.1",
|
|
103
|
+
"@scalar/openapi-types": "0.1.0"
|
|
105
104
|
},
|
|
106
105
|
"scripts": {
|
|
107
106
|
"build": "scalar-build-rollup",
|