@scalar/oas-utils 0.2.143 → 0.3.1
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 +35 -0
- package/dist/entities/spec/index.d.ts +1 -0
- package/dist/entities/spec/index.d.ts.map +1 -1
- package/dist/entities/spec/index.js.map +1 -1
- package/dist/entities/spec/operation.d.ts +10 -1
- package/dist/entities/spec/operation.d.ts.map +1 -1
- package/dist/entities/spec/parameters.d.ts +3 -0
- package/dist/entities/spec/parameters.d.ts.map +1 -1
- package/dist/entities/spec/parameters.js +1 -0
- package/dist/entities/spec/parameters.js.map +2 -2
- package/dist/entities/spec/parameters.test.js +9 -0
- package/dist/entities/spec/parameters.test.js.map +2 -2
- package/dist/entities/spec/requests.d.ts +27 -8
- package/dist/entities/spec/requests.d.ts.map +1 -1
- package/dist/entities/spec/requests.js +6 -2
- package/dist/entities/spec/requests.js.map +2 -2
- package/dist/helpers/security/get-schemes.d.ts +2 -2
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @scalar/oas-utils
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4440949: chore: bumping packages
|
|
8
|
+
- Updated dependencies [4440949]
|
|
9
|
+
- @scalar/object-utils@1.2.1
|
|
10
|
+
- @scalar/openapi-types@0.3.1
|
|
11
|
+
- @scalar/types@0.2.1
|
|
12
|
+
- @scalar/themes@0.12.1
|
|
13
|
+
|
|
14
|
+
## 0.3.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- 483ca93: chore: require Node 20 (or above)
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 30bab1d: support unexploded serialization of array query params
|
|
23
|
+
- Updated dependencies [5613e40]
|
|
24
|
+
- Updated dependencies [483ca93]
|
|
25
|
+
- @scalar/themes@0.12.0
|
|
26
|
+
- @scalar/openapi-types@0.3.0
|
|
27
|
+
- @scalar/object-utils@1.2.0
|
|
28
|
+
- @scalar/types@0.2.0
|
|
29
|
+
|
|
30
|
+
## 0.2.144
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [be8a6ec]
|
|
35
|
+
- @scalar/types@0.1.16
|
|
36
|
+
- @scalar/themes@0.11.3
|
|
37
|
+
|
|
3
38
|
## 0.2.143
|
|
4
39
|
|
|
5
40
|
### Patch Changes
|
|
@@ -8,4 +8,5 @@ export { type Operation, type OperationPayload, operationSchema, } from './opera
|
|
|
8
8
|
export { xScalarEnvironmentsSchema, type XScalarEnvironment, type XScalarEnvironments, } from './x-scalar-environments.js';
|
|
9
9
|
/** Re-exported here for ease of use but we should use the other ones directly */
|
|
10
10
|
export { type Oauth2Flow, type Oauth2FlowPayload, type SecuritySchemaHttp, type SecuritySchemaOpenId, type SecurityScheme, type SecuritySchemeApiKey, type SecuritySchemeOauth2, type SecuritySchemeOauth2Payload, type SecuritySchemePayload, oasSecurityRequirementSchema, oasSecuritySchemeSchema, pkceOptions, securityApiKeySchema, securityHttpSchema, securityOauthSchema, securityOpenIdSchema, securitySchemeSchema, } from '@scalar/types/entities';
|
|
11
|
+
export type { PostResponseScript, PostResponseScripts, } from './requests.ts';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACxF,OAAO,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAA;AACtG,OAAO,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAA;AACxE,OAAO,EACL,aAAa,EACb,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,GAClB,MAAM,YAAY,CAAA;AAEnB,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,8BAA8B,EAC9B,KAAK,cAAc,EACnB,KAAK,uBAAuB,GAC7B,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,SAAS,EACT,8BAA8B,EAC9B,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,GAAG,EACR,KAAK,UAAU,GAChB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EACL,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,eAAe,GAChB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,yBAAyB,CAAA;AAEhC,iFAAiF;AACjF,OAAO,EACL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAC1B,4BAA4B,EAC5B,uBAAuB,EACvB,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,wBAAwB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACxF,OAAO,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAA;AACtG,OAAO,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAA;AACxE,OAAO,EACL,aAAa,EACb,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,GAClB,MAAM,YAAY,CAAA;AAEnB,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,8BAA8B,EAC9B,KAAK,cAAc,EACnB,KAAK,uBAAuB,GAC7B,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,SAAS,EACT,8BAA8B,EAC9B,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,GAAG,EACR,KAAK,UAAU,GAChB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EACL,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,eAAe,GAChB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,yBAAyB,CAAA;AAEhC,iFAAiF;AACjF,OAAO,EACL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAC1B,4BAA4B,EAC5B,uBAAuB,EACvB,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,wBAAwB,CAAA;AAE/B,YAAY,EACV,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,eAAe,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/entities/spec/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { collectionSchema, type Collection, type CollectionPayload } from './collection'\nexport { oasParameterSchema, type RequestParameter, type RequestParameterPayload } from './parameters'\nexport { serverSchema, type Server, type ServerPayload } from './server'\nexport {\n requestSchema,\n type Request,\n type RequestPayload,\n type RequestMethod,\n type ResponseInstance,\n type RequestEvent,\n} from './requests'\n\nexport {\n requestExampleSchema,\n createExampleFromRequest,\n requestExampleParametersSchema,\n type RequestExample,\n type RequestExampleParameter,\n} from './request-examples'\n\nexport {\n tagSchema,\n oasExternalDocumentationSchema,\n oasInfoSchema,\n oasContactSchema,\n oasLicenseSchema,\n type Tag,\n type TagPayload,\n} from './spec-objects'\n\nexport {\n type Operation,\n type OperationPayload,\n operationSchema,\n} from './operation'\n\nexport {\n xScalarEnvironmentsSchema,\n type XScalarEnvironment,\n type XScalarEnvironments,\n} from './x-scalar-environments'\n\n/** Re-exported here for ease of use but we should use the other ones directly */\nexport {\n type Oauth2Flow,\n type Oauth2FlowPayload,\n type SecuritySchemaHttp,\n type SecuritySchemaOpenId,\n type SecurityScheme,\n type SecuritySchemeApiKey,\n type SecuritySchemeOauth2,\n type SecuritySchemeOauth2Payload,\n type SecuritySchemePayload,\n oasSecurityRequirementSchema,\n oasSecuritySchemeSchema,\n pkceOptions,\n securityApiKeySchema,\n securityHttpSchema,\n securityOauthSchema,\n securityOpenIdSchema,\n securitySchemeSchema,\n} from '@scalar/types/entities'\n"],
|
|
4
|
+
"sourcesContent": ["export { collectionSchema, type Collection, type CollectionPayload } from './collection'\nexport { oasParameterSchema, type RequestParameter, type RequestParameterPayload } from './parameters'\nexport { serverSchema, type Server, type ServerPayload } from './server'\nexport {\n requestSchema,\n type Request,\n type RequestPayload,\n type RequestMethod,\n type ResponseInstance,\n type RequestEvent,\n} from './requests'\n\nexport {\n requestExampleSchema,\n createExampleFromRequest,\n requestExampleParametersSchema,\n type RequestExample,\n type RequestExampleParameter,\n} from './request-examples'\n\nexport {\n tagSchema,\n oasExternalDocumentationSchema,\n oasInfoSchema,\n oasContactSchema,\n oasLicenseSchema,\n type Tag,\n type TagPayload,\n} from './spec-objects'\n\nexport {\n type Operation,\n type OperationPayload,\n operationSchema,\n} from './operation'\n\nexport {\n xScalarEnvironmentsSchema,\n type XScalarEnvironment,\n type XScalarEnvironments,\n} from './x-scalar-environments'\n\n/** Re-exported here for ease of use but we should use the other ones directly */\nexport {\n type Oauth2Flow,\n type Oauth2FlowPayload,\n type SecuritySchemaHttp,\n type SecuritySchemaOpenId,\n type SecurityScheme,\n type SecuritySchemeApiKey,\n type SecuritySchemeOauth2,\n type SecuritySchemeOauth2Payload,\n type SecuritySchemePayload,\n oasSecurityRequirementSchema,\n oasSecuritySchemeSchema,\n pkceOptions,\n securityApiKeySchema,\n securityHttpSchema,\n securityOauthSchema,\n securityOpenIdSchema,\n securitySchemeSchema,\n} from '@scalar/types/entities'\n\nexport type {\n PostResponseScript,\n PostResponseScripts,\n} from './requests.ts'\n"],
|
|
5
5
|
"mappings": "AAAA,SAAS,wBAAiE;AAC1E,SAAS,0BAA+E;AACxF,SAAS,oBAAqD;AAC9D;AAAA,EACE;AAAA,OAMK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAEP;AAAA,EAGE;AAAA,OACK;AAEP;AAAA,EACE;AAAA,OAGK;AAGP;AAAA,EAUE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -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<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<Omit<{
|
|
8
|
+
export declare const operationSchema: import("zod").ZodObject<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<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>;
|
|
@@ -21,6 +21,7 @@ export declare const operationSchema: import("zod").ZodObject<import("zod").obje
|
|
|
21
21
|
schema: import("zod").ZodOptional<import("zod").ZodUnknown>;
|
|
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
|
+
explode: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
24
25
|
example: import("zod").ZodOptional<import("zod").ZodUnknown>;
|
|
25
26
|
examples: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
|
26
27
|
value: import("zod").ZodOptional<import("zod").ZodUnknown>;
|
|
@@ -50,6 +51,7 @@ export declare const operationSchema: import("zod").ZodObject<import("zod").obje
|
|
|
50
51
|
schema?: unknown;
|
|
51
52
|
content?: unknown;
|
|
52
53
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
54
|
+
explode?: boolean | undefined;
|
|
53
55
|
}, {
|
|
54
56
|
name: string;
|
|
55
57
|
in: "cookie" | "path" | "query" | "header";
|
|
@@ -65,6 +67,7 @@ export declare const operationSchema: import("zod").ZodObject<import("zod").obje
|
|
|
65
67
|
schema?: unknown;
|
|
66
68
|
content?: unknown;
|
|
67
69
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
70
|
+
explode?: boolean | undefined;
|
|
68
71
|
}>, "many">>;
|
|
69
72
|
externalDocs: import("zod").ZodOptional<import("zod").ZodEffects<import("zod").ZodObject<{
|
|
70
73
|
description: import("zod").ZodCatch<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
@@ -216,6 +219,8 @@ export declare const operationSchema: import("zod").ZodObject<import("zod").obje
|
|
|
216
219
|
selectedServerUid: import("zod").ZodDefault<import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodBranded<import("zod").ZodString, "server">>>>;
|
|
217
220
|
examples: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodBranded<import("zod").ZodString, "example">, "many">>;
|
|
218
221
|
selectedSecuritySchemeUids: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodBranded<import("zod").ZodString, "securityScheme">, import("zod").ZodArray<import("zod").ZodBranded<import("zod").ZodString, "securityScheme">, "many">]>, "many">>;
|
|
222
|
+
}>, {
|
|
223
|
+
'x-post-response': import("zod").ZodOptional<import("zod").ZodString>;
|
|
219
224
|
}>, "strip", import("zod").ZodTypeAny, {
|
|
220
225
|
uid: string & import("zod").BRAND<"operation">;
|
|
221
226
|
path: string;
|
|
@@ -252,10 +257,12 @@ export declare const operationSchema: import("zod").ZodObject<import("zod").obje
|
|
|
252
257
|
schema?: unknown;
|
|
253
258
|
content?: unknown;
|
|
254
259
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
260
|
+
explode?: boolean | undefined;
|
|
255
261
|
}[] | undefined;
|
|
256
262
|
requestBody?: any;
|
|
257
263
|
responses?: Record<string, any> | undefined;
|
|
258
264
|
'x-scalar-stability'?: import("@scalar/types").XScalarStability | undefined;
|
|
265
|
+
'x-post-response'?: string | undefined;
|
|
259
266
|
'x-codeSamples'?: {
|
|
260
267
|
source: string;
|
|
261
268
|
label?: string | undefined;
|
|
@@ -306,11 +313,13 @@ export declare const operationSchema: import("zod").ZodObject<import("zod").obje
|
|
|
306
313
|
schema?: unknown;
|
|
307
314
|
content?: unknown;
|
|
308
315
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
316
|
+
explode?: boolean | undefined;
|
|
309
317
|
}[] | undefined;
|
|
310
318
|
requestBody?: any;
|
|
311
319
|
responses?: Record<string, any> | undefined;
|
|
312
320
|
'x-scalar-stability'?: unknown;
|
|
313
321
|
method?: "options" | "connect" | "delete" | "get" | "head" | "patch" | "post" | "put" | "trace" | undefined;
|
|
322
|
+
'x-post-response'?: string | undefined;
|
|
314
323
|
'x-codeSamples'?: unknown;
|
|
315
324
|
'x-code-samples'?: unknown;
|
|
316
325
|
'x-custom-examples'?: unknown;
|
|
@@ -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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aACwV,CAAC;YAAkC,CAAC;;;aAAoE,CAAC;YAAuB,CAAC;;;;;;;;aAAqT,CAAC;YAAkC,CAAC;;;aAAoE,CAAC;YAAuB,CAAC;;;;;;;;aAAwT,CAAC;YAAkC,CAAC;;;aAAoE,CAAC;YAAuB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EADxzC,CAAA"}
|
|
@@ -26,6 +26,7 @@ export declare const oasParameterSchema: z.ZodObject<{
|
|
|
26
26
|
content: z.ZodOptional<z.ZodUnknown>;
|
|
27
27
|
/** Defaulted according to @url https://spec.openapis.org/oas/v3.1.0#parameter-object */
|
|
28
28
|
style: z.ZodOptional<z.ZodEnum<["matrix", "simple", "form", "label", "spaceDelimited", "pipeDelimited", "deepObject"]>>;
|
|
29
|
+
explode: z.ZodOptional<z.ZodBoolean>;
|
|
29
30
|
example: z.ZodOptional<z.ZodUnknown>;
|
|
30
31
|
examples: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
31
32
|
value: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -55,6 +56,7 @@ export declare const oasParameterSchema: z.ZodObject<{
|
|
|
55
56
|
schema?: unknown;
|
|
56
57
|
content?: unknown;
|
|
57
58
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
59
|
+
explode?: boolean | undefined;
|
|
58
60
|
}, {
|
|
59
61
|
name: string;
|
|
60
62
|
in: "cookie" | "path" | "query" | "header";
|
|
@@ -70,6 +72,7 @@ export declare const oasParameterSchema: z.ZodObject<{
|
|
|
70
72
|
schema?: unknown;
|
|
71
73
|
content?: unknown;
|
|
72
74
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
75
|
+
explode?: boolean | undefined;
|
|
73
76
|
}>;
|
|
74
77
|
export type RequestParameter = z.infer<typeof oasParameterSchema>;
|
|
75
78
|
export type RequestParameterPayload = z.input<typeof oasParameterSchema>;
|
|
@@ -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;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAEjE,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;AACjE,MAAM,MAAM,gBAAgB,GAAG,MAAM,CACnC,MAAM,EACN;IACE,MAAM,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAA;IAClD,OAAO,CAAC,EAAE,uBAAuB,CAAA;CAClC,CACF,CAAA;AACD,eAAO,MAAM,sBAAsB,cAAc,CAAA;AAEjD;;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;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAEjE,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;AACjE,MAAM,MAAM,gBAAgB,GAAG,MAAM,CACnC,MAAM,EACN;IACE,MAAM,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAA;IAClD,OAAO,CAAC,EAAE,uBAAuB,CAAA;CAClC,CACF,CAAA;AACD,eAAO,MAAM,sBAAsB,cAAc,CAAA;AAEjD;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;IAI7B,yBAAyB;;IAEzB,yBAAyB;;;;IAIzB,wFAAwF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBjD,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"}
|
|
@@ -22,6 +22,7 @@ const oasParameterSchema = z.object({
|
|
|
22
22
|
content: z.unknown().optional(),
|
|
23
23
|
/** Defaulted according to @url https://spec.openapis.org/oas/v3.1.0#parameter-object */
|
|
24
24
|
style: parameterStyleSchema.optional(),
|
|
25
|
+
explode: z.boolean().optional(),
|
|
25
26
|
example: z.unknown().optional(),
|
|
26
27
|
examples: z.union([
|
|
27
28
|
z.record(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/entities/spec/parameters.ts"],
|
|
4
|
-
"sourcesContent": ["import type { OpenAPI } from '@scalar/openapi-types'\nimport { type ZodSchema, z } from 'zod'\nimport type { OpenAPIV3_1 } from '@scalar/openapi-types'\nimport type { RequestExampleParameter } from './request-examples'\n\nexport const parameterTypeSchema = z.enum(['path', 'query', 'header', 'cookie'])\nexport type ParamType = z.infer<typeof parameterTypeSchema>\n\nexport const parameterStyleSchema = z.enum([\n 'matrix',\n 'simple',\n 'form',\n 'label',\n 'spaceDelimited',\n 'pipeDelimited',\n 'deepObject',\n])\nexport type ParameterStyle = z.infer<typeof parameterStyleSchema>\nexport type ParameterContent = Record<\n string,\n {\n schema?: OpenAPIV3_1.Document\n examples?: Record<string, RequestExampleParameter>\n example?: RequestExampleParameter\n }\n>\nexport const parameterExampleSchema = z.unknown()\n\n/**\n * OpenAPI compliant parameters object\n */\nexport const oasParameterSchema = z.object({\n in: parameterTypeSchema,\n name: z.string(),\n description: z.string().optional(),\n /** Defaulted to false */\n required: z.boolean().optional().default(false),\n /** Defaulted to false */\n deprecated: z.boolean().optional().default(false),\n schema: z.unknown().optional(),\n content: z.unknown().optional(),\n /** Defaulted according to @url https://spec.openapis.org/oas/v3.1.0#parameter-object */\n style: parameterStyleSchema.optional(),\n example: z.unknown().optional(),\n examples: z\n .union([\n z.record(\n z.string(),\n z.object({\n value: z.unknown().optional(),\n summary: z.string().optional(),\n externalValue: z.string().optional(),\n }),\n ),\n z.array(z.unknown()),\n ])\n .optional(),\n}) satisfies ZodSchema<OpenAPI.Parameter>\n\nexport type RequestParameter = z.infer<typeof oasParameterSchema>\nexport type RequestParameterPayload = z.input<typeof oasParameterSchema>\n"],
|
|
5
|
-
"mappings": "AACA,SAAyB,SAAS;AAI3B,MAAM,sBAAsB,EAAE,KAAK,CAAC,QAAQ,SAAS,UAAU,QAAQ,CAAC;AAGxE,MAAM,uBAAuB,EAAE,KAAK;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAUM,MAAM,yBAAyB,EAAE,QAAQ;AAKzC,MAAM,qBAAqB,EAAE,OAAO;AAAA,EACzC,IAAI;AAAA,EACJ,MAAM,EAAE,OAAO;AAAA,EACf,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAEjC,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,KAAK;AAAA;AAAA,EAE9C,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,KAAK;AAAA,EAChD,QAAQ,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC7B,SAAS,EAAE,QAAQ,EAAE,SAAS;AAAA;AAAA,EAE9B,OAAO,qBAAqB,SAAS;AAAA,EACrC,SAAS,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC9B,UAAU,EACP,MAAM;AAAA,IACL,EAAE;AAAA,MACA,EAAE,OAAO;AAAA,MACT,EAAE,OAAO;AAAA,QACP,OAAO,EAAE,QAAQ,EAAE,SAAS;AAAA,QAC5B,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,QAC7B,eAAe,EAAE,OAAO,EAAE,SAAS;AAAA,MACrC,CAAC;AAAA,IACH;AAAA,IACA,EAAE,MAAM,EAAE,QAAQ,CAAC;AAAA,EACrB,CAAC,EACA,SAAS;AACd,CAAC;",
|
|
4
|
+
"sourcesContent": ["import type { OpenAPI } from '@scalar/openapi-types'\nimport { type ZodSchema, z } from 'zod'\nimport type { OpenAPIV3_1 } from '@scalar/openapi-types'\nimport type { RequestExampleParameter } from './request-examples'\n\nexport const parameterTypeSchema = z.enum(['path', 'query', 'header', 'cookie'])\nexport type ParamType = z.infer<typeof parameterTypeSchema>\n\nexport const parameterStyleSchema = z.enum([\n 'matrix',\n 'simple',\n 'form',\n 'label',\n 'spaceDelimited',\n 'pipeDelimited',\n 'deepObject',\n])\nexport type ParameterStyle = z.infer<typeof parameterStyleSchema>\nexport type ParameterContent = Record<\n string,\n {\n schema?: OpenAPIV3_1.Document\n examples?: Record<string, RequestExampleParameter>\n example?: RequestExampleParameter\n }\n>\nexport const parameterExampleSchema = z.unknown()\n\n/**\n * OpenAPI compliant parameters object\n */\nexport const oasParameterSchema = z.object({\n in: parameterTypeSchema,\n name: z.string(),\n description: z.string().optional(),\n /** Defaulted to false */\n required: z.boolean().optional().default(false),\n /** Defaulted to false */\n deprecated: z.boolean().optional().default(false),\n schema: z.unknown().optional(),\n content: z.unknown().optional(),\n /** Defaulted according to @url https://spec.openapis.org/oas/v3.1.0#parameter-object */\n style: parameterStyleSchema.optional(),\n explode: z.boolean().optional(),\n example: z.unknown().optional(),\n examples: z\n .union([\n z.record(\n z.string(),\n z.object({\n value: z.unknown().optional(),\n summary: z.string().optional(),\n externalValue: z.string().optional(),\n }),\n ),\n z.array(z.unknown()),\n ])\n .optional(),\n}) satisfies ZodSchema<OpenAPI.Parameter>\n\nexport type RequestParameter = z.infer<typeof oasParameterSchema>\nexport type RequestParameterPayload = z.input<typeof oasParameterSchema>\n"],
|
|
5
|
+
"mappings": "AACA,SAAyB,SAAS;AAI3B,MAAM,sBAAsB,EAAE,KAAK,CAAC,QAAQ,SAAS,UAAU,QAAQ,CAAC;AAGxE,MAAM,uBAAuB,EAAE,KAAK;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAUM,MAAM,yBAAyB,EAAE,QAAQ;AAKzC,MAAM,qBAAqB,EAAE,OAAO;AAAA,EACzC,IAAI;AAAA,EACJ,MAAM,EAAE,OAAO;AAAA,EACf,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAEjC,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,KAAK;AAAA;AAAA,EAE9C,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,KAAK;AAAA,EAChD,QAAQ,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC7B,SAAS,EAAE,QAAQ,EAAE,SAAS;AAAA;AAAA,EAE9B,OAAO,qBAAqB,SAAS;AAAA,EACrC,SAAS,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC9B,SAAS,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC9B,UAAU,EACP,MAAM;AAAA,IACL,EAAE;AAAA,MACA,EAAE,OAAO;AAAA,MACT,EAAE,OAAO;AAAA,QACP,OAAO,EAAE,QAAQ,EAAE,SAAS;AAAA,QAC5B,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,QAC7B,eAAe,EAAE,OAAO,EAAE,SAAS;AAAA,MACrC,CAAC;AAAA,IACH;AAAA,IACA,EAAE,MAAM,EAAE,QAAQ,CAAC;AAAA,EACrB,CAAC,EACA,SAAS;AACd,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -67,5 +67,14 @@ describe("oasParameterSchema", () => {
|
|
|
67
67
|
};
|
|
68
68
|
expect(() => oasParameterSchema.parse(validParameter)).not.toThrow();
|
|
69
69
|
});
|
|
70
|
+
it("should validate examples with the explode property", () => {
|
|
71
|
+
const validParameter = {
|
|
72
|
+
in: "query",
|
|
73
|
+
name: "galaxy",
|
|
74
|
+
examples: ["Milky Way", "Andromeda"],
|
|
75
|
+
explode: true
|
|
76
|
+
};
|
|
77
|
+
expect(() => oasParameterSchema.parse(validParameter)).not.toThrow();
|
|
78
|
+
});
|
|
70
79
|
});
|
|
71
80
|
//# sourceMappingURL=parameters.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/entities/spec/parameters.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { oasParameterSchema } from '@/entities/spec/parameters'\nimport { describe, expect, it } from 'vitest'\nimport { z } from 'zod'\n\ndescribe('oasParameterSchema', () => {\n it('should validate a parameter with a correct example', () => {\n const validParameterWithExample = {\n in: 'query',\n name: 'limit',\n example: 10,\n }\n\n expect(() => oasParameterSchema.parse(validParameterWithExample)).not.toThrow()\n })\n\n it('should validate examples as a record with correct structure', () => {\n const validExamples = {\n milkyWay: {\n value: 'Milky Way',\n summary: 'Our galaxy',\n },\n andromeda: {\n value: 'Andromeda',\n summary: 'Nearest major galaxy',\n },\n }\n\n const validParameter = {\n in: 'query',\n name: 'galaxy',\n examples: validExamples,\n }\n\n expect(() => oasParameterSchema.parse(validParameter)).not.toThrow()\n })\n\n it('should fail validation if examples have incorrect structure', () => {\n const invalidExamples = {\n milkyWay: {\n value: 'Milky Way',\n // Summary is optional, so this should not cause a failure\n },\n andromeda: 'This should be an object, not a string',\n }\n\n const invalidParameter = {\n in: 'query',\n name: 'galaxy',\n examples: invalidExamples,\n }\n\n expect(() => oasParameterSchema.parse(invalidParameter)).toThrow(z.ZodError)\n })\n\n it('should validate examples as an array', () => {\n const validParameter = {\n in: 'query',\n name: 'galaxy',\n examples: ['Milky Way', 'Andromeda'],\n }\n\n expect(() => oasParameterSchema.parse(validParameter)).not.toThrow()\n })\n\n it('should validate examples with a single array item', () => {\n const validParameter = {\n in: 'query',\n name: 'galaxy',\n examples: ['Milky Way'],\n }\n\n expect(() => oasParameterSchema.parse(validParameter)).not.toThrow()\n })\n\n it('should validate with an empty array of examples', () => {\n const validParameter = {\n in: 'query',\n name: 'galaxy',\n examples: [],\n }\n\n expect(() => oasParameterSchema.parse(validParameter)).not.toThrow()\n })\n})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,0BAA0B;AACnC,SAAS,UAAU,QAAQ,UAAU;AACrC,SAAS,SAAS;AAElB,SAAS,sBAAsB,MAAM;AACnC,KAAG,sDAAsD,MAAM;AAC7D,UAAM,4BAA4B;AAAA,MAChC,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAEA,WAAO,MAAM,mBAAmB,MAAM,yBAAyB,CAAC,EAAE,IAAI,QAAQ;AAAA,EAChF,CAAC;AAED,KAAG,+DAA+D,MAAM;AACtE,UAAM,gBAAgB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;",
|
|
4
|
+
"sourcesContent": ["import { oasParameterSchema } from '@/entities/spec/parameters'\nimport { describe, expect, it } from 'vitest'\nimport { z } from 'zod'\n\ndescribe('oasParameterSchema', () => {\n it('should validate a parameter with a correct example', () => {\n const validParameterWithExample = {\n in: 'query',\n name: 'limit',\n example: 10,\n }\n\n expect(() => oasParameterSchema.parse(validParameterWithExample)).not.toThrow()\n })\n\n it('should validate examples as a record with correct structure', () => {\n const validExamples = {\n milkyWay: {\n value: 'Milky Way',\n summary: 'Our galaxy',\n },\n andromeda: {\n value: 'Andromeda',\n summary: 'Nearest major galaxy',\n },\n }\n\n const validParameter = {\n in: 'query',\n name: 'galaxy',\n examples: validExamples,\n }\n\n expect(() => oasParameterSchema.parse(validParameter)).not.toThrow()\n })\n\n it('should fail validation if examples have incorrect structure', () => {\n const invalidExamples = {\n milkyWay: {\n value: 'Milky Way',\n // Summary is optional, so this should not cause a failure\n },\n andromeda: 'This should be an object, not a string',\n }\n\n const invalidParameter = {\n in: 'query',\n name: 'galaxy',\n examples: invalidExamples,\n }\n\n expect(() => oasParameterSchema.parse(invalidParameter)).toThrow(z.ZodError)\n })\n\n it('should validate examples as an array', () => {\n const validParameter = {\n in: 'query',\n name: 'galaxy',\n examples: ['Milky Way', 'Andromeda'],\n }\n\n expect(() => oasParameterSchema.parse(validParameter)).not.toThrow()\n })\n\n it('should validate examples with a single array item', () => {\n const validParameter = {\n in: 'query',\n name: 'galaxy',\n examples: ['Milky Way'],\n }\n\n expect(() => oasParameterSchema.parse(validParameter)).not.toThrow()\n })\n\n it('should validate with an empty array of examples', () => {\n const validParameter = {\n in: 'query',\n name: 'galaxy',\n examples: [],\n }\n\n expect(() => oasParameterSchema.parse(validParameter)).not.toThrow()\n })\n\n it('should validate examples with the explode property', () => {\n const validParameter = {\n in: 'query',\n name: 'galaxy',\n examples: ['Milky Way', 'Andromeda'],\n explode: true,\n }\n\n expect(() => oasParameterSchema.parse(validParameter)).not.toThrow()\n })\n})\n"],
|
|
5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;AAAA,MACJ,MAAM;AAAA,MACN,UAAU,CAAC,WAAW;AAAA,IACxB;AAEA,WAAO,MAAM,mBAAmB,MAAM,cAAc,CAAC,EAAE,IAAI,QAAQ;AAAA,EACrE,CAAC;AAED,KAAG,mDAAmD,MAAM;AAC1D,UAAM,iBAAiB;AAAA,MACrB,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,UAAU,CAAC;AAAA,IACb;AAEA,WAAO,MAAM,mBAAmB,MAAM,cAAc,CAAC,EAAE,IAAI,QAAQ;AAAA,EACrE,CAAC;AAED,KAAG,sDAAsD,MAAM;AAC7D,UAAM,iBAAiB;AAAA,MACrB,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,UAAU,CAAC,aAAa,WAAW;AAAA,MACnC,SAAS;AAAA,IACX;AAEA,WAAO,MAAM,mBAAmB,MAAM,cAAc,CAAC,EAAE,IAAI,QAAQ;AAAA,EACrE,CAAC;AACH,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { type PostResponseSchema, XPostResponseSchema } from '@scalar/openapi-types/schemas/extensions';
|
|
2
3
|
import { XScalarStability } from '@scalar/types';
|
|
3
4
|
import { type RequestExample } from './request-examples.js';
|
|
4
5
|
export declare const requestMethods: readonly ["connect", "delete", "get", "head", "options", "patch", "post", "put", "trace"];
|
|
@@ -13,6 +14,8 @@ export type ResponseInstance = Omit<Response, 'headers'> & {
|
|
|
13
14
|
duration: number;
|
|
14
15
|
/** The response status */
|
|
15
16
|
status: number;
|
|
17
|
+
/** The response status text */
|
|
18
|
+
statusText: string;
|
|
16
19
|
/** The response method */
|
|
17
20
|
method: RequestMethod;
|
|
18
21
|
/** The request path */
|
|
@@ -78,6 +81,7 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
78
81
|
schema: z.ZodOptional<z.ZodUnknown>;
|
|
79
82
|
content: z.ZodOptional<z.ZodUnknown>;
|
|
80
83
|
style: z.ZodOptional<z.ZodEnum<["matrix", "simple", "form", "label", "spaceDelimited", "pipeDelimited", "deepObject"]>>;
|
|
84
|
+
explode: z.ZodOptional<z.ZodBoolean>;
|
|
81
85
|
example: z.ZodOptional<z.ZodUnknown>;
|
|
82
86
|
examples: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
83
87
|
value: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -107,6 +111,7 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
107
111
|
schema?: unknown;
|
|
108
112
|
content?: unknown;
|
|
109
113
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
114
|
+
explode?: boolean | undefined;
|
|
110
115
|
}, {
|
|
111
116
|
name: string;
|
|
112
117
|
in: "cookie" | "path" | "query" | "header";
|
|
@@ -122,6 +127,7 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
122
127
|
schema?: unknown;
|
|
123
128
|
content?: unknown;
|
|
124
129
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
130
|
+
explode?: boolean | undefined;
|
|
125
131
|
}>, "many">>;
|
|
126
132
|
/**
|
|
127
133
|
* External documentation object
|
|
@@ -227,6 +233,7 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
227
233
|
}>>>;
|
|
228
234
|
/** Hide operations */
|
|
229
235
|
'x-internal': z.ZodOptional<z.ZodBoolean>;
|
|
236
|
+
/** Ignore operations */
|
|
230
237
|
'x-scalar-ignore': z.ZodOptional<z.ZodBoolean>;
|
|
231
238
|
}, "strip", z.ZodTypeAny, {
|
|
232
239
|
description?: string | undefined;
|
|
@@ -256,6 +263,7 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
256
263
|
schema?: unknown;
|
|
257
264
|
content?: unknown;
|
|
258
265
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
266
|
+
explode?: boolean | undefined;
|
|
259
267
|
}[] | undefined;
|
|
260
268
|
requestBody?: any;
|
|
261
269
|
responses?: Record<string, any> | undefined;
|
|
@@ -304,6 +312,7 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
304
312
|
schema?: unknown;
|
|
305
313
|
content?: unknown;
|
|
306
314
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
315
|
+
explode?: boolean | undefined;
|
|
307
316
|
}[] | undefined;
|
|
308
317
|
requestBody?: any;
|
|
309
318
|
responses?: Record<string, any> | undefined;
|
|
@@ -325,8 +334,10 @@ export declare const oasRequestSchema: z.ZodObject<{
|
|
|
325
334
|
} | undefined;
|
|
326
335
|
}> | undefined;
|
|
327
336
|
}>;
|
|
337
|
+
export type PostResponseScript = z.infer<typeof PostResponseSchema>;
|
|
338
|
+
export type PostResponseScripts = z.infer<typeof XPostResponseSchema>['x-post-response'];
|
|
328
339
|
/** Unified request schema for client usage */
|
|
329
|
-
export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<Omit<{
|
|
340
|
+
export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<Omit<{
|
|
330
341
|
/**
|
|
331
342
|
* A list of tags for API documentation control. Tags can be used for logical
|
|
332
343
|
* grouping of operations by resources or any other qualifier.
|
|
@@ -371,6 +382,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
371
382
|
schema: z.ZodOptional<z.ZodUnknown>;
|
|
372
383
|
content: z.ZodOptional<z.ZodUnknown>;
|
|
373
384
|
style: z.ZodOptional<z.ZodEnum<["matrix", "simple", "form", "label", "spaceDelimited", "pipeDelimited", "deepObject"]>>;
|
|
385
|
+
explode: z.ZodOptional<z.ZodBoolean>;
|
|
374
386
|
example: z.ZodOptional<z.ZodUnknown>;
|
|
375
387
|
examples: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
376
388
|
value: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -400,6 +412,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
400
412
|
schema?: unknown;
|
|
401
413
|
content?: unknown;
|
|
402
414
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
415
|
+
explode?: boolean | undefined;
|
|
403
416
|
}, {
|
|
404
417
|
name: string;
|
|
405
418
|
in: "cookie" | "path" | "query" | "header";
|
|
@@ -415,6 +428,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
415
428
|
schema?: unknown;
|
|
416
429
|
content?: unknown;
|
|
417
430
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
431
|
+
explode?: boolean | undefined;
|
|
418
432
|
}>, "many">>;
|
|
419
433
|
/**
|
|
420
434
|
* External documentation object
|
|
@@ -520,6 +534,7 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
520
534
|
}>>>;
|
|
521
535
|
/** Hide operations */
|
|
522
536
|
'x-internal': z.ZodOptional<z.ZodBoolean>;
|
|
537
|
+
/** Ignore operations */
|
|
523
538
|
'x-scalar-ignore': z.ZodOptional<z.ZodBoolean>;
|
|
524
539
|
}, "x-scalar-examples">, {
|
|
525
540
|
'x-codeSamples': z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -535,23 +550,21 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
535
550
|
label?: unknown;
|
|
536
551
|
lang?: unknown;
|
|
537
552
|
}>, "many">>>;
|
|
538
|
-
'x-code-samples': z.ZodCatch<z.ZodOptional<z.ZodArray
|
|
553
|
+
'x-code-samples': z.ZodCatch<z.ZodOptional<z.ZodArray /** Store headers as an object to match what we had with axios */<z.ZodObject<{
|
|
539
554
|
lang: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
540
|
-
label: z.ZodCatch<z.ZodOptional<z.ZodString
|
|
555
|
+
label: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
541
556
|
source: z.ZodString;
|
|
542
557
|
}, "strip", z.ZodTypeAny, {
|
|
543
558
|
source: string;
|
|
544
|
-
label
|
|
559
|
+
label?: string | undefined;
|
|
545
560
|
lang?: string | undefined;
|
|
546
561
|
}, {
|
|
547
562
|
source: string;
|
|
548
563
|
label?: unknown;
|
|
549
564
|
lang?: unknown;
|
|
550
565
|
}>, "many">>>;
|
|
551
|
-
'x-custom-examples': z.ZodCatch<z.ZodOptional<z.ZodArray
|
|
552
|
-
lang:
|
|
553
|
-
/** A stream reader for a streamable response body */
|
|
554
|
-
z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
566
|
+
'x-custom-examples': z.ZodCatch<z.ZodOptional<z.ZodArray /** The response data */<z.ZodObject<{
|
|
567
|
+
lang: z.ZodCatch<z.ZodOptional<z.ZodString /** The response size in bytes */>>;
|
|
555
568
|
label: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
556
569
|
source: z.ZodString;
|
|
557
570
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -580,6 +593,8 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
580
593
|
examples: z.ZodDefault<z.ZodArray<z.ZodBranded<z.ZodString, "example">, "many">>;
|
|
581
594
|
/** List of security scheme UIDs associated with the request */
|
|
582
595
|
selectedSecuritySchemeUids: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodBranded<z.ZodString, "securityScheme">, z.ZodArray<z.ZodBranded<z.ZodString, "securityScheme">, "many">]>, "many">>;
|
|
596
|
+
}>, {
|
|
597
|
+
'x-post-response': z.ZodOptional<z.ZodString>;
|
|
583
598
|
}>, "strip", z.ZodTypeAny, {
|
|
584
599
|
uid: string & z.BRAND<"operation">;
|
|
585
600
|
path: string;
|
|
@@ -616,10 +631,12 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
616
631
|
schema?: unknown;
|
|
617
632
|
content?: unknown;
|
|
618
633
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
634
|
+
explode?: boolean | undefined;
|
|
619
635
|
}[] | undefined;
|
|
620
636
|
requestBody?: any;
|
|
621
637
|
responses?: Record<string, any> | undefined;
|
|
622
638
|
'x-scalar-stability'?: XScalarStability | undefined;
|
|
639
|
+
'x-post-response'?: string | undefined;
|
|
623
640
|
'x-codeSamples'?: {
|
|
624
641
|
source: string;
|
|
625
642
|
label?: string | undefined;
|
|
@@ -670,11 +687,13 @@ export declare const requestSchema: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
670
687
|
schema?: unknown;
|
|
671
688
|
content?: unknown;
|
|
672
689
|
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
690
|
+
explode?: boolean | undefined;
|
|
673
691
|
}[] | undefined;
|
|
674
692
|
requestBody?: any;
|
|
675
693
|
responses?: Record<string, any> | undefined;
|
|
676
694
|
'x-scalar-stability'?: unknown;
|
|
677
695
|
method?: "options" | "connect" | "delete" | "get" | "head" | "patch" | "post" | "put" | "trace" | undefined;
|
|
696
|
+
'x-post-response'?: string | undefined;
|
|
678
697
|
'x-codeSamples'?: unknown;
|
|
679
698
|
'x-code-samples'?: unknown;
|
|
680
699
|
'x-custom-examples'?: unknown;
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":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a,CAAC,CAAA"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { selectedSecuritySchemeUidSchema } from "../../entities/shared/utility.js";
|
|
2
2
|
import { nanoidSchema } from "@scalar/types/utils";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
XCodeSamplesSchema,
|
|
6
|
+
XPostResponseSchema
|
|
7
|
+
} from "@scalar/openapi-types/schemas/extensions";
|
|
5
8
|
import { XScalarStability } from "@scalar/types";
|
|
6
9
|
import { oasSecurityRequirementSchema } from "@scalar/types/entities";
|
|
7
10
|
import { oasParameterSchema } from "./parameters.js";
|
|
@@ -57,6 +60,7 @@ const oasRequestSchema = z.object({
|
|
|
57
60
|
"x-scalar-examples": z.record(z.string(), xScalarExampleSchema).optional(),
|
|
58
61
|
/** Hide operations */
|
|
59
62
|
"x-internal": z.boolean().optional(),
|
|
63
|
+
/** Ignore operations */
|
|
60
64
|
"x-scalar-ignore": z.boolean().optional()
|
|
61
65
|
});
|
|
62
66
|
const ScalarStabilitySchema = z.object({
|
|
@@ -78,7 +82,7 @@ const extendedRequestSchema = z.object({
|
|
|
78
82
|
/** List of security scheme UIDs associated with the request */
|
|
79
83
|
selectedSecuritySchemeUids: selectedSecuritySchemeUidSchema
|
|
80
84
|
});
|
|
81
|
-
const requestSchema = oasRequestSchema.omit({ "x-scalar-examples": true }).merge(XCodeSamplesSchema).merge(ScalarStabilitySchema).merge(extendedRequestSchema);
|
|
85
|
+
const requestSchema = oasRequestSchema.omit({ "x-scalar-examples": true }).merge(XCodeSamplesSchema).merge(ScalarStabilitySchema).merge(extendedRequestSchema).merge(XPostResponseSchema);
|
|
82
86
|
export {
|
|
83
87
|
oasRequestSchema,
|
|
84
88
|
requestMethods,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/entities/spec/requests.ts"],
|
|
4
|
-
"sourcesContent": ["import { selectedSecuritySchemeUidSchema } from '@/entities/shared/utility'\nimport { type ENTITY_BRANDS, nanoidSchema } from '@scalar/types/utils'\nimport { type ZodSchema, z } from 'zod'\n\nimport { XCodeSamplesSchema
|
|
5
|
-
"mappings": "AAAA,SAAS,uCAAuC;AAChD,SAA6B,oBAAoB;AACjD,SAAyB,SAAS;AAElC,
|
|
4
|
+
"sourcesContent": ["import { selectedSecuritySchemeUidSchema } from '@/entities/shared/utility'\nimport { type ENTITY_BRANDS, nanoidSchema } from '@scalar/types/utils'\nimport { type ZodSchema, z } from 'zod'\n\nimport {\n type PostResponseSchema,\n XCodeSamplesSchema,\n XPostResponseSchema,\n} from '@scalar/openapi-types/schemas/extensions'\nimport { XScalarStability } from '@scalar/types'\nimport { oasSecurityRequirementSchema } from '@scalar/types/entities'\nimport { oasParameterSchema } from './parameters'\nimport { type RequestExample, xScalarExampleSchema } from './request-examples'\nimport { oasExternalDocumentationSchema } from './spec-objects'\n\nexport const requestMethods = ['connect', 'delete', 'get', 'head', 'options', 'patch', 'post', 'put', 'trace'] as const\n\nexport type RequestMethod = (typeof requestMethods)[number]\n\n/** A single set of populated values for a sent request */\nexport type ResponseInstance = Omit<Response, 'headers'> & {\n /** Store headers as an object to match what we had with axios */\n headers: Record<string, string>\n /** Keys of headers which set cookies */\n cookieHeaderKeys: string[]\n /** Time in ms the request took */\n duration: number\n /** The response status */\n status: number\n /** The response status text */\n statusText: string\n /** The response method */\n method: RequestMethod\n /** The request path */\n path: string\n} & (\n | {\n /** The response data */\n data: string | Blob\n /** The response size in bytes */\n size: number\n }\n | {\n /** A stream reader for a streamable response body */\n reader: ReadableStreamDefaultReader<Uint8Array>\n }\n )\n\n/** A single request/response set to save to the history stack */\nexport type RequestEvent = {\n request: RequestExample\n response: ResponseInstance\n timestamp: number\n}\n\n// TODO: Type body definitions\ntype RequestBody = object\nconst requestBodySchema = z.any() satisfies ZodSchema<RequestBody>\n\n/** Open API Compliant Request Validator */\nexport const oasRequestSchema = z.object({\n /**\n * A list of tags for API documentation control. Tags can be used for logical\n * grouping of operations by resources or any other qualifier.\n *\n * These tags are the openapi spec tag names, not uids\n */\n 'tags': z.string().array().optional(),\n /** A short summary of what the operation does. */\n 'summary': z.string().optional(),\n /** A verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation. */\n 'description': z.string().optional(),\n /**\n * Unique string used to identify the operation. The id MUST be unique among all operations described in the API.\n * The operationId value is case-sensitive. Tools and libraries MAY use the operationId to uniquely identify an\n * operation, therefore, it is RECOMMENDED to follow bin common programming naming conventions./\n */\n 'operationId': z.string().optional(),\n /**\n * A declaration of which security mechanisms can be used across the API. The list of\n * values includes alternative security requirement objects that can be used. Only\n * one of the security requirement objects need to be satisfied to authorize a request.\n * Individual operations can override this definition. To make security optional, an empty\n * security requirement ({}) can be included in the array.\n */\n 'security': z.array(oasSecurityRequirementSchema).optional(),\n /**\n * The request body applicable for this operation. The requestBody is fully supported in HTTP methods where the\n * HTTP 1.1 specification [RFC7231] has explicitly defined semantics for request bodies. In other cases where the\n * HTTP spec is vague (such as GET, HEAD and DELETE), requestBody is permitted but does not have well-defined\n * semantics and SHOULD be avoided if possible.\n */\n 'requestBody': requestBodySchema.optional(),\n /**\n * Request parameters\n */\n 'parameters': oasParameterSchema.array().optional(),\n /**\n * External documentation object\n */\n 'externalDocs': oasExternalDocumentationSchema.optional(),\n 'deprecated': z.boolean().optional(),\n /** Response formats */\n 'responses': z.record(z.string(), z.any()).optional(),\n /** xScalar examples */\n 'x-scalar-examples': z.record(z.string(), xScalarExampleSchema).optional(),\n /** Hide operations */\n 'x-internal': z.boolean().optional(),\n /** Ignore operations */\n 'x-scalar-ignore': z.boolean().optional(),\n})\n\n/**\n * An OpenAPI extension to indicate the stability of the operation\n *\n * @example\n * ```yaml\n * x-scalar-stability: deprecated\n * ```\n */\nconst ScalarStabilitySchema = z.object({\n 'x-scalar-stability': z\n .enum([XScalarStability.Deprecated, XScalarStability.Experimental, XScalarStability.Stable])\n .optional()\n .catch(undefined),\n})\n\n/**\n * Extended properties added to the spec definition for client usage\n *\n * WARNING: DO NOT ADD PROPERTIES THAT SHARE A NAME WITH OAS OPERATION ENTITIES\n *\n * This object is directly converted to a spec operation during saving\n */\nconst extendedRequestSchema = z.object({\n type: z.literal('request').optional().default('request'),\n uid: nanoidSchema.brand<ENTITY_BRANDS['OPERATION']>(),\n /** Path Key */\n path: z.string().optional().default(''),\n /** Request Method */\n method: z.enum(requestMethods).default('get'),\n /** List of server UIDs specific to the request */\n servers: z.string().brand<ENTITY_BRANDS['SERVER']>().array().default([]),\n /** The currently selected server */\n selectedServerUid: z.string().brand<ENTITY_BRANDS['SERVER']>().optional().nullable().default(null),\n /** List of example UIDs associated with the request */\n examples: z.string().brand<ENTITY_BRANDS['EXAMPLE']>().array().default([]),\n /** List of security scheme UIDs associated with the request */\n selectedSecuritySchemeUids: selectedSecuritySchemeUidSchema,\n})\n\nexport type PostResponseScript = z.infer<typeof PostResponseSchema>\nexport type PostResponseScripts = z.infer<typeof XPostResponseSchema>['x-post-response']\n\n/** Unified request schema for client usage */\nexport const requestSchema = oasRequestSchema\n .omit({ 'x-scalar-examples': true })\n .merge(XCodeSamplesSchema)\n .merge(ScalarStabilitySchema)\n .merge(extendedRequestSchema)\n .merge(XPostResponseSchema)\n\nexport type Request = z.infer<typeof requestSchema>\nexport type RequestPayload = z.input<typeof requestSchema>\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,uCAAuC;AAChD,SAA6B,oBAAoB;AACjD,SAAyB,SAAS;AAElC;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB;AACjC,SAAS,oCAAoC;AAC7C,SAAS,0BAA0B;AACnC,SAA8B,4BAA4B;AAC1D,SAAS,sCAAsC;AAExC,MAAM,iBAAiB,CAAC,WAAW,UAAU,OAAO,QAAQ,WAAW,SAAS,QAAQ,OAAO,OAAO;AA0C7G,MAAM,oBAAoB,EAAE,IAAI;AAGzB,MAAM,mBAAmB,EAAE,OAAO;AAA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A;AAAA,EAEtC,QAAQ,EAAE,KAAK,cAAc,EAAE,QAAQ,KAAK;AAAA;AAAA,EAE5C,SAAS,EAAE,OAAO,EAAE,MAA+B,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAAA;AAAA,EAEvE,mBAAmB,EAAE,OAAO,EAAE,MAA+B,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,IAAI;AAAA;AAAA,EAEjG,UAAU,EAAE,OAAO,EAAE,MAAgC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAAA;AAAA,EAEzE,4BAA4B;AAC9B,CAAC;AAMM,MAAM,gBAAgB,iBAC1B,KAAK,EAAE,qBAAqB,KAAK,CAAC,EAClC,MAAM,kBAAkB,EACxB,MAAM,qBAAqB,EAC3B,MAAM,qBAAqB,EAC3B,MAAM,mBAAmB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,9 +2,9 @@ import type { SecurityScheme } from '@scalar/types/entities';
|
|
|
2
2
|
import type { Operation } from '../../entities/spec/operation.js';
|
|
3
3
|
/** Parses a list of selected security scheme uids which may be an array or single uid and returns a flattened array of security schemes */
|
|
4
4
|
export declare const getSchemes: (selectedSecuritySchemes: Operation["selectedSecuritySchemeUids"], securitySchemes: Record<SecurityScheme["uid"], SecurityScheme>) => NonNullable<{
|
|
5
|
-
name: string;
|
|
6
|
-
value: string;
|
|
7
5
|
type: "apiKey";
|
|
6
|
+
value: string;
|
|
7
|
+
name: string;
|
|
8
8
|
uid: string & import("zod").BRAND<"securityScheme">;
|
|
9
9
|
nameKey: string;
|
|
10
10
|
in: "cookie" | "query" | "header";
|
package/package.json
CHANGED
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"specification",
|
|
17
17
|
"yaml"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.
|
|
19
|
+
"version": "0.3.1",
|
|
20
20
|
"engines": {
|
|
21
|
-
"node": ">=
|
|
21
|
+
"node": ">=20"
|
|
22
22
|
},
|
|
23
23
|
"type": "module",
|
|
24
24
|
"main": "dist/index.js",
|
|
@@ -93,10 +93,10 @@
|
|
|
93
93
|
"type-fest": "^4.20.0",
|
|
94
94
|
"yaml": "^2.4.5",
|
|
95
95
|
"zod": "3.24.1",
|
|
96
|
-
"@scalar/object-utils": "1.1
|
|
97
|
-
"@scalar/openapi-types": "0.
|
|
98
|
-
"@scalar/
|
|
99
|
-
"@scalar/
|
|
96
|
+
"@scalar/object-utils": "1.2.1",
|
|
97
|
+
"@scalar/openapi-types": "0.3.1",
|
|
98
|
+
"@scalar/themes": "0.12.1",
|
|
99
|
+
"@scalar/types": "0.2.1"
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
102
|
"@types/node": "^20.17.10",
|
|
@@ -104,9 +104,9 @@
|
|
|
104
104
|
"vite": "5.4.19",
|
|
105
105
|
"vitest": "^1.6.0",
|
|
106
106
|
"zod-to-ts": "github:amritk/zod-to-ts#build",
|
|
107
|
-
"@scalar/
|
|
108
|
-
"@scalar/
|
|
109
|
-
"@scalar/openapi-
|
|
107
|
+
"@scalar/openapi-parser": "0.11.0",
|
|
108
|
+
"@scalar/build-tooling": "0.2.0",
|
|
109
|
+
"@scalar/openapi-types": "0.3.1"
|
|
110
110
|
},
|
|
111
111
|
"scripts": {
|
|
112
112
|
"build": "scalar-build-esbuild",
|