@scalar/oas-utils 0.2.75 → 0.2.76

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/entities/spec/collection.d.ts +292 -0
  3. package/dist/entities/spec/collection.d.ts.map +1 -1
  4. package/dist/entities/spec/collection.js +11 -1
  5. package/dist/entities/spec/index.js +2 -2
  6. package/dist/entities/spec/parameters.d.ts +2 -2
  7. package/dist/entities/spec/request-examples.d.ts +228 -70
  8. package/dist/entities/spec/request-examples.d.ts.map +1 -1
  9. package/dist/entities/spec/request-examples.js +156 -4
  10. package/dist/entities/spec/requests.d.ts +205 -11
  11. package/dist/entities/spec/requests.d.ts.map +1 -1
  12. package/dist/entities/spec/requests.js +16 -11
  13. package/dist/entities/spec/server.d.ts +2 -2
  14. package/dist/entities/spec/server.d.ts.map +1 -1
  15. package/dist/entities/spec/spec-objects.d.ts +20 -10
  16. package/dist/entities/spec/spec-objects.d.ts.map +1 -1
  17. package/dist/entities/spec/spec-objects.js +6 -1
  18. package/dist/entities/spec/x-scalar-environments.d.ts +74 -0
  19. package/dist/entities/spec/x-scalar-environments.d.ts.map +1 -0
  20. package/dist/entities/spec/x-scalar-environments.js +23 -0
  21. package/dist/entities/spec/x-scalar-secrets.d.ts +23 -0
  22. package/dist/entities/spec/x-scalar-secrets.d.ts.map +1 -0
  23. package/dist/entities/spec/x-scalar-secrets.js +9 -0
  24. package/dist/migrations/v-2.1.0/migration.d.ts +1 -1
  25. package/dist/spec-getters/getExampleFromSchema.d.ts +1 -0
  26. package/dist/spec-getters/getExampleFromSchema.d.ts.map +1 -1
  27. package/dist/spec-getters/getRequestBodyFromOperation.d.ts +1 -1
  28. package/dist/spec-getters/getRequestBodyFromOperation.d.ts.map +1 -1
  29. package/dist/spec-getters/getRequestBodyFromOperation.js +2 -5
  30. package/dist/spec-getters/getRequestFromOperation.d.ts +1 -1
  31. package/dist/spec-getters/getRequestFromOperation.d.ts.map +1 -1
  32. package/dist/spec-getters/getRequestFromOperation.js +2 -2
  33. package/dist/transforms/export-spec.d.ts +14 -71
  34. package/dist/transforms/export-spec.d.ts.map +1 -1
  35. package/dist/transforms/export-spec.js +73 -0
  36. package/dist/transforms/import-spec.js +1 -1
  37. package/dist/transforms/index.d.ts +1 -0
  38. package/dist/transforms/index.d.ts.map +1 -1
  39. package/dist/transforms/index.js +1 -0
  40. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"request-examples.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/request-examples.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEtC,eAAO,MAAM,8BAA8B;;;;;;IAMzC,kFAAkF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUlF,CAAA;AAEF,kFAAkF;AAClF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,8BAA8B,CACtC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,uEAQ7B,CAAA;AACV,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAA;AAEtE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;YAjCnC,kFAAkF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoDlF,CAAA;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEvC,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAOjE,2DAA2D;AAC3D,eAAO,MAAM,oBAAoB;IAC/B,qCAAqC;;;;QA3CrC;;;;WAIG;;QAEH,0EAA0E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8C1E,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,cAAc;;;;;;;;;;;;;;;;EA8D9D;AAKD,6DAA6D;AAC7D,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB;;;;;;;;;;;;;;EA8C1D;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,GACd,cAAc,CAiGhB"}
@@ -1,17 +1,24 @@
1
+ import { keysOf } from '@scalar/object-utils/arrays';
1
2
  import { z } from 'zod';
2
3
  import { schemaModel } from '../../helpers/schema-model.js';
3
4
  import { getRequestBodyFromOperation } from '../../spec-getters/getRequestBodyFromOperation.js';
