@scalar/oas-utils 0.2.109 → 0.2.111
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 +22 -0
- package/dist/entities/spec/operation.d.ts +6 -6
- package/dist/entities/spec/parameters.d.ts +4 -4
- package/dist/entities/spec/parameters.d.ts.map +1 -1
- package/dist/entities/spec/parameters.js +7 -4
- package/dist/entities/spec/request-examples.d.ts +22 -10
- package/dist/entities/spec/request-examples.d.ts.map +1 -1
- package/dist/entities/spec/request-examples.js +22 -7
- package/dist/entities/spec/requests.d.ts +12 -12
- package/dist/entities/workspace/workspace.d.ts +6 -6
- package/dist/entities/workspace/workspace.js +1 -1
- package/dist/helpers/normalizeMimeType.d.ts +1 -2
- package/dist/helpers/normalizeMimeType.d.ts.map +1 -1
- package/dist/helpers/normalizeMimeType.js +2 -2
- package/dist/helpers/normalizeMimeTypeObject.d.ts +2 -0
- package/dist/helpers/normalizeMimeTypeObject.d.ts.map +1 -1
- package/dist/spec-getters/getRequestBodyFromOperation.d.ts +2 -4
- package/dist/spec-getters/getRequestBodyFromOperation.d.ts.map +1 -1
- package/dist/spec-getters/getRequestBodyFromOperation.js +11 -14
- package/dist/transforms/import-spec.d.ts +3 -3
- package/dist/transforms/import-spec.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @scalar/oas-utils
|
|
2
2
|
|
|
3
|
+
## 0.2.111
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 89d8b75: feat: new ApiReferenceConfiguration type
|
|
8
|
+
- 8a04b8d: fix: mime type transformation issue
|
|
9
|
+
- 1459ce7: fix: adds parameter examples array support
|
|
10
|
+
- 8a04b8d: fix: adds vendor specific mime type support
|
|
11
|
+
- Updated dependencies [89d8b75]
|
|
12
|
+
- Updated dependencies [8a04b8d]
|
|
13
|
+
- @scalar/themes@0.9.72
|
|
14
|
+
- @scalar/types@0.0.37
|
|
15
|
+
- @scalar/object-utils@1.1.13
|
|
16
|
+
- @scalar/openapi-types@0.1.9
|
|
17
|
+
|
|
18
|
+
## 0.2.110
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [0d4520f]
|
|
23
|
+
- @scalar/themes@0.9.71
|
|
24
|
+
|
|
3
25
|
## 0.2.109
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -22,7 +22,7 @@ export declare const operationSchema: import("zod").ZodObject<import("zod").obje
|
|
|
22
22
|
content: import("zod").ZodOptional<import("zod").ZodUnknown>;
|
|
23
23
|
style: import("zod").ZodOptional<import("zod").ZodEnum<["matrix", "simple", "form", "label", "spaceDelimited", "pipeDelimited", "deepObject"]>>;
|
|
24
24
|
example: import("zod").ZodOptional<import("zod").ZodUnknown>;
|
|
25
|
-
examples: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
|
25
|
+
examples: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
|
26
26
|
value: import("zod").ZodUnknown;
|
|
27
27
|
summary: import("zod").ZodOptional<import("zod").ZodString>;
|
|
28
28
|
}, "strip", import("zod").ZodTypeAny, {
|
|
@@ -31,7 +31,7 @@ export declare const operationSchema: import("zod").ZodObject<import("zod").obje
|
|
|
31
31
|
}, {
|
|
32
32
|
value?: unknown;
|
|
33
33
|
summary?: string | undefined;
|
|
34
|
-
}
|
|
34
|
+
}>>, import("zod").ZodArray<import("zod").ZodUnknown, "many">]>>;
|
|
35
35
|
}, "strip", import("zod").ZodTypeAny, {
|
|
36
36
|
required: boolean;
|
|
37
37
|
name: string;
|
|
@@ -42,7 +42,7 @@ export declare const operationSchema: import("zod").ZodObject<import("zod").obje
|
|
|
42
42
|
schema?: unknown;
|
|
43
43
|
content?: unknown;
|
|
44
44
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
45
|
-
examples?: Record<string, {
|
|
45
|
+
examples?: unknown[] | Record<string, {
|
|
46
46
|
value?: unknown;
|
|
47
47
|
summary?: string | undefined;
|
|
48
48
|
}> | undefined;
|
|
@@ -56,7 +56,7 @@ export declare const operationSchema: import("zod").ZodObject<import("zod").obje
|
|
|
56
56
|
schema?: unknown;
|
|
57
57
|
content?: unknown;
|
|
58
58
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
59
|
-
examples?: Record<string, {
|
|
59
|
+
examples?: unknown[] | Record<string, {
|
|
60
60
|
value?: unknown;
|
|
61
61
|
summary?: string | undefined;
|
|
62
62
|
}> | undefined;
|
|
@@ -200,7 +200,7 @@ export declare const operationSchema: import("zod").ZodObject<import("zod").obje
|
|
|
200
200
|
schema?: unknown;
|
|
201
201
|
content?: unknown;
|
|
202
202
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
203
|
-
examples?: Record<string, {
|
|
203
|
+
examples?: unknown[] | Record<string, {
|
|
204
204
|
value?: unknown;
|
|
205
205
|
summary?: string | undefined;
|
|
206
206
|
}> | undefined;
|
|
@@ -237,7 +237,7 @@ export declare const operationSchema: import("zod").ZodObject<import("zod").obje
|
|
|
237
237
|
schema?: unknown;
|
|
238
238
|
content?: unknown;
|
|
239
239
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
240
|
-
examples?: Record<string, {
|
|
240
|
+
examples?: unknown[] | Record<string, {
|
|
241
241
|
value?: unknown;
|
|
242
242
|
summary?: string | undefined;
|
|
243
243
|
}> | undefined;
|
|
@@ -19,7 +19,7 @@ export declare const oasParameterSchema: z.ZodObject<{
|
|
|
19
19
|
/** Defaulted according to @url https://spec.openapis.org/oas/v3.1.0#parameter-object */
|
|
20
20
|
style: z.ZodOptional<z.ZodEnum<["matrix", "simple", "form", "label", "spaceDelimited", "pipeDelimited", "deepObject"]>>;
|
|
21
21
|
example: z.ZodOptional<z.ZodUnknown>;
|
|
22
|
-
examples: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
22
|
+
examples: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
23
23
|
value: z.ZodUnknown;
|
|
24
24
|
summary: z.ZodOptional<z.ZodString>;
|
|
25
25
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -28,7 +28,7 @@ export declare const oasParameterSchema: z.ZodObject<{
|
|
|
28
28
|
}, {
|
|
29
29
|
value?: unknown;
|
|
30
30
|
summary?: string | undefined;
|
|
31
|
-
}
|
|
31
|
+
}>>, z.ZodArray<z.ZodUnknown, "many">]>>;
|
|
32
32
|
}, "strip", z.ZodTypeAny, {
|
|
33
33
|
required: boolean;
|
|
34
34
|
name: string;
|
|
@@ -39,7 +39,7 @@ export declare const oasParameterSchema: z.ZodObject<{
|
|
|
39
39
|
schema?: unknown;
|
|
40
40
|
content?: unknown;
|
|
41
41
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
42
|
-
examples?: Record<string, {
|
|
42
|
+
examples?: unknown[] | Record<string, {
|
|
43
43
|
value?: unknown;
|
|
44
44
|
summary?: string | undefined;
|
|
45
45
|
}> | undefined;
|
|
@@ -53,7 +53,7 @@ export declare const oasParameterSchema: z.ZodObject<{
|
|
|
53
53
|
schema?: unknown;
|
|
54
54
|
content?: unknown;
|
|
55
55
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
56
|
-
examples?: Record<string, {
|
|
56
|
+
examples?: unknown[] | Record<string, {
|
|
57
57
|
value?: unknown;
|
|
58
58
|
summary?: string | undefined;
|
|
59
59
|
}> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/parameters.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvC,eAAO,MAAM,mBAAmB,kDAAgD,CAAA;AAChF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE3D,eAAO,MAAM,oBAAoB,mGAQ/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;IAI7B,yBAAyB;;IAEzB,yBAAyB;;;;IAIzB,wFAAwF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/parameters.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvC,eAAO,MAAM,mBAAmB,kDAAgD,CAAA;AAChF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE3D,eAAO,MAAM,oBAAoB,mGAQ/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;IAI7B,yBAAyB;;IAEzB,yBAAyB;;;;IAIzB,wFAAwF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAejD,CAAA;AAEzC,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AACjE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA"}
|
|
@@ -27,10 +27,13 @@ const oasParameterSchema = z.object({
|
|
|
27
27
|
style: parameterStyleSchema.optional(),
|
|
28
28
|
example: z.unknown().optional(),
|
|
29
29
|
examples: z
|
|
30
|
-
.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
.union([
|
|
31
|
+
z.record(z.string(), z.object({
|
|
32
|
+
value: z.unknown(),
|
|
33
|
+
summary: z.string().optional(),
|
|
34
|
+
})),
|
|
35
|
+
z.array(z.unknown()),
|
|
36
|
+
])
|
|
34
37
|
.optional(),
|
|
35
38
|
});
|
|
36
39
|
|
|
@@ -161,12 +161,15 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
|
|
|
161
161
|
raw: z.ZodOptional<z.ZodObject<{
|
|
162
162
|
encoding: z.ZodEnum<["json", "text", "html", "javascript", "xml", "yaml", "edn"]>;
|
|
163
163
|
value: z.ZodDefault<z.ZodString>;
|
|
164
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
164
165
|
}, "strip", z.ZodTypeAny, {
|
|
165
166
|
value: string;
|
|
166
|
-
encoding: "xml" | "
|
|
167
|
+
encoding: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn";
|
|
168
|
+
mimeType?: string | undefined;
|
|
167
169
|
}, {
|
|
168
|
-
encoding: "xml" | "
|
|
170
|
+
encoding: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn";
|
|
169
171
|
value?: string | undefined;
|
|
172
|
+
mimeType?: string | undefined;
|
|
170
173
|
}>>;
|
|
171
174
|
formData: z.ZodOptional<z.ZodObject<{
|
|
172
175
|
encoding: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"form-data">, z.ZodLiteral<"urlencoded">]>>;
|
|
@@ -309,7 +312,8 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
|
|
|
309
312
|
} | undefined;
|
|
310
313
|
raw?: {
|
|
311
314
|
value: string;
|
|
312
|
-
encoding: "xml" | "
|
|
315
|
+
encoding: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn";
|
|
316
|
+
mimeType?: string | undefined;
|
|
313
317
|
} | undefined;
|
|
314
318
|
}, {
|
|
315
319
|
binary?: Blob | undefined;
|
|
@@ -333,8 +337,9 @@ export declare const exampleRequestBodySchema: z.ZodObject<{
|
|
|
333
337
|
encoding?: "form-data" | "urlencoded" | undefined;
|
|
334
338
|
} | undefined;
|
|
335
339
|
raw?: {
|
|
336
|
-
encoding: "xml" | "
|
|
340
|
+
encoding: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn";
|
|
337
341
|
value?: string | undefined;
|
|
342
|
+
mimeType?: string | undefined;
|
|
338
343
|
} | undefined;
|
|
339
344
|
activeBody?: "binary" | "formData" | "raw" | undefined;
|
|
340
345
|
}>;
|
|
@@ -384,12 +389,15 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
384
389
|
raw: z.ZodOptional<z.ZodObject<{
|
|
385
390
|
encoding: z.ZodEnum<["json", "text", "html", "javascript", "xml", "yaml", "edn"]>;
|
|
386
391
|
value: z.ZodDefault<z.ZodString>;
|
|
392
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
387
393
|
}, "strip", z.ZodTypeAny, {
|
|
388
394
|
value: string;
|
|
389
|
-
encoding: "xml" | "
|
|
395
|
+
encoding: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn";
|
|
396
|
+
mimeType?: string | undefined;
|
|
390
397
|
}, {
|
|
391
|
-
encoding: "xml" | "
|
|
398
|
+
encoding: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn";
|
|
392
399
|
value?: string | undefined;
|
|
400
|
+
mimeType?: string | undefined;
|
|
393
401
|
}>>;
|
|
394
402
|
formData: z.ZodOptional<z.ZodObject<{
|
|
395
403
|
encoding: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"form-data">, z.ZodLiteral<"urlencoded">]>>;
|
|
@@ -532,7 +540,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
532
540
|
} | undefined;
|
|
533
541
|
raw?: {
|
|
534
542
|
value: string;
|
|
535
|
-
encoding: "xml" | "
|
|
543
|
+
encoding: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn";
|
|
544
|
+
mimeType?: string | undefined;
|
|
536
545
|
} | undefined;
|
|
537
546
|
}, {
|
|
538
547
|
binary?: Blob | undefined;
|
|
@@ -556,8 +565,9 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
556
565
|
encoding?: "form-data" | "urlencoded" | undefined;
|
|
557
566
|
} | undefined;
|
|
558
567
|
raw?: {
|
|
559
|
-
encoding: "xml" | "
|
|
568
|
+
encoding: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn";
|
|
560
569
|
value?: string | undefined;
|
|
570
|
+
mimeType?: string | undefined;
|
|
561
571
|
} | undefined;
|
|
562
572
|
activeBody?: "binary" | "formData" | "raw" | undefined;
|
|
563
573
|
}>>>;
|
|
@@ -1093,7 +1103,8 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
1093
1103
|
} | undefined;
|
|
1094
1104
|
raw?: {
|
|
1095
1105
|
value: string;
|
|
1096
|
-
encoding: "xml" | "
|
|
1106
|
+
encoding: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn";
|
|
1107
|
+
mimeType?: string | undefined;
|
|
1097
1108
|
} | undefined;
|
|
1098
1109
|
};
|
|
1099
1110
|
requestUid?: (string & z.BRAND<"operation">) | undefined;
|
|
@@ -1190,8 +1201,9 @@ export declare const requestExampleSchema: z.ZodObject<{
|
|
|
1190
1201
|
encoding?: "form-data" | "urlencoded" | undefined;
|
|
1191
1202
|
} | undefined;
|
|
1192
1203
|
raw?: {
|
|
1193
|
-
encoding: "xml" | "
|
|
1204
|
+
encoding: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn";
|
|
1194
1205
|
value?: string | undefined;
|
|
1206
|
+
mimeType?: string | undefined;
|
|
1195
1207
|
} | undefined;
|
|
1196
1208
|
activeBody?: "binary" | "formData" | "raw" | undefined;
|
|
1197
1209
|
} | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-examples.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/request-examples.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCvC,CAAA;AAEJ,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,WAAY,uBAAuB,EAAE,2BAIhE,CAAA;AAER,kFAAkF;AAClF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAA;AAEpF,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,uEAAwE,CAAA;AAE/G,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,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
|
120
|
+
mimeType: z.string().optional(),
|
|
120
121
|
})
|
|
121
122
|
.optional(),
|
|
122
123
|
formData: z
|
|
@@ -230,7 +231,15 @@ function convertExampleToXScalar(example) {
|
|
|
230
231
|
function createParamInstance(param) {
|
|
231
232
|
const schema = param.schema;
|
|
232
233
|
const keys = Object.keys(param?.examples ?? {});
|
|
233
|
-
const firstExample =
|
|
234
|
+
const firstExample = (() => {
|
|
235
|
+
if (keys.length && !Array.isArray(param.examples)) {
|
|
236
|
+
return param.examples?.[keys[0]];
|
|
237
|
+
}
|
|
238
|
+
if (Array.isArray(param.examples) && param.examples.length > 0) {
|
|
239
|
+
return { value: param.examples[0] };
|
|
240
|
+
}
|
|
241
|
+
return null;
|
|
242
|
+
})();
|
|
234
243
|
/**
|
|
235
244
|
* TODO:
|
|
236
245
|
* - Need better value defaulting here
|
|
@@ -239,11 +248,15 @@ function createParamInstance(param) {
|
|
|
239
248
|
*/
|
|
240
249
|
const value = String(schema?.default ?? schema?.examples?.[0] ?? schema?.example ?? firstExample?.value ?? param.example ?? '');
|
|
241
250
|
// Handle non-string enums and enums within items for array types
|
|
242
|
-
const parseEnum =
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
251
|
+
const parseEnum = (() => {
|
|
252
|
+
if (schema?.enum && schema?.type !== 'string') {
|
|
253
|
+
return schema.enum?.map(String);
|
|
254
|
+
}
|
|
255
|
+
if (schema?.items?.enum && schema?.type === 'array') {
|
|
256
|
+
return schema.items.enum.map(String);
|
|
257
|
+
}
|
|
258
|
+
return schema?.enum;
|
|
259
|
+
})();
|
|
247
260
|
// Handle non-string examples
|
|
248
261
|
const parseExamples = schema?.examples && schema?.type !== 'string' ? schema.examples?.map(String) : schema?.examples;
|
|
249
262
|
// safe parse the example
|
|
@@ -302,10 +315,12 @@ function createExampleFromRequest(request, name, server) {
|
|
|
302
315
|
},
|
|
303
316
|
});
|
|
304
317
|
const contentType = request.requestBody ? requestBody?.mimeType : contentTypeHeader?.value;
|
|
305
|
-
|
|
318
|
+
// Handle JSON and JSON-like mimetypes
|
|
319
|
+
if (contentType?.includes('/json') || contentType?.endsWith('+json')) {
|
|
306
320
|
body.activeBody = 'raw';
|
|
307
321
|
body.raw = {
|
|
308
322
|
encoding: 'json',
|
|
323
|
+
mimeType: contentType,
|
|
309
324
|
value: requestBody?.text ?? JSON.stringify({}),
|
|
310
325
|
};
|
|
311
326
|
}
|
|
@@ -74,7 +74,7 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
74
74
|
content: z.ZodOptional<z.ZodUnknown>;
|
|
75
75
|
style: z.ZodOptional<z.ZodEnum<["matrix", "simple", "form", "label", "spaceDelimited", "pipeDelimited", "deepObject"]>>;
|
|
76
76
|
example: z.ZodOptional<z.ZodUnknown>;
|
|
77
|
-
examples: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
77
|
+
examples: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
78
78
|
value: z.ZodUnknown;
|
|
79
79
|
summary: z.ZodOptional<z.ZodString>;
|
|
80
80
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -83,7 +83,7 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
83
83
|
}, {
|
|
84
84
|
value?: unknown;
|
|
85
85
|
summary?: string | undefined;
|
|
86
|
-
}
|
|
86
|
+
}>>, z.ZodArray<z.ZodUnknown, "many">]>>;
|
|
87
87
|
}, "strip", z.ZodTypeAny, {
|
|
88
88
|
required: boolean;
|
|
89
89
|
name: string;
|
|
@@ -94,7 +94,7 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
94
94
|
schema?: unknown;
|
|
95
95
|
content?: unknown;
|
|
96
96
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
97
|
-
examples?: Record<string, {
|
|
97
|
+
examples?: unknown[] | Record<string, {
|
|
98
98
|
value?: unknown;
|
|
99
99
|
summary?: string | undefined;
|
|
100
100
|
}> | undefined;
|
|
@@ -108,7 +108,7 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
108
108
|
schema?: unknown;
|
|
109
109
|
content?: unknown;
|
|
110
110
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
111
|
-
examples?: Record<string, {
|
|
111
|
+
examples?: unknown[] | Record<string, {
|
|
112
112
|
value?: unknown;
|
|
113
113
|
summary?: string | undefined;
|
|
114
114
|
}> | undefined;
|
|
@@ -241,7 +241,7 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
241
241
|
schema?: unknown;
|
|
242
242
|
content?: unknown;
|
|
243
243
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
244
|
-
examples?: Record<string, {
|
|
244
|
+
examples?: unknown[] | Record<string, {
|
|
245
245
|
value?: unknown;
|
|
246
246
|
summary?: string | undefined;
|
|
247
247
|
}> | undefined;
|
|
@@ -288,7 +288,7 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
288
288
|
schema?: unknown;
|
|
289
289
|
content?: unknown;
|
|
290
290
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
291
|
-
examples?: Record<string, {
|
|
291
|
+
examples?: unknown[] | Record<string, {
|
|
292
292
|
value?: unknown;
|
|
293
293
|
summary?: string | undefined;
|
|
294
294
|
}> | undefined;
|
|
@@ -360,7 +360,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
|
360
360
|
content: z.ZodOptional<z.ZodUnknown>;
|
|
361
361
|
style: z.ZodOptional<z.ZodEnum<["matrix", "simple", "form", "label", "spaceDelimited", "pipeDelimited", "deepObject"]>>;
|
|
362
362
|
example: z.ZodOptional<z.ZodUnknown>;
|
|
363
|
-
examples: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
363
|
+
examples: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
364
364
|
value: z.ZodUnknown;
|
|
365
365
|
summary: z.ZodOptional<z.ZodString>;
|
|
366
366
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -369,7 +369,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
|
369
369
|
}, {
|
|
370
370
|
value?: unknown;
|
|
371
371
|
summary?: string | undefined;
|
|
372
|
-
}
|
|
372
|
+
}>>, z.ZodArray<z.ZodUnknown, "many">]>>;
|
|
373
373
|
}, "strip", z.ZodTypeAny, {
|
|
374
374
|
required: boolean;
|
|
375
375
|
name: string;
|
|
@@ -380,7 +380,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
|
380
380
|
schema?: unknown;
|
|
381
381
|
content?: unknown;
|
|
382
382
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
383
|
-
examples?: Record<string, {
|
|
383
|
+
examples?: unknown[] | Record<string, {
|
|
384
384
|
value?: unknown;
|
|
385
385
|
summary?: string | undefined;
|
|
386
386
|
}> | undefined;
|
|
@@ -394,7 +394,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
|
394
394
|
schema?: unknown;
|
|
395
395
|
content?: unknown;
|
|
396
396
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
397
|
-
examples?: Record<string, {
|
|
397
|
+
examples?: unknown[] | Record<string, {
|
|
398
398
|
value?: unknown;
|
|
399
399
|
summary?: string | undefined;
|
|
400
400
|
}> | undefined;
|
|
@@ -550,7 +550,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
|
550
550
|
schema?: unknown;
|
|
551
551
|
content?: unknown;
|
|
552
552
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
553
|
-
examples?: Record<string, {
|
|
553
|
+
examples?: unknown[] | Record<string, {
|
|
554
554
|
value?: unknown;
|
|
555
555
|
summary?: string | undefined;
|
|
556
556
|
}> | undefined;
|
|
@@ -587,7 +587,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
|
587
587
|
schema?: unknown;
|
|
588
588
|
content?: unknown;
|
|
589
589
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
590
|
-
examples?: Record<string, {
|
|
590
|
+
examples?: unknown[] | Record<string, {
|
|
591
591
|
value?: unknown;
|
|
592
592
|
summary?: string | undefined;
|
|
593
593
|
}> | undefined;
|
|
@@ -36,13 +36,13 @@ export declare const workspaceSchema: z.ZodObject<{
|
|
|
36
36
|
}>>>;
|
|
37
37
|
}, "strip", z.ZodTypeAny, {
|
|
38
38
|
modifiers: ("Meta" | "Control" | "Shift" | "Alt" | "default")[];
|
|
39
|
-
hotKeys?: Partial<Record<"" | "/" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "
|
|
39
|
+
hotKeys?: Partial<Record<"" | "/" | "0" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "*" | "+" | "-" | "." | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | ";" | "=" | "," | "`" | "[" | "\\" | "]", {
|
|
40
40
|
event: "addTopNav" | "closeModal" | "closeTopNav" | "createNew" | "executeRequest" | "focusAddressBar" | "focusRequestSearch" | "jumpToLastTab" | "jumpToTab" | "navigateSearchResultsDown" | "navigateSearchResultsUp" | "navigateTopNavLeft" | "navigateTopNavRight" | "openCommandPalette" | "selectSearchResult" | "toggleSidebar";
|
|
41
41
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default")[] | undefined;
|
|
42
42
|
}>> | undefined;
|
|
43
43
|
}, {
|
|
44
44
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default" | undefined)[] | undefined;
|
|
45
|
-
hotKeys?: Partial<Record<"" | "/" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "
|
|
45
|
+
hotKeys?: Partial<Record<"" | "/" | "0" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "*" | "+" | "-" | "." | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | ";" | "=" | "," | "`" | "[" | "\\" | "]", {
|
|
46
46
|
event: "addTopNav" | "closeModal" | "closeTopNav" | "createNew" | "executeRequest" | "focusAddressBar" | "focusRequestSearch" | "jumpToLastTab" | "jumpToTab" | "navigateSearchResultsDown" | "navigateSearchResultsUp" | "navigateTopNavLeft" | "navigateTopNavRight" | "openCommandPalette" | "selectSearchResult" | "toggleSidebar";
|
|
47
47
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default" | undefined)[] | undefined;
|
|
48
48
|
}>> | undefined;
|
|
@@ -54,7 +54,7 @@ export declare const workspaceSchema: z.ZodObject<{
|
|
|
54
54
|
/** Workspace level proxy for all requests to be sent through */
|
|
55
55
|
proxyUrl: z.ZodOptional<z.ZodString>;
|
|
56
56
|
/** Workspace level theme, we might move this to user level later */
|
|
57
|
-
themeId: z.ZodDefault<z.ZodOptional<z.ZodEnum<["alternate", "default", "moon", "purple", "solarized", "bluePlanet", "deepSpace", "saturn", "kepler", "elysiajs", "fastify", "mars", "none"]
|
|
57
|
+
themeId: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodEnum<["alternate", "default", "moon", "purple", "solarized", "bluePlanet", "deepSpace", "saturn", "kepler", "elysiajs", "fastify", "mars", "none"]>>>>;
|
|
58
58
|
/** Currently selected snippet client */
|
|
59
59
|
selectedHttpClient: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
60
60
|
targetKey: z.ZodString;
|
|
@@ -81,7 +81,7 @@ export declare const workspaceSchema: z.ZodObject<{
|
|
|
81
81
|
};
|
|
82
82
|
hotKeyConfig?: {
|
|
83
83
|
modifiers: ("Meta" | "Control" | "Shift" | "Alt" | "default")[];
|
|
84
|
-
hotKeys?: Partial<Record<"" | "/" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "
|
|
84
|
+
hotKeys?: Partial<Record<"" | "/" | "0" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "*" | "+" | "-" | "." | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | ";" | "=" | "," | "`" | "[" | "\\" | "]", {
|
|
85
85
|
event: "addTopNav" | "closeModal" | "closeTopNav" | "createNew" | "executeRequest" | "focusAddressBar" | "focusRequestSearch" | "jumpToLastTab" | "jumpToTab" | "navigateSearchResultsDown" | "navigateSearchResultsUp" | "navigateTopNavLeft" | "navigateTopNavRight" | "openCommandPalette" | "selectSearchResult" | "toggleSidebar";
|
|
86
86
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default")[] | undefined;
|
|
87
87
|
}>> | undefined;
|
|
@@ -95,7 +95,7 @@ export declare const workspaceSchema: z.ZodObject<{
|
|
|
95
95
|
environments?: Record<string, string> | undefined;
|
|
96
96
|
hotKeyConfig?: {
|
|
97
97
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default" | undefined)[] | undefined;
|
|
98
|
-
hotKeys?: Partial<Record<"" | "/" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "
|
|
98
|
+
hotKeys?: Partial<Record<"" | "/" | "0" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "*" | "+" | "-" | "." | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | ";" | "=" | "," | "`" | "[" | "\\" | "]", {
|
|
99
99
|
event: "addTopNav" | "closeModal" | "closeTopNav" | "createNew" | "executeRequest" | "focusAddressBar" | "focusRequestSearch" | "jumpToLastTab" | "jumpToTab" | "navigateSearchResultsDown" | "navigateSearchResultsUp" | "navigateTopNavLeft" | "navigateTopNavRight" | "openCommandPalette" | "selectSearchResult" | "toggleSidebar";
|
|
100
100
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default" | undefined)[] | undefined;
|
|
101
101
|
}>> | undefined;
|
|
@@ -103,7 +103,7 @@ export declare const workspaceSchema: z.ZodObject<{
|
|
|
103
103
|
activeEnvironmentId?: string | undefined;
|
|
104
104
|
cookies?: string[] | undefined;
|
|
105
105
|
proxyUrl?: string | undefined;
|
|
106
|
-
themeId?:
|
|
106
|
+
themeId?: unknown;
|
|
107
107
|
selectedHttpClient?: {
|
|
108
108
|
targetKey: string;
|
|
109
109
|
clientKey: string;
|
|
@@ -36,7 +36,7 @@ const workspaceSchema = z.object({
|
|
|
36
36
|
/** Workspace level proxy for all requests to be sent through */
|
|
37
37
|
proxyUrl: z.string().optional(),
|
|
38
38
|
/** Workspace level theme, we might move this to user level later */
|
|
39
|
-
themeId: z.enum(themeIds).optional().default('default'),
|
|
39
|
+
themeId: z.enum(themeIds).optional().default('default').catch('default'),
|
|
40
40
|
/** Currently selected snippet client */
|
|
41
41
|
selectedHttpClient: z
|
|
42
42
|
.object({
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { ContentType } from '@scalar/types/legacy';
|
|
2
1
|
/**
|
|
3
2
|
* Normalizes a MIME type to a standard format.
|
|
4
3
|
*
|
|
5
4
|
* Input: application/problem+json; charset=utf-8
|
|
6
5
|
* Output: application/json
|
|
7
6
|
*/
|
|
8
|
-
export declare function normalizeMimeType(contentType?: string):
|
|
7
|
+
export declare function normalizeMimeType(contentType?: string): `application/json${string}` | `application/xml${string}` | `text/plain${string}` | `text/html${string}` | `application/octet-stream${string}` | `application/x-www-form-urlencoded${string}` | `multipart/form-data${string}` | `*/*${string}` | `application/vnd.${string}+json${string}` | undefined;
|
|
9
8
|
//# sourceMappingURL=normalizeMimeType.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeMimeType.d.ts","sourceRoot":"","sources":["../../src/helpers/normalizeMimeType.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalizeMimeType.d.ts","sourceRoot":"","sources":["../../src/helpers/normalizeMimeType.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,0SAcrD"}
|
|
@@ -11,8 +11,8 @@ function normalizeMimeType(contentType) {
|
|
|
11
11
|
return contentType
|
|
12
12
|
// Remove '; charset=utf-8'
|
|
13
13
|
.replace(/;.*$/, '')
|
|
14
|
-
// Remove 'problem+'
|
|
15
|
-
.replace(
|
|
14
|
+
// Remove 'problem+' but keep vendor-specific vnd and fhir mime types
|
|
15
|
+
.replace(/\/(?!.*vnd\.|fhir\+).*\+/, '/')
|
|
16
16
|
// Remove whitespace
|
|
17
17
|
.trim();
|
|
18
18
|
}
|
|
@@ -13,5 +13,7 @@ export declare function normalizeMimeTypeObject(content?: Record<ContentType, an
|
|
|
13
13
|
[x: `application/x-www-form-urlencoded${string}`]: any;
|
|
14
14
|
[x: `multipart/form-data${string}`]: any;
|
|
15
15
|
[x: `*/*${string}`]: any;
|
|
16
|
+
[x: `application/vnd.${string}+jsonnull`]: any;
|
|
17
|
+
[x: `application/vnd.${string}+json${string}`]: any;
|
|
16
18
|
} | undefined;
|
|
17
19
|
//# sourceMappingURL=normalizeMimeTypeObject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeMimeTypeObject.d.ts","sourceRoot":"","sources":["../../src/helpers/normalizeMimeTypeObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAIvD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC
|
|
1
|
+
{"version":3,"file":"normalizeMimeTypeObject.d.ts","sourceRoot":"","sources":["../../src/helpers/normalizeMimeTypeObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAIvD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC;;;;;;;;;;;cA8BzE"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import type { TransformedOperation } from '@scalar/types/legacy';
|
|
2
|
-
declare const mimeTypes: readonly ["application/json", "application/octet-stream", "application/x-www-form-urlencoded", "application/xml", "multipart/form-data", "text/plain"];
|
|
1
|
+
import type { ContentType, TransformedOperation } from '@scalar/types/legacy';
|
|
3
2
|
/**
|
|
4
3
|
* Get the request body from the operation.
|
|
5
4
|
*/
|
|
6
5
|
export declare function getRequestBodyFromOperation(operation: Omit<TransformedOperation, 'httpVerb'>, selectedExampleKey?: string | number, omitEmptyAndOptionalProperties?: boolean): {
|
|
7
|
-
mimeType:
|
|
6
|
+
mimeType: ContentType;
|
|
8
7
|
text?: string;
|
|
9
8
|
params?: {
|
|
10
9
|
name: string;
|
|
11
10
|
value?: string;
|
|
12
11
|
}[];
|
|
13
12
|
} | null;
|
|
14
|
-
export {};
|
|
15
13
|
//# 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,
|
|
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;AAyC7E;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,EACjD,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM,EACpC,8BAA8B,CAAC,EAAE,OAAO,GACvC;IACD,QAAQ,EAAE,WAAW,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,EAAE,CAAA;CACJ,GAAG,IAAI,CA+JP"}
|
|
@@ -17,8 +17,8 @@ function getParamsFromObject(obj, prefix = '') {
|
|
|
17
17
|
return [{ name: newKey, value }];
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
// Define
|
|
21
|
-
const
|
|
20
|
+
// Define preferred standard mime types (order indicates preference)
|
|
21
|
+
const standardMimeTypes = [
|
|
22
22
|
'application/json',
|
|
23
23
|
'application/octet-stream',
|
|
24
24
|
'application/x-www-form-urlencoded',
|
|
@@ -30,20 +30,17 @@ const mimeTypes = [
|
|
|
30
30
|
* Get the request body from the operation.
|
|
31
31
|
*/
|
|
32
32
|
function getRequestBodyFromOperation(operation, selectedExampleKey, omitEmptyAndOptionalProperties) {
|
|
33
|
-
// Get the content object from the operation
|
|
34
33
|
const originalContent = operation.information?.requestBody?.content;
|
|
35
34
|
const content = normalizeMimeTypeObject(originalContent);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*/
|
|
42
|
-
const mimeType = mimeTypes.find((currentMimeType) => !!content?.[currentMimeType]) ?? 'application/json';
|
|
35
|
+
// First try to find a standard mime type
|
|
36
|
+
const mimeType = standardMimeTypes.find((currentMimeType) => !!content?.[currentMimeType]) ??
|
|
37
|
+
(Object.keys(content ?? {})[0] || 'application/json');
|
|
38
|
+
// Handle JSON-like content types (e.g., application/vnd.github+json)
|
|
39
|
+
const isJsonLike = mimeType.includes('json') || mimeType.endsWith('+json');
|
|
43
40
|
/** Examples */
|
|
44
41
|
const examples = content?.[mimeType]?.examples ?? content?.['application/json']?.examples;
|
|
45
42
|
// Let’s use the first example
|
|
46
|
-
const selectedExample =
|
|
43
|
+
const selectedExample = examples?.[selectedExampleKey ?? Object.keys(examples ?? {})[0]];
|
|
47
44
|
if (selectedExample) {
|
|
48
45
|
return {
|
|
49
46
|
mimeType,
|
|
@@ -68,7 +65,7 @@ function getRequestBodyFromOperation(operation, selectedExampleKey, omitEmptyAnd
|
|
|
68
65
|
/**
|
|
69
66
|
* FormData Parameters (Swagger 2.0)
|
|
70
67
|
*
|
|
71
|
-
*
|
|
68
|
+
* ”Form - Used to describe the payload of an HTTP request when either application/x-www-form-urlencoded,
|
|
72
69
|
* multipart/form-data or both are used as the content type of the request (in Swagger's definition, the
|
|
73
70
|
* consumes property of an operation). This is the only parameter type that can be used to send files,
|
|
74
71
|
* thus supporting the file type. Since form parameters are sent in the payload, they cannot be declared
|
|
@@ -105,8 +102,8 @@ function getRequestBodyFromOperation(operation, selectedExampleKey, omitEmptyAnd
|
|
|
105
102
|
const requestBodyObject = content?.[mimeType];
|
|
106
103
|
// Get example from operation
|
|
107
104
|
const example = requestBodyObject?.example ? requestBodyObject?.example : undefined;
|
|
108
|
-
// JSON
|
|
109
|
-
if (
|
|
105
|
+
// Update the JSON handling section
|
|
106
|
+
if (isJsonLike) {
|
|
110
107
|
const exampleFromSchema = requestBodyObject?.schema
|
|
111
108
|
? getExampleFromSchema(requestBodyObject?.schema, {
|
|
112
109
|
mode: 'write',
|
|
@@ -2,7 +2,7 @@ import type { SelectedSecuritySchemeUids } from '../entities/shared/utility.js';
|
|
|
2
2
|
import { type Collection, type CollectionPayload, type Request, type RequestExample, type Server, type Tag } from '../entities/spec/index.js';
|
|
3
3
|
import { type SecurityScheme } from '../entities/spec/security.js';
|
|
4
4
|
import type { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ApiReferenceConfiguration } from '@scalar/types/api-reference';
|
|
6
6
|
import type { UnknownObject } from '@scalar/types/utils';
|
|
7
7
|
/** Takes a string or object and parses it into an openapi spec compliant schema */
|
|
8
8
|
export declare const parseSchema: (spec: string | UnknownObject, { shouldLoad }?: {
|
|
@@ -17,7 +17,7 @@ export declare const parseSchema: (spec: string | UnknownObject, { shouldLoad }?
|
|
|
17
17
|
}>;
|
|
18
18
|
/** Converts selected security requirements to uids */
|
|
19
19
|
export declare const getSelectedSecuritySchemeUids: (securityRequirements: (string | string[])[], preferredSecurityNames: (string | string[])[] | undefined, securitySchemeMap: Record<string, SecurityScheme["uid"]>) => SelectedSecuritySchemeUids;
|
|
20
|
-
export type ImportSpecToWorkspaceArgs = Pick<CollectionPayload, 'documentUrl' | 'watchMode'> & Pick<
|
|
20
|
+
export type ImportSpecToWorkspaceArgs = Pick<CollectionPayload, 'documentUrl' | 'watchMode'> & Pick<ApiReferenceConfiguration, 'authentication' | 'baseServerURL' | 'servers'> & {
|
|
21
21
|
/** Sets the preferred security scheme on the collection instead of the requests */
|
|
22
22
|
setCollectionSecurity?: boolean;
|
|
23
23
|
/** Call the load step from the parser */
|
|
@@ -53,5 +53,5 @@ export declare function importSpecToWorkspace(spec: string | UnknownObject, { au
|
|
|
53
53
|
/**
|
|
54
54
|
* Retrieves a list of servers from an OpenAPI document and converts them to a list of Server entities.
|
|
55
55
|
*/
|
|
56
|
-
export declare function getServersFromOpenApiDocument(servers: OpenAPIV3_1.ServerObject[] | undefined, { baseServerURL }?: Pick<
|
|
56
|
+
export declare function getServersFromOpenApiDocument(servers: OpenAPIV3_1.ServerObject[] | undefined, { baseServerURL }?: Pick<ApiReferenceConfiguration, 'baseServerURL'>): Server[];
|
|
57
57
|
//# sourceMappingURL=import-spec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-spec.d.ts","sourceRoot":"","sources":["../../src/transforms/import-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA;AAC3E,OAAO,EACL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,OAAO,EACZ,KAAK,cAAc,EAGnB,KAAK,MAAM,EACX,KAAK,GAAG,EAMT,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAEL,KAAK,cAAc,EAGpB,MAAM,0BAA0B,CAAA;AAMjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"import-spec.d.ts","sourceRoot":"","sources":["../../src/transforms/import-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA;AAC3E,OAAO,EACL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,OAAO,EACZ,KAAK,cAAc,EAGnB,KAAK,MAAM,EACX,KAAK,GAAG,EAMT,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAEL,KAAK,cAAc,EAGpB,MAAM,0BAA0B,CAAA;AAMjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGxD,mFAAmF;AACnF,eAAO,MAAM,WAAW,SAAgB,MAAM,GAAG,aAAa;;;IAkC1D;;;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,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
|
],
|
|
19
|
-
"version": "0.2.
|
|
19
|
+
"version": "0.2.111",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=18"
|
|
22
22
|
},
|
|
@@ -126,17 +126,17 @@
|
|
|
126
126
|
"nanoid": "^5.0.9",
|
|
127
127
|
"yaml": "^2.4.5",
|
|
128
128
|
"zod": "^3.23.8",
|
|
129
|
-
"@scalar/openapi-types": "0.1.9",
|
|
130
129
|
"@scalar/object-utils": "1.1.13",
|
|
131
|
-
"@scalar/
|
|
132
|
-
"@scalar/types": "0.
|
|
130
|
+
"@scalar/types": "0.0.37",
|
|
131
|
+
"@scalar/openapi-types": "0.1.9",
|
|
132
|
+
"@scalar/themes": "0.9.72"
|
|
133
133
|
},
|
|
134
134
|
"devDependencies": {
|
|
135
135
|
"type-fest": "^4.20.0",
|
|
136
136
|
"vite": "^5.4.10",
|
|
137
137
|
"vitest": "^1.6.0",
|
|
138
138
|
"zod-to-ts": "github:amritk/zod-to-ts#build",
|
|
139
|
-
"@scalar/build-tooling": "0.1.
|
|
139
|
+
"@scalar/build-tooling": "0.1.16",
|
|
140
140
|
"@scalar/openapi-types": "0.1.9",
|
|
141
141
|
"@scalar/openapi-parser": "0.10.9"
|
|
142
142
|
},
|