@scalar/oas-utils 0.2.110 → 0.2.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # @scalar/oas-utils
2
2
 
3
+ ## 0.2.113
4
+
5
+ ### Patch Changes
6
+
7
+ - a31973c: feat: add ScalarStabilitySchema
8
+ - Updated dependencies [bab7990]
9
+ - Updated dependencies [2c621d4]
10
+ - @scalar/types@0.0.39
11
+ - @scalar/themes@0.9.74
12
+
13
+ ## 0.2.112
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [7f1a40e]
18
+ - @scalar/types@0.0.38
19
+ - @scalar/themes@0.9.73
20
+
21
+ ## 0.2.111
22
+
23
+ ### Patch Changes
24
+
25
+ - 89d8b75: feat: new ApiReferenceConfiguration type
26
+ - 8a04b8d: fix: mime type transformation issue
27
+ - 1459ce7: fix: adds parameter examples array support
28
+ - 8a04b8d: fix: adds vendor specific mime type support
29
+ - Updated dependencies [89d8b75]
30
+ - Updated dependencies [8a04b8d]
31
+ - @scalar/themes@0.9.72
32
+ - @scalar/types@0.0.37
33
+ - @scalar/object-utils@1.1.13
34
+ - @scalar/openapi-types@0.1.9
35
+
3
36
  ## 0.2.110
4
37
 
5
38
  ### Patch Changes
@@ -5,7 +5,7 @@
5
5
  import { type RequestPayload, type Request as RequestType } from './requests.js';
6
6
  export type Operation = RequestType;
7
7
  export type OperationPayload = RequestPayload;
