zod-openapi 5.0.0-beta.11 → 5.0.0-beta.13
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/dist/api.d.mts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +1 -1
- package/dist/api.mjs +1 -1
- package/dist/{components-29xRAW1K.d.mts → components-Ck7iRc2n.d.mts} +17 -1
- package/dist/{components-BdF0iREJ.js → components-D7SEPn4F.js} +30 -7
- package/dist/{components-3Hqib_T0.mjs → components-DGJXTZGV.mjs} +30 -7
- package/dist/{components-nS-mzdlW.d.ts → components-DLKlRo1M.d.ts} +17 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/api.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentRegistry, Override, createComponents, createRegistry } from "./components-
|
|
1
|
+
import { ComponentRegistry, Override, createComponents, createRegistry } from "./components-Ck7iRc2n.mjs";
|
|
2
2
|
import { $ZodObject, $ZodType, $ZodTypes } from "zod/v4/core";
|
|
3
3
|
import { core } from "zod/v4";
|
|
4
4
|
|
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentRegistry, Override, createComponents, createRegistry } from "./components-
|
|
1
|
+
import { ComponentRegistry, Override, createComponents, createRegistry } from "./components-DLKlRo1M.js";
|
|
2
2
|
import { $ZodObject, $ZodType, $ZodTypes } from "zod/v4/core";
|
|
3
3
|
import { core } from "zod/v4";
|
|
4
4
|
|
package/dist/api.js
CHANGED
package/dist/api.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { createComponents, createRegistry, isAnyZodType, unwrapZodObject } from "./components-
|
|
1
|
+
import { createComponents, createRegistry, isAnyZodType, unwrapZodObject } from "./components-DGJXTZGV.mjs";
|
|
2
2
|
|
|
3
3
|
export { createComponents, createRegistry, isAnyZodType, unwrapZodObject };
|
|
@@ -481,6 +481,15 @@ interface CreateDocumentOptions {
|
|
|
481
481
|
declare const createDocument: (zodOpenApiObject: ZodOpenApiObject, opts?: CreateDocumentOptions) => OpenAPIObject;
|
|
482
482
|
//#endregion
|
|
483
483
|
//#region src/create/components.d.ts
|
|
484
|
+
type SchemaSource = {
|
|
485
|
+
type: 'mediaType' | 'header';
|
|
486
|
+
} | {
|
|
487
|
+
type: 'parameter';
|
|
488
|
+
location: {
|
|
489
|
+
in: string;
|
|
490
|
+
name: string;
|
|
491
|
+
};
|
|
492
|
+
};
|
|
484
493
|
interface ComponentRegistry {
|
|
485
494
|
components: {
|
|
486
495
|
schemas: {
|
|
@@ -488,10 +497,16 @@ interface ComponentRegistry {
|
|
|
488
497
|
input: Map<string, {
|
|
489
498
|
zodType: $ZodType;
|
|
490
499
|
schemaObject: SchemaObject | ReferenceObject;
|
|
500
|
+
source: SchemaSource & {
|
|
501
|
+
path: string[];
|
|
502
|
+
};
|
|
491
503
|
}>;
|
|
492
504
|
output: Map<string, {
|
|
493
505
|
zodType: $ZodType;
|
|
494
506
|
schemaObject: SchemaObject | ReferenceObject;
|
|
507
|
+
source: SchemaSource & {
|
|
508
|
+
path: string[];
|
|
509
|
+
};
|
|
495
510
|
}>;
|
|
496
511
|
ids: Map<string, SchemaObject | ReferenceObject>;
|
|
497
512
|
manual: Map<string, {
|
|
@@ -531,8 +546,9 @@ interface ComponentRegistry {
|
|
|
531
546
|
seen: WeakMap<ZodOpenApiPathItemObject, PathItemObject | ReferenceObject>;
|
|
532
547
|
};
|
|
533
548
|
};
|
|
534
|
-
addSchema: (schema: $ZodType, path: string[], opts
|
|
549
|
+
addSchema: (schema: $ZodType, path: string[], opts: {
|
|
535
550
|
io: 'input' | 'output';
|
|
551
|
+
source: SchemaSource;
|
|
536
552
|
}) => SchemaObject | ReferenceObject;
|
|
537
553
|
addHeader: (header: $ZodType, path: string[], opts?: {
|
|
538
554
|
manualId?: string;
|
|
@@ -31,7 +31,10 @@ const isAnyZodType = (schema) => typeof schema === "object" && schema !== null &
|
|
|
31
31
|
//#region src/create/content.ts
|
|
32
32
|
const createMediaTypeObject = (mediaTypeObject, ctx, path) => {
|
|
33
33
|
if (isAnyZodType(mediaTypeObject.schema)) {
|
|
34
|
-
const schemaObject = ctx.registry.addSchema(mediaTypeObject.schema, [...path, "schema"], {
|
|
34
|
+
const schemaObject = ctx.registry.addSchema(mediaTypeObject.schema, [...path, "schema"], {
|
|
35
|
+
io: ctx.io,
|
|
36
|
+
source: { type: "mediaType" }
|
|
37
|
+
});
|
|
35
38
|
return {
|
|
36
39
|
...mediaTypeObject,
|
|
37
40
|
schema: schemaObject
|
|
@@ -470,11 +473,14 @@ const createRegistry = (components) => {
|
|
|
470
473
|
}
|
|
471
474
|
},
|
|
472
475
|
addSchema: (schema, path, opts) => {
|
|
473
|
-
const io = opts?.io ?? "output";
|
|
474
476
|
const schemaObject = {};
|
|
475
|
-
registry$1.components.schemas[io].set(path.join(" > "), {
|
|
477
|
+
registry$1.components.schemas[opts.io].set(path.join(" > "), {
|
|
476
478
|
schemaObject,
|
|
477
|
-
zodType: schema
|
|
479
|
+
zodType: schema,
|
|
480
|
+
source: {
|
|
481
|
+
path,
|
|
482
|
+
...opts?.source
|
|
483
|
+
}
|
|
478
484
|
});
|
|
479
485
|
return schemaObject;
|
|
480
486
|
},
|
|
@@ -485,7 +491,21 @@ const createRegistry = (components) => {
|
|
|
485
491
|
const name = opts?.location?.name ?? meta?.param?.name;
|
|
486
492
|
const inLocation = opts?.location?.in ?? meta?.param?.in;
|
|
487
493
|
if (!name || !inLocation) throw new Error(`Parameter at ${path.join(" > ")} is missing \`.meta({ param: { name, in } })\` information`);
|
|
488
|
-
const schemaObject = registry$1.addSchema(parameter, [
|
|
494
|
+
const schemaObject = registry$1.addSchema(parameter, [
|
|
495
|
+
...path,
|
|
496
|
+
inLocation,
|
|
497
|
+
name,
|
|
498
|
+
"schema"
|
|
499
|
+
], {
|
|
500
|
+
io: "input",
|
|
501
|
+
source: {
|
|
502
|
+
type: "parameter",
|
|
503
|
+
location: {
|
|
504
|
+
in: inLocation,
|
|
505
|
+
name
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
});
|
|
489
509
|
const { id: metaId,...rest } = meta?.param ?? {};
|
|
490
510
|
const parameterObject = {
|
|
491
511
|
...rest,
|
|
@@ -497,7 +517,7 @@ const createRegistry = (components) => {
|
|
|
497
517
|
if (!parameterObject.description && meta?.description) parameterObject.description = meta.description;
|
|
498
518
|
const id = metaId ?? opts?.manualId;
|
|
499
519
|
if (id) {
|
|
500
|
-
if (registry$1.components.parameters.ids.has(id)) throw new Error(`Schema "${id}" is already registered`);
|
|
520
|
+
if (registry$1.components.parameters.ids.has(id)) throw new Error(`Schema "${id}" at ${path.join(" > ")} is already registered`);
|
|
501
521
|
const ref = { $ref: `#/components/parameters/${id}` };
|
|
502
522
|
registry$1.components.parameters.seen.set(parameter, ref);
|
|
503
523
|
registry$1.components.parameters.ids.set(id, parameterObject);
|
|
@@ -515,7 +535,10 @@ const createRegistry = (components) => {
|
|
|
515
535
|
const headerObject = rest;
|
|
516
536
|
if (isRequired(header, "output")) headerObject.required = true;
|
|
517
537
|
if (!headerObject.description && meta?.description) headerObject.description = meta.description;
|
|
518
|
-
headerObject.schema = registry$1.addSchema(header, [...path, "schema"], {
|
|
538
|
+
headerObject.schema = registry$1.addSchema(header, [...path, "schema"], {
|
|
539
|
+
io: "output",
|
|
540
|
+
source: { type: "header" }
|
|
541
|
+
});
|
|
519
542
|
if (id) {
|
|
520
543
|
if (registry$1.components.schemas.ids.has(id)) throw new Error(`Schema "${id}" is already registered`);
|
|
521
544
|
const ref = { $ref: `#/components/headers/${id}` };
|
|
@@ -8,7 +8,10 @@ const isAnyZodType = (schema) => typeof schema === "object" && schema !== null &
|
|
|
8
8
|
//#region src/create/content.ts
|
|
9
9
|
const createMediaTypeObject = (mediaTypeObject, ctx, path) => {
|
|
10
10
|
if (isAnyZodType(mediaTypeObject.schema)) {
|
|
11
|
-
const schemaObject = ctx.registry.addSchema(mediaTypeObject.schema, [...path, "schema"], {
|
|
11
|
+
const schemaObject = ctx.registry.addSchema(mediaTypeObject.schema, [...path, "schema"], {
|
|
12
|
+
io: ctx.io,
|
|
13
|
+
source: { type: "mediaType" }
|
|
14
|
+
});
|
|
12
15
|
return {
|
|
13
16
|
...mediaTypeObject,
|
|
14
17
|
schema: schemaObject
|
|
@@ -447,11 +450,14 @@ const createRegistry = (components) => {
|
|
|
447
450
|
}
|
|
448
451
|
},
|
|
449
452
|
addSchema: (schema, path, opts) => {
|
|
450
|
-
const io = opts?.io ?? "output";
|
|
451
453
|
const schemaObject = {};
|
|
452
|
-
registry$1.components.schemas[io].set(path.join(" > "), {
|
|
454
|
+
registry$1.components.schemas[opts.io].set(path.join(" > "), {
|
|
453
455
|
schemaObject,
|
|
454
|
-
zodType: schema
|
|
456
|
+
zodType: schema,
|
|
457
|
+
source: {
|
|
458
|
+
path,
|
|
459
|
+
...opts?.source
|
|
460
|
+
}
|
|
455
461
|
});
|
|
456
462
|
return schemaObject;
|
|
457
463
|
},
|
|
@@ -462,7 +468,21 @@ const createRegistry = (components) => {
|
|
|
462
468
|
const name = opts?.location?.name ?? meta?.param?.name;
|
|
463
469
|
const inLocation = opts?.location?.in ?? meta?.param?.in;
|
|
464
470
|
if (!name || !inLocation) throw new Error(`Parameter at ${path.join(" > ")} is missing \`.meta({ param: { name, in } })\` information`);
|
|
465
|
-
const schemaObject = registry$1.addSchema(parameter, [
|
|
471
|
+
const schemaObject = registry$1.addSchema(parameter, [
|
|
472
|
+
...path,
|
|
473
|
+
inLocation,
|
|
474
|
+
name,
|
|
475
|
+
"schema"
|
|
476
|
+
], {
|
|
477
|
+
io: "input",
|
|
478
|
+
source: {
|
|
479
|
+
type: "parameter",
|
|
480
|
+
location: {
|
|
481
|
+
in: inLocation,
|
|
482
|
+
name
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
});
|
|
466
486
|
const { id: metaId,...rest } = meta?.param ?? {};
|
|
467
487
|
const parameterObject = {
|
|
468
488
|
...rest,
|
|
@@ -474,7 +494,7 @@ const createRegistry = (components) => {
|
|
|
474
494
|
if (!parameterObject.description && meta?.description) parameterObject.description = meta.description;
|
|
475
495
|
const id = metaId ?? opts?.manualId;
|
|
476
496
|
if (id) {
|
|
477
|
-
if (registry$1.components.parameters.ids.has(id)) throw new Error(`Schema "${id}" is already registered`);
|
|
497
|
+
if (registry$1.components.parameters.ids.has(id)) throw new Error(`Schema "${id}" at ${path.join(" > ")} is already registered`);
|
|
478
498
|
const ref = { $ref: `#/components/parameters/${id}` };
|
|
479
499
|
registry$1.components.parameters.seen.set(parameter, ref);
|
|
480
500
|
registry$1.components.parameters.ids.set(id, parameterObject);
|
|
@@ -492,7 +512,10 @@ const createRegistry = (components) => {
|
|
|
492
512
|
const headerObject = rest;
|
|
493
513
|
if (isRequired(header, "output")) headerObject.required = true;
|
|
494
514
|
if (!headerObject.description && meta?.description) headerObject.description = meta.description;
|
|
495
|
-
headerObject.schema = registry$1.addSchema(header, [...path, "schema"], {
|
|
515
|
+
headerObject.schema = registry$1.addSchema(header, [...path, "schema"], {
|
|
516
|
+
io: "output",
|
|
517
|
+
source: { type: "header" }
|
|
518
|
+
});
|
|
496
519
|
if (id) {
|
|
497
520
|
if (registry$1.components.schemas.ids.has(id)) throw new Error(`Schema "${id}" is already registered`);
|
|
498
521
|
const ref = { $ref: `#/components/headers/${id}` };
|
|
@@ -481,6 +481,15 @@ interface CreateDocumentOptions {
|
|
|
481
481
|
declare const createDocument: (zodOpenApiObject: ZodOpenApiObject, opts?: CreateDocumentOptions) => OpenAPIObject;
|
|
482
482
|
//#endregion
|
|
483
483
|
//#region src/create/components.d.ts
|
|
484
|
+
type SchemaSource = {
|
|
485
|
+
type: 'mediaType' | 'header';
|
|
486
|
+
} | {
|
|
487
|
+
type: 'parameter';
|
|
488
|
+
location: {
|
|
489
|
+
in: string;
|
|
490
|
+
name: string;
|
|
491
|
+
};
|
|
492
|
+
};
|
|
484
493
|
interface ComponentRegistry {
|
|
485
494
|
components: {
|
|
486
495
|
schemas: {
|
|
@@ -488,10 +497,16 @@ interface ComponentRegistry {
|
|
|
488
497
|
input: Map<string, {
|
|
489
498
|
zodType: $ZodType;
|
|
490
499
|
schemaObject: SchemaObject | ReferenceObject;
|
|
500
|
+
source: SchemaSource & {
|
|
501
|
+
path: string[];
|
|
502
|
+
};
|
|
491
503
|
}>;
|
|
492
504
|
output: Map<string, {
|
|
493
505
|
zodType: $ZodType;
|
|
494
506
|
schemaObject: SchemaObject | ReferenceObject;
|
|
507
|
+
source: SchemaSource & {
|
|
508
|
+
path: string[];
|
|
509
|
+
};
|
|
495
510
|
}>;
|
|
496
511
|
ids: Map<string, SchemaObject | ReferenceObject>;
|
|
497
512
|
manual: Map<string, {
|
|
@@ -531,8 +546,9 @@ interface ComponentRegistry {
|
|
|
531
546
|
seen: WeakMap<ZodOpenApiPathItemObject, PathItemObject | ReferenceObject>;
|
|
532
547
|
};
|
|
533
548
|
};
|
|
534
|
-
addSchema: (schema: $ZodType, path: string[], opts
|
|
549
|
+
addSchema: (schema: $ZodType, path: string[], opts: {
|
|
535
550
|
io: 'input' | 'output';
|
|
551
|
+
source: SchemaSource;
|
|
536
552
|
}) => SchemaObject | ReferenceObject;
|
|
537
553
|
addHeader: (header: $ZodType, path: string[], opts?: {
|
|
538
554
|
manualId?: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseParameterObject, CallbackObject, CallbacksObject, ComponentRegistry, ComponentsObject, ContactObject, ContentObject, CreateDocumentOptions, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, Override, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject, ZodObjectInput, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiMediaTypeObject, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiVersion, createDocument } from "./components-
|
|
1
|
+
import { BaseParameterObject, CallbackObject, CallbacksObject, ComponentRegistry, ComponentsObject, ContactObject, ContentObject, CreateDocumentOptions, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, Override, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject, ZodObjectInput, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiMediaTypeObject, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiVersion, createDocument } from "./components-Ck7iRc2n.mjs";
|
|
2
2
|
import { core } from "zod/v4";
|
|
3
3
|
|
|
4
4
|
//#region rolldown:runtime
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseParameterObject, CallbackObject, CallbacksObject, ComponentRegistry, ComponentsObject, ContactObject, ContentObject, CreateDocumentOptions, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, Override, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject, ZodObjectInput, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiMediaTypeObject, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiVersion, createDocument } from "./components-
|
|
1
|
+
import { BaseParameterObject, CallbackObject, CallbacksObject, ComponentRegistry, ComponentsObject, ContactObject, ContentObject, CreateDocumentOptions, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, Override, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject, ZodObjectInput, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiMediaTypeObject, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiVersion, createDocument } from "./components-DLKlRo1M.js";
|
|
2
2
|
import { core } from "zod/v4";
|
|
3
3
|
|
|
4
4
|
//#region rolldown:runtime
|
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponents, createPaths, createRegistry, createSchema } from "./components-
|
|
1
|
+
import { createComponents, createPaths, createRegistry, createSchema } from "./components-DGJXTZGV.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/create/document.ts
|
|
4
4
|
const createDocument = (zodOpenApiObject, opts = {}) => {
|