zod-openapi 5.2.0 → 5.3.0
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/README.md +2 -0
- package/api/index.d.cts +1 -0
- package/api/index.d.ts +1 -1
- package/api/package.json +3 -3
- package/dist/api.cjs +6 -0
- package/dist/api.d.cts +11 -0
- package/dist/api.d.ts +2 -2
- package/dist/api.js +2 -5
- package/dist/{components-DPhhXqww.mjs → components-BAO_3m-h.js} +2 -2
- package/dist/{components-Ddt0DmKC.d.ts → components-Br5MCUeG.d.cts} +17 -15
- package/dist/{components-CERE3LYU.d.mts → components-DkyUTLcs.d.ts} +17 -15
- package/dist/index.cjs +29 -0
- package/dist/{index.d.mts → index.d.cts} +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +10 -7
- package/package.json +18 -15
- package/dist/api.d.mts +0 -11
- package/dist/api.mjs +0 -3
- package/dist/index.mjs +0 -18
- /package/dist/{components-BAZgpKwe.js → components-Ccvxvize.cjs} +0 -0
package/README.md
CHANGED
package/api/index.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/api.cjs';
|
package/api/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '../dist/api';
|
|
1
|
+
export * from '../dist/api.js';
|
package/api/package.json
CHANGED
package/dist/api.cjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const require_components = require('./components-Ccvxvize.cjs');
|
|
2
|
+
|
|
3
|
+
exports.createComponents = require_components.createComponents;
|
|
4
|
+
exports.createRegistry = require_components.createRegistry;
|
|
5
|
+
exports.isAnyZodType = require_components.isAnyZodType;
|
|
6
|
+
exports.unwrapZodObject = require_components.unwrapZodObject;
|
package/dist/api.d.cts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentRegistry, ZodOpenApiBaseMetadata, ZodOpenApiMetadata, ZodOpenApiOverride, ZodOpenApiOverrideContext, ZodOpenApiOverrideMeta, ZodOpenApiOverrideMetaContext, createComponents, createRegistry } from "./components-Br5MCUeG.cjs";
|
|
2
|
+
import * as core from "zod/v4/core";
|
|
3
|
+
import { $ZodObject, $ZodType, $ZodTypes } from "zod/v4/core";
|
|
4
|
+
|
|
5
|
+
//#region src/create/object.d.ts
|
|
6
|
+
declare const unwrapZodObject: (zodType: $ZodTypes, io: "input" | "output", path: string[]) => $ZodObject;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/zod.d.ts
|
|
9
|
+
declare const isAnyZodType: (schema: unknown) => schema is core.$ZodTypes;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { ComponentRegistry, ZodOpenApiBaseMetadata, ZodOpenApiMetadata, ZodOpenApiOverride, ZodOpenApiOverrideContext, ZodOpenApiOverrideMeta, ZodOpenApiOverrideMetaContext, createComponents, createRegistry, isAnyZodType, unwrapZodObject };
|
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentRegistry,
|
|
1
|
+
import { ComponentRegistry, ZodOpenApiBaseMetadata, ZodOpenApiMetadata, ZodOpenApiOverride, ZodOpenApiOverrideContext, ZodOpenApiOverrideMeta, ZodOpenApiOverrideMetaContext, createComponents, createRegistry } from "./components-DkyUTLcs.js";
|
|
2
2
|
import * as core from "zod/v4/core";
|
|
3
3
|
import { $ZodObject, $ZodType, $ZodTypes } from "zod/v4/core";
|
|
4
4
|
|
|
@@ -8,4 +8,4 @@ declare const unwrapZodObject: (zodType: $ZodTypes, io: "input" | "output", path
|
|
|
8
8
|
//#region src/zod.d.ts
|
|
9
9
|
declare const isAnyZodType: (schema: unknown) => schema is core.$ZodTypes;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { ComponentRegistry,
|
|
11
|
+
export { ComponentRegistry, ZodOpenApiBaseMetadata, ZodOpenApiMetadata, ZodOpenApiOverride, ZodOpenApiOverrideContext, ZodOpenApiOverrideMeta, ZodOpenApiOverrideMetaContext, createComponents, createRegistry, isAnyZodType, unwrapZodObject };
|
package/dist/api.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { createComponents, createRegistry, isAnyZodType, unwrapZodObject } from "./components-BAO_3m-h.js";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
exports.createRegistry = require_components.createRegistry;
|
|
5
|
-
exports.isAnyZodType = require_components.isAnyZodType;
|
|
6
|
-
exports.unwrapZodObject = require_components.unwrapZodObject;
|
|
3
|
+
export { createComponents, createRegistry, isAnyZodType, unwrapZodObject };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { globalRegistry } from "zod/v4/core";
|
|
2
|
-
import { object, registry, toJSONSchema } from "zod/v4";
|
|
2
|
+
import { object, registry, toJSONSchema as toJSONSchema$1 } from "zod/v4";
|
|
3
3
|
|
|
4
4
|
//#region src/zod.ts
|
|
5
5
|
const isAnyZodType = (schema) => typeof schema === "object" && schema !== null && "_zod" in schema;
|
|
@@ -373,7 +373,7 @@ const createSchemas = (schemas, ctx) => {
|
|
|
373
373
|
zodRegistry.add(object(entries), { id: "zodOpenApiCreateSchema" });
|
|
374
374
|
for (const [id, { zodType }] of ctx.registry.components.schemas.manual) zodRegistry.add(zodType, { id });
|
|
375
375
|
const outputIds = /* @__PURE__ */ new Map();
|
|
376
|
-
const jsonSchema = toJSONSchema(zodRegistry, {
|
|
376
|
+
const jsonSchema = toJSONSchema$1(zodRegistry, {
|
|
377
377
|
override(context) {
|
|
378
378
|
const meta = context.zodSchema.meta();
|
|
379
379
|
if (meta?.outputId && meta?.id) outputIds.set(meta.id, meta.outputId);
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { $ZodType, $ZodTypes } from "zod/v4/core";
|
|
1
|
+
import { $ZodType, $ZodTypes, JSONSchemaMeta, toJSONSchema } from "zod/v4/core";
|
|
3
2
|
|
|
4
|
-
//#region src/
|
|
3
|
+
//#region src/openapi.d.ts
|
|
4
|
+
declare const openApiVersions: readonly ["3.1.0", "3.1.1"];
|
|
5
|
+
type OpenApiVersion = (typeof openApiVersions)[number];
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region packages/openapi3-ts/lib-types/dist/model/specification-extension.d.ts
|
|
5
8
|
type IExtensionName = `x-${string}`;
|
|
6
9
|
type IExtensionType = any;
|
|
7
10
|
type ISpecificationExtension = {
|
|
8
11
|
[extensionName: IExtensionName]: IExtensionType;
|
|
9
12
|
};
|
|
10
13
|
//#endregion
|
|
11
|
-
//#region
|
|
14
|
+
//#region packages/openapi3-ts/lib-types/dist/model/oas-common.d.ts
|
|
12
15
|
interface ServerObject extends ISpecificationExtension {
|
|
13
16
|
url: string;
|
|
14
17
|
description?: string;
|
|
@@ -22,7 +25,7 @@ interface ServerVariableObject extends ISpecificationExtension {
|
|
|
22
25
|
description?: string;
|
|
23
26
|
}
|
|
24
27
|
//#endregion
|
|
25
|
-
//#region
|
|
28
|
+
//#region packages/openapi3-ts/lib-types/dist/model/openapi31.d.ts
|
|
26
29
|
interface OpenAPIObject extends ISpecificationExtension {
|
|
27
30
|
openapi: string;
|
|
28
31
|
info: InfoObject;
|
|
@@ -319,16 +322,15 @@ interface SecurityRequirementObject {
|
|
|
319
322
|
[name: string]: string[];
|
|
320
323
|
}
|
|
321
324
|
//#endregion
|
|
322
|
-
//#region src/openapi.d.ts
|
|
323
|
-
declare const openApiVersions: readonly ["3.1.0", "3.1.1"];
|
|
324
|
-
type OpenApiVersion = (typeof openApiVersions)[number];
|
|
325
|
-
//#endregion
|
|
326
325
|
//#region src/types.d.ts
|
|
327
|
-
type OverrideParameters = Parameters<NonNullable<NonNullable<Parameters<typeof
|
|
326
|
+
type OverrideParameters = Parameters<NonNullable<NonNullable<Parameters<typeof toJSONSchema>[1]>['override']>>[0];
|
|
327
|
+
type OverrideSchemaParameters = Omit<OverrideParameters, 'zodSchema'>;
|
|
328
328
|
type ZodOpenApiOverrideContext = OverrideParameters & {
|
|
329
329
|
io: 'input' | 'output';
|
|
330
330
|
};
|
|
331
|
-
type
|
|
331
|
+
type ZodOpenApiOverrideMetaContext = OverrideSchemaParameters;
|
|
332
|
+
type ZodOpenApiOverrideMeta = (ctx: ZodOpenApiOverrideMetaContext) => void;
|
|
333
|
+
type ZodOpenApiOverride = (ctx: ZodOpenApiOverrideContext) => void;
|
|
332
334
|
interface ZodOpenApiBaseMetadata {
|
|
333
335
|
/**
|
|
334
336
|
* Used to set metadata for a parameter
|
|
@@ -351,7 +353,7 @@ interface ZodOpenApiBaseMetadata {
|
|
|
351
353
|
/**
|
|
352
354
|
* Use to override the rendered schema
|
|
353
355
|
*/
|
|
354
|
-
override?: SchemaObject |
|
|
356
|
+
override?: SchemaObject | ZodOpenApiOverrideMeta;
|
|
355
357
|
/**
|
|
356
358
|
* For use only if this Zod Schema is manually registered in the `components` section
|
|
357
359
|
* and is not used anywhere else in the document.
|
|
@@ -364,7 +366,7 @@ interface ZodOpenApiBaseMetadata {
|
|
|
364
366
|
*/
|
|
365
367
|
outputId?: string;
|
|
366
368
|
}
|
|
367
|
-
interface ZodOpenApiMetadata extends ZodOpenApiBaseMetadata,
|
|
369
|
+
interface ZodOpenApiMetadata extends ZodOpenApiBaseMetadata, JSONSchemaMeta {
|
|
368
370
|
examples?: unknown[];
|
|
369
371
|
/**
|
|
370
372
|
* @deprecated - Use `examples` instead.
|
|
@@ -491,7 +493,7 @@ interface CreateDocumentOptions {
|
|
|
491
493
|
* - `{ type: 'string' }` — Override the schema type to be a string using an object
|
|
492
494
|
* - `(ctx) => { ctx.jsonSchema.type = 'string'; }` — Override the schema type to be a string using a function
|
|
493
495
|
*/
|
|
494
|
-
override?:
|
|
496
|
+
override?: ZodOpenApiOverride;
|
|
495
497
|
/**
|
|
496
498
|
* Suffix to append to the output ID of the schema.
|
|
497
499
|
* This is useful to avoid conflicts with other schemas that may have the same name.
|
|
@@ -630,4 +632,4 @@ interface ComponentRegistry {
|
|
|
630
632
|
declare const createRegistry: (components?: ZodOpenApiComponentsObject) => ComponentRegistry;
|
|
631
633
|
declare const createComponents: (registry: ComponentRegistry, opts: CreateDocumentOptions) => ComponentsObject;
|
|
632
634
|
//#endregion
|
|
633
|
-
export { 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,
|
|
635
|
+
export { 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, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject, ZodObjectInput, ZodOpenApiBaseMetadata, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiExampleObject, ZodOpenApiExamplesObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiLinkObject, ZodOpenApiLinksObject, ZodOpenApiMediaTypeObject, ZodOpenApiMetadata, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiOverride, ZodOpenApiOverrideContext, ZodOpenApiOverrideMeta, ZodOpenApiOverrideMetaContext, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiSecuritySchemeObject, ZodOpenApiVersion, createComponents, createDocument, createRegistry };
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { $ZodType, $ZodTypes } from "zod/v4/core";
|
|
1
|
+
import { $ZodType, $ZodTypes, JSONSchemaMeta, toJSONSchema } from "zod/v4/core";
|
|
3
2
|
|
|
4
|
-
//#region src/
|
|
3
|
+
//#region src/openapi.d.ts
|
|
4
|
+
declare const openApiVersions: readonly ["3.1.0", "3.1.1"];
|
|
5
|
+
type OpenApiVersion = (typeof openApiVersions)[number];
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region packages/openapi3-ts/lib-types/dist/model/specification-extension.d.ts
|
|
5
8
|
type IExtensionName = `x-${string}`;
|
|
6
9
|
type IExtensionType = any;
|
|
7
10
|
type ISpecificationExtension = {
|
|
8
11
|
[extensionName: IExtensionName]: IExtensionType;
|
|
9
12
|
};
|
|
10
13
|
//#endregion
|
|
11
|
-
//#region
|
|
14
|
+
//#region packages/openapi3-ts/lib-types/dist/model/oas-common.d.ts
|
|
12
15
|
interface ServerObject extends ISpecificationExtension {
|
|
13
16
|
url: string;
|
|
14
17
|
description?: string;
|
|
@@ -22,7 +25,7 @@ interface ServerVariableObject extends ISpecificationExtension {
|
|
|
22
25
|
description?: string;
|
|
23
26
|
}
|
|
24
27
|
//#endregion
|
|
25
|
-
//#region
|
|
28
|
+
//#region packages/openapi3-ts/lib-types/dist/model/openapi31.d.ts
|
|
26
29
|
interface OpenAPIObject extends ISpecificationExtension {
|
|
27
30
|
openapi: string;
|
|
28
31
|
info: InfoObject;
|
|
@@ -319,16 +322,15 @@ interface SecurityRequirementObject {
|
|
|
319
322
|
[name: string]: string[];
|
|
320
323
|
}
|
|
321
324
|
//#endregion
|
|
322
|
-
//#region src/openapi.d.ts
|
|
323
|
-
declare const openApiVersions: readonly ["3.1.0", "3.1.1"];
|
|
324
|
-
type OpenApiVersion = (typeof openApiVersions)[number];
|
|
325
|
-
//#endregion
|
|
326
325
|
//#region src/types.d.ts
|
|
327
|
-
type OverrideParameters = Parameters<NonNullable<NonNullable<Parameters<typeof
|
|
326
|
+
type OverrideParameters = Parameters<NonNullable<NonNullable<Parameters<typeof toJSONSchema>[1]>['override']>>[0];
|
|
327
|
+
type OverrideSchemaParameters = Omit<OverrideParameters, 'zodSchema'>;
|
|
328
328
|
type ZodOpenApiOverrideContext = OverrideParameters & {
|
|
329
329
|
io: 'input' | 'output';
|
|
330
330
|
};
|
|
331
|
-
type
|
|
331
|
+
type ZodOpenApiOverrideMetaContext = OverrideSchemaParameters;
|
|
332
|
+
type ZodOpenApiOverrideMeta = (ctx: ZodOpenApiOverrideMetaContext) => void;
|
|
333
|
+
type ZodOpenApiOverride = (ctx: ZodOpenApiOverrideContext) => void;
|
|
332
334
|
interface ZodOpenApiBaseMetadata {
|
|
333
335
|
/**
|
|
334
336
|
* Used to set metadata for a parameter
|
|
@@ -351,7 +353,7 @@ interface ZodOpenApiBaseMetadata {
|
|
|
351
353
|
/**
|
|
352
354
|
* Use to override the rendered schema
|
|
353
355
|
*/
|
|
354
|
-
override?: SchemaObject |
|
|
356
|
+
override?: SchemaObject | ZodOpenApiOverrideMeta;
|
|
355
357
|
/**
|
|
356
358
|
* For use only if this Zod Schema is manually registered in the `components` section
|
|
357
359
|
* and is not used anywhere else in the document.
|
|
@@ -364,7 +366,7 @@ interface ZodOpenApiBaseMetadata {
|
|
|
364
366
|
*/
|
|
365
367
|
outputId?: string;
|
|
366
368
|
}
|
|
367
|
-
interface ZodOpenApiMetadata extends ZodOpenApiBaseMetadata,
|
|
369
|
+
interface ZodOpenApiMetadata extends ZodOpenApiBaseMetadata, JSONSchemaMeta {
|
|
368
370
|
examples?: unknown[];
|
|
369
371
|
/**
|
|
370
372
|
* @deprecated - Use `examples` instead.
|
|
@@ -491,7 +493,7 @@ interface CreateDocumentOptions {
|
|
|
491
493
|
* - `{ type: 'string' }` — Override the schema type to be a string using an object
|
|
492
494
|
* - `(ctx) => { ctx.jsonSchema.type = 'string'; }` — Override the schema type to be a string using a function
|
|
493
495
|
*/
|
|
494
|
-
override?:
|
|
496
|
+
override?: ZodOpenApiOverride;
|
|
495
497
|
/**
|
|
496
498
|
* Suffix to append to the output ID of the schema.
|
|
497
499
|
* This is useful to avoid conflicts with other schemas that may have the same name.
|
|
@@ -630,4 +632,4 @@ interface ComponentRegistry {
|
|
|
630
632
|
declare const createRegistry: (components?: ZodOpenApiComponentsObject) => ComponentRegistry;
|
|
631
633
|
declare const createComponents: (registry: ComponentRegistry, opts: CreateDocumentOptions) => ComponentsObject;
|
|
632
634
|
//#endregion
|
|
633
|
-
export { 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,
|
|
635
|
+
export { 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, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject, ZodObjectInput, ZodOpenApiBaseMetadata, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiExampleObject, ZodOpenApiExamplesObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiLinkObject, ZodOpenApiLinksObject, ZodOpenApiMediaTypeObject, ZodOpenApiMetadata, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiOverride, ZodOpenApiOverrideContext, ZodOpenApiOverrideMeta, ZodOpenApiOverrideMetaContext, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiSecuritySchemeObject, ZodOpenApiVersion, createComponents, createDocument, createRegistry };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const require_components = require('./components-Ccvxvize.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/create/document.ts
|
|
4
|
+
const createDocument = (zodOpenApiObject, opts = {}) => {
|
|
5
|
+
const { paths, webhooks, components,...rest } = zodOpenApiObject;
|
|
6
|
+
const document = rest;
|
|
7
|
+
const registry = require_components.createRegistry(components);
|
|
8
|
+
const createdPaths = require_components.createPaths(paths, registry, ["paths"]);
|
|
9
|
+
if (createdPaths) document.paths = createdPaths;
|
|
10
|
+
const createdWebhooks = require_components.createPaths(webhooks, registry, ["webhooks"]);
|
|
11
|
+
if (createdWebhooks) document.webhooks = createdWebhooks;
|
|
12
|
+
const createdComponents = require_components.createComponents(registry, opts);
|
|
13
|
+
if (Object.keys(createdComponents).length > 0) document.components = createdComponents;
|
|
14
|
+
return document;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region packages/openapi3-ts/src/dist/oas31.ts
|
|
19
|
+
var oas31_exports = {};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.createDocument = createDocument;
|
|
23
|
+
exports.createSchema = require_components.createSchema;
|
|
24
|
+
Object.defineProperty(exports, 'oas31', {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return oas31_exports;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -1,7 +1,10 @@
|
|
|
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,
|
|
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, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject, ZodObjectInput, ZodOpenApiBaseMetadata, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiExampleObject, ZodOpenApiExamplesObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiLinkObject, ZodOpenApiLinksObject, ZodOpenApiMediaTypeObject, ZodOpenApiMetadata, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiOverride, ZodOpenApiOverrideContext, ZodOpenApiOverrideMeta, ZodOpenApiOverrideMetaContext, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiSecuritySchemeObject, ZodOpenApiVersion, createDocument } from "./components-Br5MCUeG.cjs";
|
|
2
2
|
import * as core from "zod/v4/core";
|
|
3
3
|
|
|
4
4
|
//#region rolldown:runtime
|
|
5
|
+
declare namespace oas31_d_exports {
|
|
6
|
+
export { BaseParameterObject, CallbackObject, CallbacksObject, ComponentsObject, ContactObject, ContentObject, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject };
|
|
7
|
+
}
|
|
5
8
|
//#endregion
|
|
6
9
|
//#region src/create/schema/schema.d.ts
|
|
7
10
|
interface SchemaResult {
|
|
@@ -24,8 +27,5 @@ declare const createSchema: (schema: core.$ZodType, ctx?: {
|
|
|
24
27
|
schema: SchemaObject | ReferenceObject;
|
|
25
28
|
components: Record<string, SchemaObject>;
|
|
26
29
|
};
|
|
27
|
-
declare namespace oas31_d_exports {
|
|
28
|
-
export { BaseParameterObject, CallbackObject, CallbacksObject, ComponentsObject, ContactObject, ContentObject, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject };
|
|
29
|
-
}
|
|
30
30
|
//#endregion
|
|
31
|
-
export { CreateDocumentOptions,
|
|
31
|
+
export { CreateDocumentOptions, SchemaResult, ZodObjectInput, ZodOpenApiBaseMetadata, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiExampleObject, ZodOpenApiExamplesObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiLinkObject, ZodOpenApiLinksObject, ZodOpenApiMediaTypeObject, ZodOpenApiMetadata, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiOverride, ZodOpenApiOverrideContext, ZodOpenApiOverrideMeta, ZodOpenApiOverrideMetaContext, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiSecuritySchemeObject, ZodOpenApiVersion, createDocument, createSchema, oas31_d_exports as oas31 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
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,
|
|
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, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject, ZodObjectInput, ZodOpenApiBaseMetadata, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiExampleObject, ZodOpenApiExamplesObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiLinkObject, ZodOpenApiLinksObject, ZodOpenApiMediaTypeObject, ZodOpenApiMetadata, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiOverride, ZodOpenApiOverrideContext, ZodOpenApiOverrideMeta, ZodOpenApiOverrideMetaContext, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiSecuritySchemeObject, ZodOpenApiVersion, createDocument } from "./components-DkyUTLcs.js";
|
|
2
2
|
import * as core from "zod/v4/core";
|
|
3
3
|
|
|
4
4
|
//#region rolldown:runtime
|
|
5
|
+
declare namespace oas31_d_exports {
|
|
6
|
+
export { BaseParameterObject, CallbackObject, CallbacksObject, ComponentsObject, ContactObject, ContentObject, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject };
|
|
7
|
+
}
|
|
5
8
|
//#endregion
|
|
6
9
|
//#region src/create/schema/schema.d.ts
|
|
7
10
|
interface SchemaResult {
|
|
@@ -24,8 +27,5 @@ declare const createSchema: (schema: core.$ZodType, ctx?: {
|
|
|
24
27
|
schema: SchemaObject | ReferenceObject;
|
|
25
28
|
components: Record<string, SchemaObject>;
|
|
26
29
|
};
|
|
27
|
-
declare namespace oas31_d_exports {
|
|
28
|
-
export { BaseParameterObject, CallbackObject, CallbacksObject, ComponentsObject, ContactObject, ContentObject, DiscriminatorObject, EncodingObject, EncodingPropertyObject, ExampleObject, ExamplesObject, ExternalDocumentationObject, HeaderObject, HeadersObject, IExtensionName, IExtensionType, ISpecificationExtension, InfoObject, LicenseObject, LinkObject, LinkParametersObject, LinksObject, MediaTypeObject, OAuthFlowObject, OAuthFlowsObject, OpenAPIObject, OperationObject, ParameterLocation, ParameterObject, ParameterStyle, PathItemObject, PathObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, ResponsesObject, SchemaObject, SchemaObjectType, SchemasObject, ScopesObject, SecurityRequirementObject, SecuritySchemeObject, SecuritySchemeType, ServerObject, ServerVariableObject, TagObject, XmlObject };
|
|
29
|
-
}
|
|
30
30
|
//#endregion
|
|
31
|
-
export { CreateDocumentOptions,
|
|
31
|
+
export { CreateDocumentOptions, SchemaResult, ZodObjectInput, ZodOpenApiBaseMetadata, ZodOpenApiCallbackObject, ZodOpenApiCallbacksObject, ZodOpenApiComponentsObject, ZodOpenApiContentObject, ZodOpenApiExampleObject, ZodOpenApiExamplesObject, ZodOpenApiHeaderObject, ZodOpenApiHeadersObject, ZodOpenApiLinkObject, ZodOpenApiLinksObject, ZodOpenApiMediaTypeObject, ZodOpenApiMetadata, ZodOpenApiObject, ZodOpenApiOperationObject, ZodOpenApiOverride, ZodOpenApiOverrideContext, ZodOpenApiOverrideMeta, ZodOpenApiOverrideMetaContext, ZodOpenApiParameterObject, ZodOpenApiParameters, ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiResponsesObject, ZodOpenApiSchemaObject, ZodOpenApiSecuritySchemeObject, ZodOpenApiVersion, createDocument, createSchema, oas31_d_exports as oas31 };
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
import { createComponents, createPaths, createRegistry, createSchema } from "./components-BAO_3m-h.js";
|
|
2
2
|
|
|
3
3
|
//#region src/create/document.ts
|
|
4
4
|
const createDocument = (zodOpenApiObject, opts = {}) => {
|
|
5
5
|
const { paths, webhooks, components,...rest } = zodOpenApiObject;
|
|
6
6
|
const document = rest;
|
|
7
|
-
const registry =
|
|
8
|
-
const createdPaths =
|
|
7
|
+
const registry = createRegistry(components);
|
|
8
|
+
const createdPaths = createPaths(paths, registry, ["paths"]);
|
|
9
9
|
if (createdPaths) document.paths = createdPaths;
|
|
10
|
-
const createdWebhooks =
|
|
10
|
+
const createdWebhooks = createPaths(webhooks, registry, ["webhooks"]);
|
|
11
11
|
if (createdWebhooks) document.webhooks = createdWebhooks;
|
|
12
|
-
const createdComponents =
|
|
12
|
+
const createdComponents = createComponents(registry, opts);
|
|
13
13
|
if (Object.keys(createdComponents).length > 0) document.components = createdComponents;
|
|
14
14
|
return document;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
//#region packages/openapi3-ts/src/dist/oas31.ts
|
|
19
|
+
var oas31_exports = {};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { createDocument, createSchema, oas31_exports as oas31 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zod-openapi",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Convert Zod Schemas to OpenAPI v3.x documentation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -22,20 +22,21 @@
|
|
|
22
22
|
"funding": "https://github.com/samchungy/zod-openapi?sponsor=1",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"sideEffects": false,
|
|
25
|
+
"type": "module",
|
|
25
26
|
"exports": {
|
|
26
27
|
".": {
|
|
27
|
-
"import": "./dist/index.
|
|
28
|
-
"require": "./dist/index.
|
|
28
|
+
"import": "./dist/index.js",
|
|
29
|
+
"require": "./dist/index.cjs"
|
|
29
30
|
},
|
|
30
31
|
"./api": {
|
|
31
|
-
"import": "./dist/api.
|
|
32
|
-
"require": "./dist/api.
|
|
32
|
+
"import": "./dist/api.js",
|
|
33
|
+
"require": "./dist/api.cjs"
|
|
33
34
|
},
|
|
34
35
|
"./package.json": "./package.json"
|
|
35
36
|
},
|
|
36
|
-
"main": "./dist/index.
|
|
37
|
-
"module": "./dist/index.
|
|
38
|
-
"types": "./dist/index.d.
|
|
37
|
+
"main": "./dist/index.cjs",
|
|
38
|
+
"module": "./dist/index.js",
|
|
39
|
+
"types": "./dist/index.d.cts",
|
|
39
40
|
"files": [
|
|
40
41
|
"dist",
|
|
41
42
|
"api"
|
|
@@ -46,12 +47,14 @@
|
|
|
46
47
|
"@changesets/cli": "2.29.5",
|
|
47
48
|
"@redocly/cli": "1.34.4",
|
|
48
49
|
"@types/node": "22.15.21",
|
|
50
|
+
"@vitest/coverage-v8": "3.2.4",
|
|
51
|
+
"@zod-openapi/openapi3-ts": "1.0.0",
|
|
49
52
|
"ajv": "8.17.1",
|
|
50
|
-
"eslint-plugin-import-zod": "1.1.
|
|
53
|
+
"eslint-plugin-import-zod": "1.1.1",
|
|
51
54
|
"eslint-plugin-zod-openapi": "2.0.0",
|
|
52
|
-
"
|
|
53
|
-
"skuba": "11.1.0",
|
|
55
|
+
"skuba": "12.0.2",
|
|
54
56
|
"tsdown": "0.12.9",
|
|
57
|
+
"vitest": "3.2.4",
|
|
55
58
|
"yaml": "2.8.0",
|
|
56
59
|
"zod": "4.0.5"
|
|
57
60
|
},
|
|
@@ -72,14 +75,14 @@
|
|
|
72
75
|
"version": "11.0.0"
|
|
73
76
|
},
|
|
74
77
|
"scripts": {
|
|
75
|
-
"build": "pnpm
|
|
78
|
+
"build": "pnpm -r build && tsdown",
|
|
76
79
|
"copy:types": "skuba node scripts/copyTypes.ts",
|
|
77
80
|
"create:docs": " skuba node examples/simple/createSchema.ts && redocly build-docs examples/simple/openapi.yml --output=examples/simple/redoc-static.html",
|
|
78
81
|
"format": "skuba format",
|
|
79
82
|
"lint": "skuba lint",
|
|
80
83
|
"release": "pnpm build && changeset publish",
|
|
81
|
-
"test": "
|
|
82
|
-
"test:ci": "
|
|
83
|
-
"test:watch": "
|
|
84
|
+
"test": "vitest run",
|
|
85
|
+
"test:ci": "vitest run --coverage",
|
|
86
|
+
"test:watch": "vitest"
|
|
84
87
|
}
|
|
85
88
|
}
|
package/dist/api.d.mts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ComponentRegistry, Override, ZodOpenApiBaseMetadata, ZodOpenApiMetadata, ZodOpenApiOverrideContext, createComponents, createRegistry } from "./components-CERE3LYU.mjs";
|
|
2
|
-
import * as core from "zod/v4/core";
|
|
3
|
-
import { $ZodObject, $ZodType, $ZodTypes } from "zod/v4/core";
|
|
4
|
-
|
|
5
|
-
//#region src/create/object.d.ts
|
|
6
|
-
declare const unwrapZodObject: (zodType: $ZodTypes, io: "input" | "output", path: string[]) => $ZodObject;
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region src/zod.d.ts
|
|
9
|
-
declare const isAnyZodType: (schema: unknown) => schema is core.$ZodTypes;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { ComponentRegistry, Override, ZodOpenApiBaseMetadata, ZodOpenApiMetadata, ZodOpenApiOverrideContext, createComponents, createRegistry, isAnyZodType, unwrapZodObject };
|
package/dist/api.mjs
DELETED
package/dist/index.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { createComponents, createPaths, createRegistry, createSchema } from "./components-DPhhXqww.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/create/document.ts
|
|
4
|
-
const createDocument = (zodOpenApiObject, opts = {}) => {
|
|
5
|
-
const { paths, webhooks, components,...rest } = zodOpenApiObject;
|
|
6
|
-
const document = rest;
|
|
7
|
-
const registry = createRegistry(components);
|
|
8
|
-
const createdPaths = createPaths(paths, registry, ["paths"]);
|
|
9
|
-
if (createdPaths) document.paths = createdPaths;
|
|
10
|
-
const createdWebhooks = createPaths(webhooks, registry, ["webhooks"]);
|
|
11
|
-
if (createdWebhooks) document.webhooks = createdWebhooks;
|
|
12
|
-
const createdComponents = createComponents(registry, opts);
|
|
13
|
-
if (Object.keys(createdComponents).length > 0) document.components = createdComponents;
|
|
14
|
-
return document;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
|
-
export { createDocument, createSchema };
|
|
File without changes
|