4
5
  import { getServerVariableExamples } from '../../spec-getters/getServerVariableExamples.js';
5
6
  import { nanoidSchema } from '../shared/utility.js';
6
7
 
8
+ // ---------------------------------------------------------------------------
9
+ // Example Parameters
10
+ /**
11
+ * TODO: Deprecate this.
12
+ *
13
+ * The request schema should be stored in the request and any
14
+ * parameters should be validated against that
15
+ */
7
16
  const requestExampleParametersSchema = z.object({
8
17
  key: z.string().default(''),
9
18
  value: z.coerce.string().default(''),
10
19
  enabled: z.boolean().default(true),
11
20
  file: z.any().optional(),
12
21
  description: z.string().optional(),
13
- /** Params are linked to parents such as path params and global headers/cookies */
14
- refUid: nanoidSchema.optional(),
15
22
  required: z.boolean().optional(),
16
23
  enum: z.array(z.string()).optional(),
17
24
  type: z.string().optional(),
@@ -21,6 +28,36 @@ const requestExampleParametersSchema = z.object({
21
28
  default: z.any().optional(),
22
29
  nullable: z.boolean().optional(),
23
30
  });
31
+ /** Convert the array of parameters to an object keyed by the parameter name */
32
+ function parameterArrayToObject(params) {
33
+ return params.reduce((map, param) => {
34
+ map[param.key] = param.value;
35
+ return map;
36
+ }, {});
37
+ }
38
+ const xScalarFileValueSchema = z
39
+ .object({
40
+ url: z.string(),
41
+ base64: z.string().optional(),
42
+ })
43
+ .nullable();
44
+ /**
45
+ * Schema for the OAS serialization of request example parameters
46
+ *
47
+ * File values can be optionally fetched on import OR inserted as a base64 encoded string
48
+ */
49
+ const xScalarFormDataValue = z.union([
50
+ z.object({
51
+ type: z.literal('string'),
52
+ value: z.string(),
53
+ }),
54
+ z.object({
55
+ type: z.literal('file'),
56
+ file: xScalarFileValueSchema,
57
+ }),
58
+ ]);
59
+ // ---------------------------------------------------------------------------
60
+ // Example Body
24
61
  /**
25
62
  * Possible encodings for example request bodies when using text formats
26
63
  *
@@ -35,6 +72,34 @@ const exampleRequestBodyEncoding = [
35
72
  'yaml',
36
73
  'edn',
37
74
  ];
75
+ const exampleBodyMime = [
76
+ 'application/json',
77
+ 'text/plain',
78
+ 'text/html',
79
+ 'application/javascript',
80
+ 'application/xml',
81
+ 'application/yaml',
82
+ 'application/edn',
83
+ 'application/octet-stream',
84
+ 'application/x-www-form-urlencoded',
85
+ 'multipart/form-data',
86
+ /** Used for direct files */
87
+ 'binary',
88
+ ];
89
+ const contentMapping = {
90
+ json: 'application/json',
91
+ text: 'text/plain',
92
+ html: 'text/html',
93
+ javascript: 'application/javascript',
94
+ xml: 'application/xml',
95
+ yaml: 'application/yaml',
96
+ edn: 'application/edn',
97
+ };
98
+ /**
99
+ * TODO: Migrate away from this layout to the format used in the extension
100
+ *
101
+ * If a user changes the encoding of the body we expect the content to change as well
102
+ */
38
103
  const exampleRequestBodySchema = z.object({
39
104
  raw: z
40
105
  .object({
@@ -55,9 +120,23 @@ const exampleRequestBodySchema = z.object({
55
120
  .union([z.literal('raw'), z.literal('formData'), z.literal('binary')])
56
121
  .default('raw'),
57
122
  });
123
+ /** Schema for the OAS serialization of request example bodies */
124
+ const xScalarExampleBodySchema = z.object({
125
+ encoding: z.enum(exampleBodyMime).default('application/json'),
126
+ /**
127
+ * Body content as an object with a separately specified encoding or a simple pre-encoded string value
128
+ *
129
+ * Ideally we would convert any objects into the proper encoding on import
130
+ */
131
+ content: z.union([z.record(z.string(), z.any()), z.string()]),
132
+ /** When the encoding is `binary` this will be used to link to the file */
133
+ file: xScalarFileValueSchema.optional(),
134
+ });
135
+ // ---------------------------------------------------------------------------
136
+ // Example Schema
58
137
  const requestExampleSchema = z.object({
59
- type: z.literal('requestExample').optional().default('requestExample'),
60
138
  uid: nanoidSchema,
139
+ type: z.literal('requestExample').optional().default('requestExample'),
61
140
  requestUid: nanoidSchema,
62
141
  name: z.string().optional().default('Name'),
63
142
  body: exampleRequestBodySchema.optional().default({}),
@@ -70,8 +149,81 @@ const requestExampleSchema = z.object({
70
149
  })
71
150
  .optional()
72
151
  .default({}),
152
+ /** TODO: Should this be deprecated? */
73
153
  serverVariables: z.record(z.string(), z.array(z.string())).optional(),
74
154
  });
155
+ /** For OAS serialization we just store the simple key/value pairs */
156
+ const xScalarExampleParameterSchema = z
157
+ .record(z.string(), z.string())
158
+ .optional();
159
+ /** Schema for the OAS serialization of request examples */
160
+ const xScalarExampleSchema = z.object({
161
+ /** TODO: Should this be required? */
162
+ name: z.string().optional(),
163
+ body: xScalarExampleBodySchema.optional(),
164
+ parameters: z.object({
165
+ path: xScalarExampleParameterSchema,
166
+ query: xScalarExampleParameterSchema,
167
+ headers: xScalarExampleParameterSchema,
168
+ cookies: xScalarExampleParameterSchema,
169
+ }),
170
+ });
171
+ /**
172
+ * Convert a request example to the xScalar serialized format
173
+ *
174
+ * TODO: The base format should be migrated to align MUCH closer to the serialized format
175
+ */
176
+ function convertExampleToXScalar(example) {
177
+ const active = example.body?.activeBody;
178
+ const xScalarBody = {
179
+ encoding: 'text/plain',
180
+ content: '',
181
+ };
182
+ if (example.body?.activeBody === 'binary') {
183
+ xScalarBody.encoding = 'binary';
184
+ // TODO: Need to allow users to set these properties
185
+ xScalarBody.file = null;
186
+ }
187
+ if (active === 'formData' && example.body?.[active]) {
188
+ const body = example.body[active];
189
+ xScalarBody.encoding =
190
+ body.encoding === 'form-data'
191
+ ? 'multipart/form-data'
192
+ : 'application/x-www-form-urlencoded';
193
+ // TODO: Need to allow users to set these properties
194
+ xScalarBody.content = body.value.reduce((map, param) => {
195
+ /** TODO: We need to ensure only file or value is set */
196
+ map[param.key] = param.file
197
+ ? {
198
+ type: 'file',
199
+ file: null,
200
+ }
201
+ : {
202
+ type: 'string',
203
+ value: param.value,
204
+ };
205
+ return map;
206
+ }, {});
207
+ }
208
+ if (example.body?.activeBody === 'raw') {
209
+ xScalarBody.encoding =
210
+ contentMapping[example.body.raw?.encoding ?? 'text'] ?? 'text/plain';
211
+ xScalarBody.content = example.body.raw?.value ?? '';
212
+ }
213
+ const parameters = {};
214
+ keysOf(example.parameters ?? {}).forEach((key) => {
215
+ if (example.parameters?.[key].length) {
216
+ parameters[key] = parameterArrayToObject(example.parameters[key]);
217
+ }
218
+ });
219
+ return xScalarExampleSchema.parse({
220
+ /** Only add the body if we have content or the body should be a file */
221
+ body: xScalarBody.content || xScalarBody.encoding === 'binary'
222
+ ? xScalarBody
223
+ : undefined,
224
+ parameters,
225
+ });
226
+ }
75
227
  // ---------------------------------------------------------------------------
76
228
  // Example Helpers
77
229
  /** Create new instance parameter from a request parameter */
@@ -198,4 +350,4 @@ function createExampleFromRequest(request, name, server) {
198
350
  return example;
199
351
  }
200
352
 
201
- export { createExampleFromRequest, createParamInstance, exampleRequestBodyEncoding, exampleRequestBodySchema, requestExampleParametersSchema, requestExampleSchema };
353
+ export { convertExampleToXScalar, createExampleFromRequest, createParamInstance, exampleBodyMime, exampleRequestBodyEncoding, exampleRequestBodySchema, requestExampleParametersSchema, requestExampleSchema, xScalarExampleBodySchema, xScalarExampleSchema, xScalarFileValueSchema, xScalarFormDataValue };
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import type { RequestExample } from './request-examples.js';
2
+ import { type RequestExample } from './request-examples.js';
3
3
  export declare const requestMethods: readonly ["connect", "delete", "get", "head", "options", "patch", "post", "put", "trace"];
4
4
  export type RequestMethod = (typeof requestMethods)[number];
5
5
  /** A single set of populated values for a sent request */
@@ -90,10 +90,10 @@ export declare const oasRequestSchema: z.ZodObject<{
90
90
  in: "path" | "query" | "header" | "cookie";
91
91
  deprecated: boolean;
92
92
  description?: string | undefined;
93
+ example?: unknown;
93
94
  schema?: unknown;
94
95
  content?: unknown;
95
96
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
96
- example?: unknown;
97
97
  examples?: Record<string, {
98
98
  value?: unknown;
99
99
  summary?: string | undefined;
@@ -103,11 +103,11 @@ export declare const oasRequestSchema: z.ZodObject<{
103
103
  in: "path" | "query" | "header" | "cookie";
104
104
  required?: boolean | undefined;
105
105
  description?: string | undefined;
106
+ example?: unknown;
106
107
  deprecated?: boolean | undefined;
107
108
  schema?: unknown;
108
109
  content?: unknown;
109
110
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
110
- example?: unknown;
111
111
  examples?: Record<string, {
112
112
  value?: unknown;
113
113
  summary?: string | undefined;
@@ -129,6 +129,86 @@ export declare const oasRequestSchema: z.ZodObject<{
129
129
  deprecated: z.ZodOptional<z.ZodBoolean>;
130
130
  /** Response formats */
131
131
  responses: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
132
+ /** xScalar examples */
133
+ 'x-scalar-examples': z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
134
+ name: z.ZodOptional<z.ZodString>;
135
+ body: z.ZodOptional<z.ZodObject<{
136
+ encoding: z.ZodDefault<z.ZodEnum<["application/json", "text/plain", "text/html", "application/javascript", "application/xml", "application/yaml", "application/edn", "application/octet-stream", "application/x-www-form-urlencoded", "multipart/form-data", "binary"]>>;
137
+ content: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodString]>;
138
+ file: z.ZodOptional<z.ZodNullable<z.ZodObject<{
139
+ url: z.ZodString;
140
+ base64: z.ZodOptional<z.ZodString>;
141
+ }, "strip", z.ZodTypeAny, {
142
+ url: string;
143
+ base64?: string | undefined;
144
+ }, {
145
+ url: string;
146
+ base64?: string | undefined;
147
+ }>>>;
148
+ }, "strip", z.ZodTypeAny, {
149
+ content: string | Record<string, any>;
150
+ encoding: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary";
151
+ file?: {
152
+ url: string;
153
+ base64?: string | undefined;
154
+ } | null | undefined;
155
+ }, {
156
+ content: string | Record<string, any>;
157
+ file?: {
158
+ url: string;
159
+ base64?: string | undefined;
160
+ } | null | undefined;
161
+ encoding?: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary" | undefined;
162
+ }>>;
163
+ parameters: z.ZodObject<{
164
+ path: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
165
+ query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
166
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
167
+ cookies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
168
+ }, "strip", z.ZodTypeAny, {
169
+ path?: Record<string, string> | undefined;
170
+ cookies?: Record<string, string> | undefined;
171
+ query?: Record<string, string> | undefined;
172
+ headers?: Record<string, string> | undefined;
173
+ }, {
174
+ path?: Record<string, string> | undefined;
175
+ cookies?: Record<string, string> | undefined;
176
+ query?: Record<string, string> | undefined;
177
+ headers?: Record<string, string> | undefined;
178
+ }>;
179
+ }, "strip", z.ZodTypeAny, {
180
+ parameters: {
181
+ path?: Record<string, string> | undefined;
182
+ cookies?: Record<string, string> | undefined;
183
+ query?: Record<string, string> | undefined;
184
+ headers?: Record<string, string> | undefined;
185
+ };
186
+ name?: string | undefined;
187
+ body?: {
188
+ content: string | Record<string, any>;
189
+ encoding: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary";
190
+ file?: {
191
+ url: string;
192
+ base64?: string | undefined;
193
+ } | null | undefined;
194
+ } | undefined;
195
+ }, {
196
+ parameters: {
197
+ path?: Record<string, string> | undefined;
198
+ cookies?: Record<string, string> | undefined;
199
+ query?: Record<string, string> | undefined;
200
+ headers?: Record<string, string> | undefined;
201
+ };
202
+ name?: string | undefined;
203
+ body?: {
204
+ content: string | Record<string, any>;
205
+ file?: {
206
+ url: string;
207
+ base64?: string | undefined;
208
+ } | null | undefined;
209
+ encoding?: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary" | undefined;
210
+ } | undefined;
211
+ }>>>;
132
212
  }, "strip", z.ZodTypeAny, {
133
213
  description?: string | undefined;
134
214
  summary?: string | undefined;
@@ -146,10 +226,10 @@ export declare const oasRequestSchema: z.ZodObject<{
146
226
  in: "path" | "query" | "header" | "cookie";
147
227
  deprecated: boolean;
148
228
  description?: string | undefined;
229
+ example?: unknown;
149
230
  schema?: unknown;
150
231
  content?: unknown;
151
232
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
152
- example?: unknown;
153
233
  examples?: Record<string, {
154
234
  value?: unknown;
155
235
  summary?: string | undefined;
@@ -157,6 +237,23 @@ export declare const oasRequestSchema: z.ZodObject<{
157
237
  }[] | undefined;
158
238
  requestBody?: any;
159
239
  responses?: Record<string, any> | undefined;
240
+ 'x-scalar-examples'?: Record<string, {
241
+ parameters: {
242
+ path?: Record<string, string> | undefined;
243
+ cookies?: Record<string, string> | undefined;
244
+ query?: Record<string, string> | undefined;
245
+ headers?: Record<string, string> | undefined;
246
+ };
247
+ name?: string | undefined;
248
+ body?: {
249
+ content: string | Record<string, any>;
250
+ encoding: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary";
251
+ file?: {
252
+ url: string;
253
+ base64?: string | undefined;
254
+ } | null | undefined;
255
+ } | undefined;
256
+ }> | undefined;
160
257
  }, {
161
258
  description?: string | undefined;
162
259
  summary?: string | undefined;
@@ -173,11 +270,11 @@ export declare const oasRequestSchema: z.ZodObject<{
173
270
  in: "path" | "query" | "header" | "cookie";
174
271
  required?: boolean | undefined;
175
272
  description?: string | undefined;
273
+ example?: unknown;
176
274
  deprecated?: boolean | undefined;
177
275
  schema?: unknown;
178
276
  content?: unknown;
179
277
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
180
- example?: unknown;
181
278
  examples?: Record<string, {
182
279
  value?: unknown;
183
280
  summary?: string | undefined;
@@ -185,9 +282,26 @@ export declare const oasRequestSchema: z.ZodObject<{
185
282
  }[] | undefined;
186
283
  requestBody?: any;
187
284
  responses?: Record<string, any> | undefined;
285
+ 'x-scalar-examples'?: Record<string, {
286
+ parameters: {
287
+ path?: Record<string, string> | undefined;
288
+ cookies?: Record<string, string> | undefined;
289
+ query?: Record<string, string> | undefined;
290
+ headers?: Record<string, string> | undefined;
291
+ };
292
+ name?: string | undefined;
293
+ body?: {
294
+ content: string | Record<string, any>;
295
+ file?: {
296
+ url: string;
297
+ base64?: string | undefined;
298
+ } | null | undefined;
299
+ encoding?: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary" | undefined;
300
+ } | undefined;
301
+ }> | undefined;
188
302
  }>;
189
303
  /** Unified request schema for client usage */
190
- export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<{
304
+ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
191
305
  /**
192
306
  * A list of tags for API documentation control. Tags can be used for logical
193
307
  * grouping of operations by resources or any other qualifier.
@@ -249,10 +363,10 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<{
249
363
  in: "path" | "query" | "header" | "cookie";
250
364
  deprecated: boolean;
251
365
  description?: string | undefined;
366
+ example?: unknown;
252
367
  schema?: unknown;
253
368
  content?: unknown;
254
369
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
255
- example?: unknown;
256
370
  examples?: Record<string, {
257
371
  value?: unknown;
258
372
  summary?: string | undefined;
@@ -262,11 +376,11 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<{
262
376
  in: "path" | "query" | "header" | "cookie";
263
377
  required?: boolean | undefined;
264
378
  description?: string | undefined;
379
+ example?: unknown;
265
380
  deprecated?: boolean | undefined;
266
381
  schema?: unknown;
267
382
  content?: unknown;
268
383
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
269
- example?: unknown;
270
384
  examples?: Record<string, {
271
385
  value?: unknown;
272
386
  summary?: string | undefined;
@@ -288,7 +402,87 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<{
288
402
  deprecated: z.ZodOptional<z.ZodBoolean>;
289
403
  /** Response formats */
290
404
  responses: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
291
- }, {
405
+ /** xScalar examples */
406
+ 'x-scalar-examples': z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
407
+ name: z.ZodOptional<z.ZodString>;
408
+ body: z.ZodOptional<z.ZodObject<{
409
+ encoding: z.ZodDefault<z.ZodEnum<["application/json", "text/plain", "text/html", "application/javascript", "application/xml", "application/yaml", "application/edn", "application/octet-stream", "application/x-www-form-urlencoded", "multipart/form-data", "binary"]>>;
410
+ content: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodString]>;
411
+ file: z.ZodOptional<z.ZodNullable<z.ZodObject<{
412
+ url: z.ZodString;
413
+ base64: z.ZodOptional<z.ZodString>;
414
+ }, "strip", z.ZodTypeAny, {
415
+ url: string;
416
+ base64?: string | undefined;
417
+ }, {
418
+ url: string;
419
+ base64?: string | undefined;
420
+ }>>>;
421
+ }, "strip", z.ZodTypeAny, {
422
+ content: string | Record<string, any>;
423
+ encoding: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary";
424
+ file?: {
425
+ url: string;
426
+ base64?: string | undefined;
427
+ } | null | undefined;
428
+ }, {
429
+ content: string | Record<string, any>;
430
+ file?: {
431
+ url: string;
432
+ base64?: string | undefined;
433
+ } | null | undefined;
434
+ encoding?: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary" | undefined;
435
+ }>>;
436
+ parameters: z.ZodObject<{
437
+ path: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
438
+ query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
439
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
440
+ cookies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
441
+ }, "strip", z.ZodTypeAny, {
442
+ path?: Record<string, string> | undefined;
443
+ cookies?: Record<string, string> | undefined;
444
+ query?: Record<string, string> | undefined;
445
+ headers?: Record<string, string> | undefined;
446
+ }, {
447
+ path?: Record<string, string> | undefined;
448
+ cookies?: Record<string, string> | undefined;
449
+ query?: Record<string, string> | undefined;
450
+ headers?: Record<string, string> | undefined;
451
+ }>;
452
+ }, "strip", z.ZodTypeAny, {
453
+ parameters: {
454
+ path?: Record<string, string> | undefined;
455
+ cookies?: Record<string, string> | undefined;
456
+ query?: Record<string, string> | undefined;
457
+ headers?: Record<string, string> | undefined;
458
+ };
459
+ name?: string | undefined;
460
+ body?: {
461
+ content: string | Record<string, any>;
462
+ encoding: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary";
463
+ file?: {
464
+ url: string;
465
+ base64?: string | undefined;
466
+ } | null | undefined;
467
+ } | undefined;
468
+ }, {
469
+ parameters: {
470
+ path?: Record<string, string> | undefined;
471
+ cookies?: Record<string, string> | undefined;
472
+ query?: Record<string, string> | undefined;
473
+ headers?: Record<string, string> | undefined;
474
+ };
475
+ name?: string | undefined;
476
+ body?: {
477
+ content: string | Record<string, any>;
478
+ file?: {
479
+ url: string;
480
+ base64?: string | undefined;
481
+ } | null | undefined;
482
+ encoding?: "application/json" | "application/octet-stream" | "application/x-www-form-urlencoded" | "application/xml" | "multipart/form-data" | "text/plain" | "text/html" | "application/javascript" | "application/yaml" | "application/edn" | "binary" | undefined;
483
+ } | undefined;
484
+ }>>>;
485
+ }, "x-scalar-examples">, {
292
486
  type: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"request">>>;
293
487
  uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
294
488
  /** Path Key */
@@ -328,10 +522,10 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<{
328
522
  in: "path" | "query" | "header" | "cookie";
329
523
  deprecated: boolean;
330
524
  description?: string | undefined;
525
+ example?: unknown;
331
526
  schema?: unknown;
332
527
  content?: unknown;
333
528
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
334
- example?: unknown;
335
529
  examples?: Record<string, {
336
530
  value?: unknown;
337
531
  summary?: string | undefined;
@@ -363,11 +557,11 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<{
363
557
  in: "path" | "query" | "header" | "cookie";
364
558
  required?: boolean | undefined;
365
559
  description?: string | undefined;
560
+ example?: unknown;
366
561
  deprecated?: boolean | undefined;
367
562
  schema?: unknown;
368
563
  content?: unknown;
369
564
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
370
- example?: unknown;
371
565
  examples?: Record<string, {
372
566
  value?: unknown;
373
567
  summary?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/requests.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAIxD,eAAO,MAAM,cAAc,2FAUjB,CAAA;AAEV,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,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;;IAEvB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE0B,CAAA;AA0BnD,8CAA8C;AAC9C,eAAO,MAAM,aAAa;IAxExB;;;;;OAKG;;IAEH,kDAAkD;;IAElD,mHAAmH;;IAEnH;;;;OAIG;;IAEH;;;;;;OAMG;;IAEH;;;;;OAKG;;IAEH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEH;;OAEG;;;;;;;;;;;;IAGH,uBAAuB;;IAEvB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAcvB,eAAe;;IAEf,qBAAqB;;IAErB,kDAAkD;;IAElD,oCAAoC;;IAEpC,uDAAuD;;IAEvD,+DAA+D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOlC,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 { z } from 'zod';
2
2
  import { oasParameterSchema } from './parameters.js';
3
+ import { xScalarExampleSchema } from './request-examples.js';
3
4
  import { oasSecurityRequirementSchema } from './security.js';
4
5
  import { oasExternalDocumentationSchema } from './spec-objects.js';
5
6
  import { nanoidSchema } from '../shared/utility.js';
@@ -24,17 +25,17 @@ const oasRequestSchema = z.object({
24
25
  *
25
26
  * These tags are the openapi spec tag names, not uids
26
27
  */
27
- tags: z.string().array().optional(),
28
+ 'tags': z.string().array().optional(),
28
29
  /** A short summary of what the operation does. */
29
- summary: z.string().optional(),
30
+ 'summary': z.string().optional(),
30
31
  /** A verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation. */
31
- description: z.string().optional(),
32
+ 'description': z.string().optional(),
32
33
  /**
33
34
  * Unique string used to identify the operation. The id MUST be unique among all operations described in the API.
34
35
  * The operationId value is case-sensitive. Tools and libraries MAY use the operationId to uniquely identify an
35
36
  * operation, therefore, it is RECOMMENDED to follow bin common programming naming conventions./
36
37
  */
37
- operationId: z.string().optional(),
38
+ 'operationId': z.string().optional(),
38
39
  /**
39
40
  * A declaration of which security mechanisms can be used across the API. The list of
40
41
  * values includes alternative security requirement objects that can be used. Only
@@ -42,25 +43,27 @@ const oasRequestSchema = z.object({
42
43
  * Individual operations can override this definition. To make security optional, an empty
43
44
  * security requirement ({}) can be included in the array.
44
45
  */
45
- security: z.array(oasSecurityRequirementSchema).optional(),
46
+ 'security': z.array(oasSecurityRequirementSchema).optional(),
46
47
  /**
47
48
  * The request body applicable for this operation. The requestBody is fully supported in HTTP methods where the
48
49
  * HTTP 1.1 specification [RFC7231] has explicitly defined semantics for request bodies. In other cases where the
49
50
  * HTTP spec is vague (such as GET, HEAD and DELETE), requestBody is permitted but does not have well-defined
50
51
  * semantics and SHOULD be avoided if possible.
51
52
  */
52
- requestBody: requestBodySchema.optional(),
53
+ 'requestBody': requestBodySchema.optional(),
53
54
  /**
54
55
  * Request parameters
55
56
  */
56
- parameters: oasParameterSchema.array().optional(),
57
+ 'parameters': oasParameterSchema.array().optional(),
57
58
  /**
58
59
  * External documentation object
59
60
  */
60
- externalDocs: oasExternalDocumentationSchema.optional(),
61
- deprecated: z.boolean().optional(),
61
+ 'externalDocs': oasExternalDocumentationSchema.optional(),
62
+ 'deprecated': z.boolean().optional(),
62
63
  /** Response formats */
63
- responses: z.record(z.string(), z.any()).optional(),
64
+ 'responses': z.record(z.string(), z.any()).optional(),
65
+ /** xScalar examples */
66
+ 'x-scalar-examples': z.record(z.string(), xScalarExampleSchema).optional(),
64
67
  });
65
68
  /**
66
69
  * Extended properties added to the spec definition for client usage
@@ -86,6 +89,8 @@ const extendedRequestSchema = z.object({
86
89
  selectedSecuritySchemeUids: nanoidSchema.array().default([]),
87
90
  });
88
91
  /** Unified request schema for client usage */
89
- const requestSchema = oasRequestSchema.merge(extendedRequestSchema);
92
+ const requestSchema = oasRequestSchema
93
+ .omit({ 'x-scalar-examples': true })
94
+ .merge(extendedRequestSchema);
90
95
 
91
96
  export { oasRequestSchema, requestMethods, requestSchema };
@@ -37,10 +37,10 @@ export declare const oasServerSchema: z.ZodObject<{
37
37
  }> | undefined;
38
38
  }, {
39
39
  description?: string | undefined;
40
- url?: string | undefined;
41
40
  variables?: Record<string, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
42
41
  enum?: [string, ...string[]];
43
42
  }> | undefined;
43
+ url?: string | undefined;
44
44
  }>;
45
45
  export declare const serverSchema: z.ZodObject<z.objectUtil.extendShape<{
46
46
  /**
@@ -72,10 +72,10 @@ export declare const serverSchema: z.ZodObject<z.objectUtil.extendShape<{
72
72
  }, {
73
73
  uid?: string | undefined;
74
74
  description?: string | undefined;
75
- url?: string | undefined;
76
75
  variables?: Record<string, Omit<OpenAPIV3_1.ServerVariableObject, "enum"> & {
77
76
  enum?: [string, ...string[]];
78
77
  }> | undefined;
78
+ url?: string | undefined;
79
79
  }>;
80
80
  export type Server = z.infer<typeof serverSchema>;
81
81
  export type ServerPayload = z.input<typeof serverSchema>;