8
- export declare const operationSchema: import("zod").ZodObject<import("zod").objectUtil.extendShape<Omit<{
8
+ export declare const operationSchema: import("zod").ZodObject<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<Omit<{
9
9
  tags: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
10
10
  summary: import("zod").ZodOptional<import("zod").ZodString>;
11
11
  description: import("zod").ZodOptional<import("zod").ZodString>;
@@ -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;
@@ -161,6 +161,8 @@ export declare const operationSchema: import("zod").ZodObject<import("zod").obje
161
161
  'x-internal': import("zod").ZodOptional<import("zod").ZodBoolean>;
162
162
  'x-scalar-ignore': import("zod").ZodOptional<import("zod").ZodBoolean>;
163
163
  }, "x-scalar-examples">, {
164
+ 'x-scalar-stability': import("zod").ZodCatch<import("zod").ZodOptional<import("zod").ZodEnum<[import("@scalar/types").XScalarStability.Deprecated, import("@scalar/types").XScalarStability.Experimental, import("@scalar/types").XScalarStability.Stable]>>>;
165
+ }>, {
164
166
  type: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodLiteral<"request">>>;
165
167
  uid: import("zod").ZodBranded<import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>, "operation">;
166
168
  path: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
@@ -200,13 +202,14 @@ export declare const operationSchema: import("zod").ZodObject<import("zod").obje
200
202
  schema?: unknown;
201
203
  content?: unknown;
202
204
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
203
- examples?: Record<string, {
205
+ examples?: unknown[] | Record<string, {
204
206
  value?: unknown;
205
207
  summary?: string | undefined;
206
208
  }> | undefined;
207
209
  }[] | undefined;
208
210
  requestBody?: any;
209
211
  responses?: Record<string, any> | undefined;
212
+ 'x-scalar-stability'?: import("@scalar/types").XScalarStability | undefined;
210
213
  }, {
211
214
  path?: string | undefined;
212
215
  type?: "request" | undefined;
@@ -237,13 +240,14 @@ export declare const operationSchema: import("zod").ZodObject<import("zod").obje
237
240
  schema?: unknown;
238
241
  content?: unknown;
239
242
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
240
- examples?: Record<string, {
243
+ examples?: unknown[] | Record<string, {
241
244
  value?: unknown;
242
245
  summary?: string | undefined;
243
246
  }> | undefined;
244
247
  }[] | undefined;
245
248
  requestBody?: any;
246
249
  responses?: Record<string, any> | undefined;
250
+ 'x-scalar-stability'?: unknown;
247
251
  method?: "options" | "connect" | "delete" | "get" | "head" | "patch" | "post" | "put" | "trace" | undefined;
248
252
  }>;
249
253
  //# sourceMappingURL=operation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/operation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,OAAO,IAAI,WAAW,EAAiB,MAAM,YAAY,CAAA;AAE5F,MAAM,MAAM,SAAS,GAAG,WAAW,CAAA;AACnC,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAA;AAC7C,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAgB,CAAA"}
1
+ {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/operation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,OAAO,IAAI,WAAW,EAAiB,MAAM,YAAY,CAAA;AAE5F,MAAM,MAAM,SAAS,GAAG,WAAW,CAAA;AACnC,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAA;AAC7C,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAgB,CAAA"}
@@ -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,CAA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AuB,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
- .record(z.string(), z.object({
31
- value: z.unknown(),
32
- summary: z.string().optional(),
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" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
167
+ encoding: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn";
168
+ mimeType?: string | undefined;
167
169
  }, {
168
- encoding: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
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" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
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" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
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" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
395
+ encoding: "xml" | "json" | "text" | "html" | "javascript" | "yaml" | "edn";
396
+ mimeType?: string | undefined;
390
397
  }, {
391
- encoding: "xml" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
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" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
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" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
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" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
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" | "text" | "json" | "html" | "javascript" | "yaml" | "edn";
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,C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E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4C1E,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,cAAc;;;;;;;;;;;;;;;;EAqD9D;AAKD,6DAA6D;AAC7D,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB;;;;;;;;;;;;;;;EAiE1D;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,CA8GxG"}
@@ -117,6 +117,7 @@ const exampleRequestBodySchema = z.object({
117
117
  .object({
118
118
  encoding: z.enum(exampleRequestBodyEncoding),
119
119
  value: z.string().default(''),
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 = keys.length ? param.examples?.[keys[0]] : null;
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 = schema?.enum && schema?.type !== 'string'
243
- ? schema.enum?.map(String)
244
- : schema?.items?.enum && schema?.type === 'array'
245
- ? schema.items.enum.map(String)
246
- : schema?.enum;
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
- if (contentType === 'application/json') {
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
  }
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { XScalarStability } from '@scalar/types';
2
3
  import { type RequestExample } from './request-examples.js';
3
4
  export declare const requestMethods: readonly ["connect", "delete", "get", "head", "options", "patch", "post", "put", "trace"];
4
5
  export type RequestMethod = (typeof requestMethods)[number];
@@ -74,7 +75,7 @@ export declare const oasRequestSchema: z.ZodObject<{
74
75
  content: z.ZodOptional<z.ZodUnknown>;
75
76
  style: z.ZodOptional<z.ZodEnum<["matrix", "simple", "form", "label", "spaceDelimited", "pipeDelimited", "deepObject"]>>;
76
77
  example: z.ZodOptional<z.ZodUnknown>;
77
- examples: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
78
+ examples: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodObject<{
78
79
  value: z.ZodUnknown;
79
80
  summary: z.ZodOptional<z.ZodString>;
80
81
  }, "strip", z.ZodTypeAny, {
@@ -83,7 +84,7 @@ export declare const oasRequestSchema: z.ZodObject<{
83
84
  }, {
84
85
  value?: unknown;
85
86
  summary?: string | undefined;
86
- }>>>;
87
+ }>>, z.ZodArray<z.ZodUnknown, "many">]>>;
87
88
  }, "strip", z.ZodTypeAny, {
88
89
  required: boolean;
89
90
  name: string;
@@ -94,7 +95,7 @@ export declare const oasRequestSchema: z.ZodObject<{
94
95
  schema?: unknown;
95
96
  content?: unknown;
96
97
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
97
- examples?: Record<string, {
98
+ examples?: unknown[] | Record<string, {
98
99
  value?: unknown;
99
100
  summary?: string | undefined;
100
101
  }> | undefined;
@@ -108,7 +109,7 @@ export declare const oasRequestSchema: z.ZodObject<{
108
109
  schema?: unknown;
109
110
  content?: unknown;
110
111
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
111
- examples?: Record<string, {
112
+ examples?: unknown[] | Record<string, {
112
113
  value?: unknown;
113
114
  summary?: string | undefined;
114
115
  }> | undefined;
@@ -241,7 +242,7 @@ export declare const oasRequestSchema: z.ZodObject<{
241
242
  schema?: unknown;
242
243
  content?: unknown;
243
244
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
244
- examples?: Record<string, {
245
+ examples?: unknown[] | Record<string, {
245
246
  value?: unknown;
246
247
  summary?: string | undefined;
247
248
  }> | undefined;
@@ -288,7 +289,7 @@ export declare const oasRequestSchema: z.ZodObject<{
288
289
  schema?: unknown;
289
290
  content?: unknown;
290
291
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
291
- examples?: Record<string, {
292
+ examples?: unknown[] | Record<string, {
292
293
  value?: unknown;
293
294
  summary?: string | undefined;
294
295
  }> | undefined;
@@ -314,7 +315,7 @@ export declare const oasRequestSchema: z.ZodObject<{
314
315
  }> | undefined;
315
316
  }>;
316
317
  /** Unified request schema for client usage */
317
- export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
318
+ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<Omit<{
318
319
  /**
319
320
  * A list of tags for API documentation control. Tags can be used for logical
320
321
  * grouping of operations by resources or any other qualifier.
@@ -360,7 +361,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
360
361
  content: z.ZodOptional<z.ZodUnknown>;
361
362
  style: z.ZodOptional<z.ZodEnum<["matrix", "simple", "form", "label", "spaceDelimited", "pipeDelimited", "deepObject"]>>;
362
363
  example: z.ZodOptional<z.ZodUnknown>;
363
- examples: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
364
+ examples: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodObject<{
364
365
  value: z.ZodUnknown;
365
366
  summary: z.ZodOptional<z.ZodString>;
366
367
  }, "strip", z.ZodTypeAny, {
@@ -369,7 +370,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
369
370
  }, {
370
371
  value?: unknown;
371
372
  summary?: string | undefined;
372
- }>>>;
373
+ }>>, z.ZodArray<z.ZodUnknown, "many">]>>;
373
374
  }, "strip", z.ZodTypeAny, {
374
375
  required: boolean;
375
376
  name: string;
@@ -380,7 +381,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
380
381
  schema?: unknown;
381
382
  content?: unknown;
382
383
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
383
- examples?: Record<string, {
384
+ examples?: unknown[] | Record<string, {
384
385
  value?: unknown;
385
386
  summary?: string | undefined;
386
387
  }> | undefined;
@@ -394,7 +395,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
394
395
  schema?: unknown;
395
396
  content?: unknown;
396
397
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
397
- examples?: Record<string, {
398
+ examples?: unknown[] | Record<string, {
398
399
  value?: unknown;
399
400
  summary?: string | undefined;
400
401
  }> | undefined;
@@ -505,6 +506,8 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
505
506
  'x-internal': z.ZodOptional<z.ZodBoolean>;
506
507
  'x-scalar-ignore': z.ZodOptional<z.ZodBoolean>;
507
508
  }, "x-scalar-examples">, {
509
+ 'x-scalar-stability': z.ZodCatch<z.ZodOptional<z.ZodEnum<[XScalarStability.Deprecated, XScalarStability.Experimental, XScalarStability.Stable]>>>;
510
+ }>, {
508
511
  type: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"request">>>;
509
512
  uid: z.ZodBranded<z.ZodDefault<z.ZodOptional<z.ZodString>>, "operation">;
510
513
  /** Path Key */
@@ -550,13 +553,14 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
550
553
  schema?: unknown;
551
554
  content?: unknown;
552
555
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
553
- examples?: Record<string, {
556
+ examples?: unknown[] | Record<string, {
554
557
  value?: unknown;
555
558
  summary?: string | undefined;
556
559
  }> | undefined;
557
560
  }[] | undefined;
558
561
  requestBody?: any;
559
562
  responses?: Record<string, any> | undefined;
563
+ 'x-scalar-stability'?: XScalarStability | undefined;
560
564
  }, {
561
565
  path?: string | undefined;
562
566
  type?: "request" | undefined;
@@ -587,13 +591,14 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
587
591
  schema?: unknown;
588
592
  content?: unknown;
589
593
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
590
- examples?: Record<string, {
594
+ examples?: unknown[] | Record<string, {
591
595
  value?: unknown;
592
596
  summary?: string | undefined;
593
597
  }> | undefined;
594
598
  }[] | undefined;
595
599
  requestBody?: any;
596
600
  responses?: Record<string, any> | undefined;
601
+ 'x-scalar-stability'?: unknown;
597
602
  method?: "options" | "connect" | "delete" | "get" | "head" | "patch" | "post" | "put" | "trace" | undefined;
598
603
  }>;
599
604
  export type Request = z.infer<typeof requestSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/requests.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvC,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,oBAAoB,CAAA;AAI9E,eAAO,MAAM,cAAc,2FAA4F,CAAA;AAEvH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3D,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,MAAM,GAAG,IAAI,CAAA;IACnB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,0BAA0B;IAC1B,MAAM,EAAE,aAAa,CAAA;IACrB,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAA;CACb,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;AAMD,2CAA2C;AAC3C,eAAO,MAAM,gBAAgB;IAC3B;;;;;OAKG;;IAEH,kDAAkD;;IAElD,mHAAmH;;IAEnH;;;;OA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AAuB;;IAEvB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEvB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG2B,CAAA;AAyCnD,8CAA8C;AAC9C,eAAO,MAAM,aAAa;IA1FxB;;;;;OAKG;;IAEH,kDAAkD;;IAElD,mHAAmH;;IAEnH;;;;OAIG;;IAEH;;;;;;OAMG;;IAEH;;;;;OAKG;;IAEH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEH;;OAEG;;;;;;;;;;;;;;;;;;IAGH,uBAAuB;;IAEvB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEvB,sBAAsB;;;;;;;;IA8BtB,eAAe;;IAEf,qBAAqB;;IAErB,kDAAkD;;IAElD,oCAAoC;;IAEpC,uDAAuD;;IAEvD,+DAA+D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQlC,CAAA;AAE/B,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AACnD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import { nanoidSchema, selectedSecuritySchemeUidSchema } from '../shared/utility.js';
2
2
  import { z } from 'zod';
3
+ import { XScalarStability } from '@scalar/types';
3
4
  import { oasParameterSchema } from './parameters.js';
4
5
  import { xScalarExampleSchema } from './request-examples.js';
5
6
  import { oasSecurityRequirementSchema } from './security.js';
@@ -58,6 +59,20 @@ const oasRequestSchema = z.object({
58
59
  'x-internal': z.boolean().optional(),
59
60
  'x-scalar-ignore': z.boolean().optional(),
60
61
  });
62
+ /**
63
+ * An OpenAPI extension to indicate the stability of the operation
64
+ *
65
+ * @example
66
+ * ```yaml
67
+ * x-scalar-stability: deprecated
68
+ * ```
69
+ */
70
+ const ScalarStabilitySchema = z.object({
71
+ 'x-scalar-stability': z
72
+ .enum([XScalarStability.Deprecated, XScalarStability.Experimental, XScalarStability.Stable])
73
+ .optional()
74
+ .catch(undefined),
75
+ });
61
76
  /**
62
77
  * Extended properties added to the spec definition for client usage
63
78
  *
@@ -82,6 +97,9 @@ const extendedRequestSchema = z.object({
82
97
  selectedSecuritySchemeUids: selectedSecuritySchemeUidSchema,
83
98
  });
84
99
  /** Unified request schema for client usage */
85
- const requestSchema = oasRequestSchema.omit({ 'x-scalar-examples': true }).merge(extendedRequestSchema);
100
+ const requestSchema = oasRequestSchema
101
+ .omit({ 'x-scalar-examples': true })
102
+ .merge(ScalarStabilitySchema)
103
+ .merge(extendedRequestSchema);
86
104
 
87
105
  export { oasRequestSchema, requestMethods, requestSchema };
@@ -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" | "0" | "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" | ";" | "=" | "," | "`" | "[" | "\\" | "]", {
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" | "0" | "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" | ";" | "=" | "," | "`" | "[" | "\\" | "]", {
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" | "0" | "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" | ";" | "=" | "," | "`" | "[" | "\\" | "]", {
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" | "0" | "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" | ";" | "=" | "," | "`" | "[" | "\\" | "]", {
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?: "default" | "alternate" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "elysiajs" | "fastify" | "mars" | "none" | undefined;
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): ContentType | undefined;
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":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEvD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,2BAcrD"}
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;;;;;;;;;cA8BzE"}
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: (typeof mimeTypes)[number];
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,EAAe,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAgC7E,QAAA,MAAM,SAAS,wJAOL,CAAA;AAEV;;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,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAA;IACpC,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,CAgKP"}
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 all supported mime types
21
- const mimeTypes = [
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
- * Find the first mime type that is supported
38
- *
39
- * TODO: This is very fragile. There needs to be significantly more support for
40
- * vendor specific content types (like application/vnd.github+json)
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 = (examples ?? {})?.[selectedExampleKey ?? Object.keys(examples ?? {})[0]];
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
- * Form - Used to describe the payload of an HTTP request when either application/x-www-form-urlencoded,
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 (mimeType === 'application/json') {
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 { ReferenceConfiguration } from '@scalar/types/legacy';
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<ReferenceConfiguration, 'authentication' | 'baseServerURL' | 'servers'> & {
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<ReferenceConfiguration, 'baseServerURL'>): Server[];
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,2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GAAG,SAAS,EAC/C,EAAE,aAAa,EAAE,GAAE,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAM,GACvE,MAAM,EAAE,CAwCV"}
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "specification",
17
17
  "yaml"
18
18
  ],
19
- "version": "0.2.110",
19
+ "version": "0.2.113",
20
20
  "engines": {
21
21
  "node": ">=18"
22
22
  },
@@ -127,18 +127,18 @@
127
127
  "yaml": "^2.4.5",
128
128
  "zod": "^3.23.8",
129
129
  "@scalar/object-utils": "1.1.13",
130
- "@scalar/themes": "0.9.71",
130
+ "@scalar/themes": "0.9.74",
131
131
  "@scalar/openapi-types": "0.1.9",
132
- "@scalar/types": "0.0.36"
132
+ "@scalar/types": "0.0.39"
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.15",
140
- "@scalar/openapi-types": "0.1.9",
141
- "@scalar/openapi-parser": "0.10.9"
139
+ "@scalar/build-tooling": "0.1.16",
140
+ "@scalar/openapi-parser": "0.10.9",
141
+ "@scalar/openapi-types": "0.1.9"
142
142
  },
143
143
  "scripts": {
144
144
  "build": "scalar-build-rollup",