zod-openapi 2.18.0 → 2.19.0-beta.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.
Files changed (70) hide show
  1. package/dist/extend.cjs +4 -0
  2. package/dist/extend.d.mts +1 -0
  3. package/dist/extend.d.ts +1 -0
  4. package/dist/extend.mjs +3 -0
  5. package/{lib-esm/extend.mjs → dist/extendZod.chunk.cjs} +2 -7
  6. package/{lib-commonjs/extend.js → dist/extendZod.chunk.mjs} +3 -24
  7. package/{lib-commonjs/index.js → dist/index.cjs} +247 -365
  8. package/dist/index.d.mts +1055 -0
  9. package/dist/index.d.ts +1055 -0
  10. package/{lib-esm → dist}/index.mjs +243 -336
  11. package/extend/index.d.ts +1 -0
  12. package/extend/package.json +5 -0
  13. package/package.json +30 -32
  14. package/lib-types/api.d.ts +0 -3
  15. package/lib-types/create/callbacks.d.ts +0 -5
  16. package/lib-types/create/components.d.ts +0 -125
  17. package/lib-types/create/content.d.ts +0 -6
  18. package/lib-types/create/document.d.ts +0 -73
  19. package/lib-types/create/parameters.d.ts +0 -10
  20. package/lib-types/create/paths.d.ts +0 -6
  21. package/lib-types/create/responses.d.ts +0 -10
  22. package/lib-types/create/schema/index.d.ts +0 -29
  23. package/lib-types/create/schema/metadata.d.ts +0 -3
  24. package/lib-types/create/schema/parsers/array.d.ts +0 -3
  25. package/lib-types/create/schema/parsers/boolean.d.ts +0 -3
  26. package/lib-types/create/schema/parsers/brand.d.ts +0 -3
  27. package/lib-types/create/schema/parsers/catch.d.ts +0 -3
  28. package/lib-types/create/schema/parsers/date.d.ts +0 -3
  29. package/lib-types/create/schema/parsers/default.d.ts +0 -3
  30. package/lib-types/create/schema/parsers/discriminatedUnion.d.ts +0 -5
  31. package/lib-types/create/schema/parsers/enum.d.ts +0 -3
  32. package/lib-types/create/schema/parsers/index.d.ts +0 -3
  33. package/lib-types/create/schema/parsers/intersection.d.ts +0 -3
  34. package/lib-types/create/schema/parsers/lazy.d.ts +0 -3
  35. package/lib-types/create/schema/parsers/literal.d.ts +0 -3
  36. package/lib-types/create/schema/parsers/manual.d.ts +0 -3
  37. package/lib-types/create/schema/parsers/nativeEnum.d.ts +0 -10
  38. package/lib-types/create/schema/parsers/null.d.ts +0 -2
  39. package/lib-types/create/schema/parsers/nullable.d.ts +0 -3
  40. package/lib-types/create/schema/parsers/number.d.ts +0 -13
  41. package/lib-types/create/schema/parsers/object.d.ts +0 -21
  42. package/lib-types/create/schema/parsers/optional.d.ts +0 -10
  43. package/lib-types/create/schema/parsers/pipeline.d.ts +0 -3
  44. package/lib-types/create/schema/parsers/preprocess.d.ts +0 -3
  45. package/lib-types/create/schema/parsers/readonly.d.ts +0 -3
  46. package/lib-types/create/schema/parsers/record.d.ts +0 -3
  47. package/lib-types/create/schema/parsers/refine.d.ts +0 -3
  48. package/lib-types/create/schema/parsers/set.d.ts +0 -3
  49. package/lib-types/create/schema/parsers/string.d.ts +0 -3
  50. package/lib-types/create/schema/parsers/transform.d.ts +0 -10
  51. package/lib-types/create/schema/parsers/tuple.d.ts +0 -3
  52. package/lib-types/create/schema/parsers/union.d.ts +0 -3
  53. package/lib-types/create/schema/parsers/unknown.d.ts +0 -3
  54. package/lib-types/create/specificationExtension.d.ts +0 -1
  55. package/lib-types/extend.d.ts +0 -1
  56. package/lib-types/extendZod.d.ts +0 -3
  57. package/lib-types/extendZodTypes.d.ts +0 -75
  58. package/lib-types/index.d.ts +0 -4
  59. package/lib-types/openapi.d.ts +0 -5
  60. package/lib-types/openapi3-ts/dist/dsl/openapi-builder30.d.ts +0 -31
  61. package/lib-types/openapi3-ts/dist/dsl/openapi-builder31.d.ts +0 -32
  62. package/lib-types/openapi3-ts/dist/index.d.ts +0 -3
  63. package/lib-types/openapi3-ts/dist/model/oas-common.d.ts +0 -15
  64. package/lib-types/openapi3-ts/dist/model/openapi30.d.ts +0 -291
  65. package/lib-types/openapi3-ts/dist/model/openapi31.d.ts +0 -298
  66. package/lib-types/openapi3-ts/dist/model/server.d.ts +0 -19
  67. package/lib-types/openapi3-ts/dist/model/specification-extension.d.ts +0 -12
  68. package/lib-types/openapi3-ts/dist/oas30.d.ts +0 -4
  69. package/lib-types/openapi3-ts/dist/oas31.d.ts +0 -4
  70. package/lib-types/zodType.d.ts +0 -42
@@ -0,0 +1 @@
1
+ export * from "../dist/extend";
@@ -0,0 +1,5 @@
1
+ {
2
+ "main": "../dist/extend.cjs",
3
+ "module": "../dist/extend.mjs",
4
+ "types": "./index.d.ts"
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod-openapi",
3
- "version": "2.18.0",
3
+ "version": "2.19.0-beta.0",
4
4
  "description": "Convert Zod Schemas to OpenAPI v3.x documentation",
5
5
  "keywords": [
6
6
  "typescript",
@@ -21,42 +21,38 @@
21
21
  },
22
22
  "license": "MIT",
23
23
  "sideEffects": [
24
- "./src/extend.ts",
25
- "./lib-esm/extend.mjs",
26
- "./lib-commonjs/extend.js"
24
+ "dist/extend.*",
25
+ "dist/side-effects/**",
26
+ "src/entries/extend.ts"
27
27
  ],
28
28
  "exports": {
29
29
  ".": {
30
- "import": "./lib-esm/index.mjs",
31
- "require": "./lib-commonjs/index.js",
32
- "types": "./lib-types/index.d.ts"
30
+ "types": {
31
+ "import": "./dist/index.d.mts",
32
+ "require": "./dist/index.d.ts"
33
+ },
34
+ "import": "./dist/index.mjs",
35
+ "require": "./dist/index.cjs"
33
36
  },
34
37
  "./extend": {
35
- "import": "./lib-esm/extend.mjs",
36
- "require": "./lib-commonjs/extend.js",
37
- "types": "./lib-types/extend.d.ts"
38
- }
39
- },
40
- "main": "./lib-commonjs/index.js",
41
- "module": "./lib-esm/index.mjs",
42
- "types": "./lib-types/index.d.ts",
43
- "typesVersions": {
44
- "*": {
45
- ".": [
46
- "lib-types/index.d.ts"
47
- ],
48
- "extend": [
49
- "lib-types/extend.d.ts"
50
- ]
51
- }
38
+ "types": {
39
+ "import": "./dist/extend.d.mts",
40
+ "require": "./dist/extend.d.ts"
41
+ },
42
+ "import": "./dist/extend.mjs",
43
+ "require": "./dist/extend.cjs"
44
+ },
45
+ "./package.json": "./package.json"
52
46
  },
47
+ "main": "./dist/index.cjs",
48
+ "module": "./dist/index.mjs",
49
+ "types": "./dist/index.d.ts",
53
50
  "files": [
54
- "lib*/**/*.d.ts",
55
- "lib*/**/*.{js,mjs}{,.map}",
56
- "lib*/**/*.json"
51
+ "dist",
52
+ "extend"
57
53
  ],
58
54
  "scripts": {
59
- "build": "pnpm copy:types && node esbuild.mjs && node esbuild.esm.mjs && tsc --allowJS false --declaration --emitDeclarationOnly --outDir lib-types --project tsconfig.build.json",
55
+ "build": "pnpm copy:types && crackle package",
60
56
  "copy:types": "skuba node scripts/copyTypes.ts",
61
57
  "create:docs": " skuba node examples/simple/createSchema.ts && redocly build-docs examples/simple/openapi.yml --output=examples/simple/redoc-static.html",
62
58
  "format": "skuba format",
@@ -67,12 +63,14 @@
67
63
  "test:watch": "skuba test --watch"
68
64
  },
69
65
  "devDependencies": {
70
- "@redocly/cli": "1.14.0",
66
+ "@arethetypeswrong/cli": "0.15.3",
67
+ "@crackle/cli": "0.15.4",
68
+ "@redocly/cli": "1.15.0",
71
69
  "@types/node": "^20.3.0",
72
- "eslint-plugin-zod-openapi": "^0.1.0",
73
- "openapi3-ts": "4.3.2",
70
+ "eslint-plugin-zod-openapi": "^0.2.0",
71
+ "openapi3-ts": "4.3.3",
74
72
  "skuba": "8.0.1",
75
- "yaml": "2.4.2",
73
+ "yaml": "2.4.5",
76
74
  "zod": "3.23.8"
77
75
  },
78
76
  "peerDependencies": {
@@ -1,3 +0,0 @@
1
- export { createComponents, getDefaultComponents, type ComponentsObject, } from './create/components';
2
- export { createMediaTypeSchema } from './create/content';
3
- export { createParamOrRef } from './create/parameters';
@@ -1,5 +0,0 @@
1
- import type { oas31 } from '../openapi3-ts/dist';
2
- import { type ComponentsObject } from './components';
3
- import type { ZodOpenApiCallbackObject } from './document';
4
- export declare const createCallback: (callbackObject: ZodOpenApiCallbackObject, components: ComponentsObject, subpath: string[]) => oas31.CallbackObject;
5
- export declare const createCallbacks: (callbacksObject: oas31.CallbackObject | undefined, components: ComponentsObject, subpath: string[]) => oas31.CallbackObject | undefined;
@@ -1,125 +0,0 @@
1
- import type { ZodType } from 'zod';
2
- import type { oas30, oas31 } from '../openapi3-ts/dist';
3
- import type { ZodOpenApiCallbackObject, ZodOpenApiComponentsObject, ZodOpenApiRequestBodyObject, ZodOpenApiResponseObject, ZodOpenApiVersion } from './document';
4
- export type CreationType = 'input' | 'output';
5
- type BaseEffect = {
6
- zodType: ZodType;
7
- path: string[];
8
- };
9
- export type ComponentEffect = BaseEffect & {
10
- type: 'component';
11
- };
12
- export type SchemaEffect = BaseEffect & {
13
- type: 'schema';
14
- creationType: CreationType;
15
- };
16
- export type Effect = ComponentEffect | SchemaEffect;
17
- export type ResolvedEffect = {
18
- creationType: CreationType;
19
- path: string[];
20
- zodType: ZodType;
21
- component?: {
22
- ref: string;
23
- zodType: ZodType;
24
- path: string[];
25
- };
26
- };
27
- export interface CompleteSchemaComponent extends BaseSchemaComponent {
28
- type: 'complete';
29
- schemaObject: oas31.SchemaObject | oas31.ReferenceObject | oas30.SchemaObject | oas30.ReferenceObject;
30
- /** Set when the created schemaObject is specific to a particular effect */
31
- effects?: Effect[];
32
- resolvedEffect?: ResolvedEffect;
33
- }
34
- /**
35
- *
36
- */
37
- export interface ManualSchemaComponent extends BaseSchemaComponent {
38
- type: 'manual';
39
- }
40
- export interface InProgressSchemaComponent extends BaseSchemaComponent {
41
- type: 'in-progress';
42
- }
43
- interface BaseSchemaComponent {
44
- ref: string;
45
- }
46
- export type SchemaComponent = CompleteSchemaComponent | ManualSchemaComponent | InProgressSchemaComponent;
47
- export type SchemaComponentMap = Map<ZodType, SchemaComponent>;
48
- export interface CompleteParameterComponent extends BaseParameterComponent {
49
- type: 'complete';
50
- paramObject: oas31.ParameterObject | oas31.ReferenceObject | oas30.ParameterObject | oas30.ReferenceObject;
51
- }
52
- export interface PartialParameterComponent extends BaseParameterComponent {
53
- type: 'manual';
54
- }
55
- interface BaseParameterComponent {
56
- ref: string;
57
- in: oas31.ParameterLocation;
58
- name: string;
59
- }
60
- export type ParameterComponent = CompleteParameterComponent | PartialParameterComponent;
61
- export type ParameterComponentMap = Map<ZodType, ParameterComponent>;
62
- export interface CompleteHeaderComponent extends BaseHeaderComponent {
63
- type: 'complete';
64
- headerObject: oas31.HeaderObject | oas31.ReferenceObject | oas30.HeaderObject | oas30.ReferenceObject;
65
- }
66
- export interface PartialHeaderComponent extends BaseHeaderComponent {
67
- type: 'manual';
68
- }
69
- interface BaseHeaderComponent {
70
- ref: string;
71
- }
72
- export type HeaderComponent = CompleteHeaderComponent | PartialHeaderComponent;
73
- export type HeaderComponentMap = Map<ZodType, HeaderComponent>;
74
- interface BaseResponseComponent {
75
- ref: string;
76
- }
77
- export interface CompleteResponseComponent extends BaseResponseComponent {
78
- type: 'complete';
79
- responseObject: oas31.ResponseObject | oas31.ReferenceObject | oas30.ResponseObject | oas30.ReferenceObject;
80
- }
81
- export interface PartialResponseComponent extends BaseResponseComponent {
82
- type: 'manual';
83
- }
84
- export type ResponseComponent = CompleteResponseComponent | PartialResponseComponent;
85
- export type ResponseComponentMap = Map<ZodOpenApiResponseObject, ResponseComponent>;
86
- interface BaseRequestBodyComponent {
87
- ref: string;
88
- }
89
- export interface CompleteRequestBodyComponent extends BaseRequestBodyComponent {
90
- type: 'complete';
91
- requestBodyObject: oas31.RequestBodyObject | oas31.ReferenceObject | oas30.RequestBodyObject | oas30.ReferenceObject;
92
- }
93
- export interface PartialRequestBodyComponent extends BaseRequestBodyComponent {
94
- type: 'manual';
95
- }
96
- export type RequestBodyComponent = CompleteRequestBodyComponent | PartialRequestBodyComponent;
97
- export type RequestBodyComponentMap = Map<ZodOpenApiRequestBodyObject, RequestBodyComponent>;
98
- export interface BaseCallbackComponent {
99
- ref: string;
100
- }
101
- export interface CompleteCallbackComponent extends BaseCallbackComponent {
102
- type: 'complete';
103
- callbackObject: ZodOpenApiCallbackObject | oas31.CallbackObject | oas30.CallbackObject;
104
- }
105
- export interface PartialCallbackComponent extends BaseCallbackComponent {
106
- type: 'manual';
107
- }
108
- export type CallbackComponent = CompleteCallbackComponent | PartialCallbackComponent;
109
- export type CallbackComponentMap = Map<ZodOpenApiCallbackObject, CallbackComponent>;
110
- export interface ComponentsObject {
111
- schemas: SchemaComponentMap;
112
- parameters: ParameterComponentMap;
113
- headers: HeaderComponentMap;
114
- requestBodies: RequestBodyComponentMap;
115
- responses: ResponseComponentMap;
116
- callbacks: CallbackComponentMap;
117
- openapi: ZodOpenApiVersion;
118
- }
119
- export declare const getDefaultComponents: (componentsObject?: ZodOpenApiComponentsObject, openapi?: ZodOpenApiVersion) => ComponentsObject;
120
- export declare const createComponentSchemaRef: (schemaRef: string) => string;
121
- export declare const createComponentResponseRef: (responseRef: string) => string;
122
- export declare const createComponentRequestBodyRef: (requestBodyRef: string) => string;
123
- export declare const createComponentCallbackRef: (callbackRef: string) => string;
124
- export declare const createComponents: (componentsObject: ZodOpenApiComponentsObject, components: ComponentsObject) => oas31.ComponentsObject | undefined;
125
- export {};
@@ -1,6 +0,0 @@
1
- import type { ZodType } from 'zod';
2
- import type { oas31 } from '../openapi3-ts/dist';
3
- import type { ComponentsObject, CreationType } from './components';
4
- import type { ZodOpenApiContentObject } from './document';
5
- export declare const createMediaTypeSchema: (schemaObject: ZodType | oas31.SchemaObject | oas31.ReferenceObject | undefined, components: ComponentsObject, type: CreationType, subpath: string[]) => oas31.SchemaObject | oas31.ReferenceObject | undefined;
6
- export declare const createContent: (contentObject: ZodOpenApiContentObject, components: ComponentsObject, type: CreationType, subpath: string[]) => oas31.ContentObject;
@@ -1,73 +0,0 @@
1
- import type { AnyZodObject, ZodType, ZodTypeDef } from 'zod';
2
- import type { OpenApiVersion } from '../openapi';
3
- import type { oas30, oas31 } from '../openapi3-ts/dist';
4
- export interface ZodOpenApiMediaTypeObject extends Omit<oas31.MediaTypeObject & oas30.MediaTypeObject, 'schema'> {
5
- schema?: ZodType | oas31.SchemaObject | oas31.ReferenceObject;
6
- }
7
- export interface ZodOpenApiContentObject {
8
- 'application/json'?: ZodOpenApiMediaTypeObject;
9
- [mediatype: string]: ZodOpenApiMediaTypeObject | undefined;
10
- }
11
- export interface ZodOpenApiRequestBodyObject extends Omit<oas31.RequestBodyObject & oas30.RequestBodyObject, 'content'> {
12
- content: ZodOpenApiContentObject;
13
- /** Use this field to auto register this request body as a component */
14
- ref?: string;
15
- }
16
- export interface ZodOpenApiResponseObject extends Omit<oas31.ResponseObject & oas30.ResponseObject, 'content' | 'headers'> {
17
- content?: ZodOpenApiContentObject;
18
- headers?: AnyZodObject | oas30.HeadersObject | oas31.HeadersObject;
19
- /** Use this field to auto register this response object as a component */
20
- ref?: string;
21
- }
22
- export interface ZodOpenApiResponsesObject extends oas31.ISpecificationExtension {
23
- default?: ZodOpenApiResponseObject | oas31.ReferenceObject | oas30.ReferenceObject;
24
- [statuscode: `${1 | 2 | 3 | 4 | 5}${string}`]: ZodOpenApiResponseObject | oas31.ReferenceObject;
25
- }
26
- export type ZodOpenApiParameters = {
27
- [type in oas31.ParameterLocation & oas30.ParameterLocation]?: ZodObjectInputType;
28
- };
29
- export interface ZodOpenApiCallbacksObject extends oas31.ISpecificationExtension {
30
- [name: string]: ZodOpenApiCallbackObject;
31
- }
32
- export interface ZodOpenApiCallbackObject extends oas31.ISpecificationExtension {
33
- /** Use this field to auto register this callback object as a component */
34
- ref?: string;
35
- [name: string]: ZodOpenApiPathItemObject | string | undefined;
36
- }
37
- export interface ZodOpenApiOperationObject extends Omit<oas31.OperationObject & oas30.OperationObject, 'requestBody' | 'responses' | 'parameters' | 'callbacks'> {
38
- parameters?: Array<ZodType | oas31.ParameterObject | oas30.ParameterObject | oas31.ReferenceObject | oas30.ReferenceObject>;
39
- requestBody?: ZodOpenApiRequestBodyObject;
40
- requestParams?: ZodOpenApiParameters;
41
- responses: ZodOpenApiResponsesObject;
42
- callbacks?: ZodOpenApiCallbacksObject;
43
- }
44
- export interface ZodOpenApiPathItemObject extends Omit<oas31.PathItemObject & oas30.PathItemObject, 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace'> {
45
- get?: ZodOpenApiOperationObject;
46
- put?: ZodOpenApiOperationObject;
47
- post?: ZodOpenApiOperationObject;
48
- delete?: ZodOpenApiOperationObject;
49
- options?: ZodOpenApiOperationObject;
50
- head?: ZodOpenApiOperationObject;
51
- patch?: ZodOpenApiOperationObject;
52
- trace?: ZodOpenApiOperationObject;
53
- }
54
- export interface ZodOpenApiPathsObject extends oas31.ISpecificationExtension {
55
- [path: string]: ZodOpenApiPathItemObject;
56
- }
57
- export interface ZodOpenApiComponentsObject extends Omit<oas31.ComponentsObject & oas30.ComponentsObject, 'schemas' | 'responses' | 'requestBodies' | 'headers' | 'parameters'> {
58
- parameters?: Record<string, ZodType | oas31.ParameterObject | oas30.ParameterObject | oas31.ReferenceObject | oas30.ReferenceObject>;
59
- schemas?: Record<string, ZodType | oas31.SchemaObject | oas31.ReferenceObject | oas30.SchemaObject | oas30.ReferenceObject>;
60
- requestBodies?: Record<string, ZodOpenApiRequestBodyObject>;
61
- headers?: Record<string, ZodType | oas31.HeaderObject | oas30.HeaderObject | oas31.ReferenceObject | oas30.ReferenceObject>;
62
- responses?: Record<string, ZodOpenApiResponseObject>;
63
- callbacks?: Record<string, ZodOpenApiCallbackObject>;
64
- }
65
- export type ZodOpenApiVersion = OpenApiVersion;
66
- export interface ZodOpenApiObject extends Omit<oas31.OpenAPIObject, 'openapi' | 'paths' | 'webhooks' | 'components'> {
67
- openapi: ZodOpenApiVersion;
68
- paths?: ZodOpenApiPathsObject;
69
- webhooks?: ZodOpenApiPathsObject;
70
- components?: ZodOpenApiComponentsObject;
71
- }
72
- export type ZodObjectInputType<Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Record<string, unknown>> = ZodType<Output, Def, Input>;
73
- export declare const createDocument: (zodOpenApiObject: ZodOpenApiObject) => oas31.OpenAPIObject;
@@ -1,10 +0,0 @@
1
- import type { AnyZodObject, ZodType } from 'zod';
2
- import type { oas30, oas31 } from '../openapi3-ts/dist';
3
- import type { ComponentsObject } from './components';
4
- import type { ZodObjectInputType, ZodOpenApiParameters } from './document';
5
- export declare const createComponentParamRef: (ref: string) => string;
6
- export declare const createBaseParameter: (schema: ZodType, components: ComponentsObject, subpath: string[]) => oas31.BaseParameterObject;
7
- export declare const createParamOrRef: (zodSchema: ZodType, components: ComponentsObject, subpath: string[], type?: keyof ZodOpenApiParameters, name?: string) => oas31.ParameterObject | oas31.ReferenceObject;
8
- export declare const createManualParameters: (parameters: Array<oas31.ParameterObject | oas31.ReferenceObject | oas30.ParameterObject | oas30.ReferenceObject | ZodType> | undefined, components: ComponentsObject, subpath: string[]) => Array<oas31.ParameterObject | oas31.ReferenceObject>;
9
- export declare const createParametersObject: (parameters: Array<oas31.ParameterObject | oas31.ReferenceObject | oas30.ParameterObject | oas30.ReferenceObject | ZodType> | undefined, requestParams: ZodOpenApiParameters | undefined, components: ComponentsObject, subpath: string[]) => Array<oas31.ParameterObject | oas31.ReferenceObject> | undefined;
10
- export declare const getZodObject: (schema: ZodObjectInputType, type: 'input' | 'output') => AnyZodObject;
@@ -1,6 +0,0 @@
1
- import type { oas31 } from '../openapi3-ts/dist';
2
- import { type ComponentsObject } from './components';
3
- import type { ZodOpenApiPathItemObject, ZodOpenApiPathsObject, ZodOpenApiRequestBodyObject } from './document';
4
- export declare const createRequestBody: (requestBodyObject: ZodOpenApiRequestBodyObject | undefined, components: ComponentsObject, subpath: string[]) => oas31.ReferenceObject | oas31.RequestBodyObject | undefined;
5
- export declare const createPathItem: (pathObject: ZodOpenApiPathItemObject, components: ComponentsObject, path: string[]) => oas31.PathItemObject;
6
- export declare const createPaths: (pathsObject: ZodOpenApiPathsObject | undefined, components: ComponentsObject) => oas31.PathsObject | undefined;
@@ -1,10 +0,0 @@
1
- import type { AnyZodObject, ZodType } from 'zod';
2
- import type { oas30, oas31 } from '../openapi3-ts/dist';
3
- import { type ComponentsObject } from './components';
4
- import type { ZodOpenApiResponseObject, ZodOpenApiResponsesObject } from './document';
5
- export declare const createResponseHeaders: (responseHeaders: oas31.HeadersObject | oas30.HeadersObject | AnyZodObject | undefined, components: ComponentsObject) => oas31.ResponseObject['headers'];
6
- export declare const createHeaderOrRef: (schema: ZodType, components: ComponentsObject) => oas31.BaseParameterObject | oas31.ReferenceObject;
7
- export declare const createBaseHeader: (schema: ZodType, components: ComponentsObject) => oas31.BaseParameterObject;
8
- export declare const createComponentHeaderRef: (ref: string) => string;
9
- export declare const createResponse: (responseObject: ZodOpenApiResponseObject | oas31.ReferenceObject, components: ComponentsObject, subpath: string[]) => oas31.ResponseObject | oas31.ReferenceObject;
10
- export declare const createResponses: (responsesObject: ZodOpenApiResponsesObject, components: ComponentsObject, subpath: string[]) => oas31.ResponsesObject;
@@ -1,29 +0,0 @@
1
- import type { ZodType, ZodTypeDef } from 'zod';
2
- import type { oas31 } from '../../openapi3-ts/dist';
3
- import { type ComponentsObject, type CreationType, type Effect, type SchemaComponent } from '../components';
4
- export type LazyMap = Map<ZodType, true>;
5
- export interface SchemaState {
6
- components: ComponentsObject;
7
- type: CreationType;
8
- path: string[];
9
- visited: Set<ZodType>;
10
- }
11
- export declare const createNewSchema: <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState) => Schema;
12
- export declare const createNewRef: <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(ref: string, zodSchema: ZodType<Output, Def, Input>, state: SchemaState) => Schema;
13
- export declare const createExistingRef: <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, component: SchemaComponent | undefined, state: SchemaState) => Schema | undefined;
14
- export type BaseObject = {
15
- effects?: Effect[];
16
- };
17
- export type RefObject = BaseObject & {
18
- type: 'ref';
19
- schema: oas31.ReferenceObject;
20
- zodType: ZodType;
21
- };
22
- export type SchemaObject = BaseObject & {
23
- type: 'schema';
24
- schema: oas31.SchemaObject;
25
- };
26
- export type Schema = SchemaObject | RefObject;
27
- export declare const createSchemaOrRef: <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState) => Schema;
28
- export declare const createSchemaObject: <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState, subpath: string[]) => Schema;
29
- export declare const createSchema: <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState, subpath: string[]) => oas31.SchemaObject | oas31.ReferenceObject;
@@ -1,3 +0,0 @@
1
- import type { oas31 } from '../../openapi3-ts/dist';
2
- import type { Schema } from '.';
3
- export declare const enhanceWithMetadata: (schema: Schema, metadata: oas31.SchemaObject | oas31.ReferenceObject) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ArrayCardinality, ZodArray, ZodTypeAny } from 'zod';
2
- import { type Schema, type SchemaState } from '../../schema';
3
- export declare const createArraySchema: <T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many">(zodArray: ZodArray<T, Cardinality>, state: SchemaState) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodBoolean } from 'zod';
2
- import type { Schema } from '..';
3
- export declare const createBooleanSchema: (_zodBoolean: ZodBoolean) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodBranded, ZodTypeAny } from 'zod';
2
- import { type Schema, type SchemaState } from '../../schema';
3
- export declare const createBrandedSchema: <T extends ZodTypeAny, B extends string | number | symbol>(zodBranded: ZodBranded<T, B>, state: SchemaState) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodCatch, ZodTypeAny } from 'zod';
2
- import { type Schema, type SchemaState } from '../../schema';
3
- export declare const createCatchSchema: <T extends ZodTypeAny>(zodCatch: ZodCatch<T>, state: SchemaState) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodDate } from 'zod';
2
- import type { Schema } from '..';
3
- export declare const createDateSchema: (_zodDate: ZodDate) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodDefault, ZodTypeAny } from 'zod';
2
- import { type Schema, type SchemaState } from '../../schema';
3
- export declare const createDefaultSchema: <T extends ZodTypeAny>(zodDefault: ZodDefault<T>, state: SchemaState) => Schema;
@@ -1,5 +0,0 @@
1
- import type { AnyZodObject, ZodDiscriminatedUnion, ZodDiscriminatedUnionOption } from 'zod';
2
- import type { oas31 } from '../../../openapi3-ts/dist';
3
- import { type Schema, type SchemaState } from '../../schema';
4
- export declare const createDiscriminatedUnionSchema: <Discriminator extends string, Options extends ZodDiscriminatedUnionOption<Discriminator>[]>(zodDiscriminatedUnion: ZodDiscriminatedUnion<Discriminator, Options>, state: SchemaState) => Schema;
5
- export declare const mapDiscriminator: (schemas: Array<oas31.SchemaObject | oas31.ReferenceObject>, zodObjects: AnyZodObject[], discriminator: unknown, state: SchemaState) => oas31.SchemaObject['discriminator'];
@@ -1,3 +0,0 @@
1
- import type { ZodEnum } from 'zod';
2
- import type { Schema } from '..';
3
- export declare const createEnumSchema: <T extends [string, ...string[]]>(zodEnum: ZodEnum<T>) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodType, ZodTypeDef } from 'zod';
2
- import type { Schema, SchemaState } from '../../schema';
3
- export declare const createSchemaSwitch: <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodIntersection, ZodTypeAny } from 'zod';
2
- import { type Schema, type SchemaState } from '../../schema';
3
- export declare const createIntersectionSchema: <T extends ZodTypeAny, U extends ZodTypeAny>(zodIntersection: ZodIntersection<T, U>, state: SchemaState) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodLazy, ZodTypeAny } from 'zod';
2
- import { type Schema, type SchemaState } from '../../schema';
3
- export declare const createLazySchema: <T extends ZodTypeAny>(zodLazy: ZodLazy<T>, state: SchemaState) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodLiteral } from 'zod';
2
- import type { Schema, SchemaState } from '..';
3
- export declare const createLiteralSchema: (zodLiteral: ZodLiteral<unknown>, state: SchemaState) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodType, ZodTypeDef } from 'zod';
2
- import type { Schema, SchemaState } from '../../schema';
3
- export declare const createManualTypeSchema: <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(zodSchema: ZodType<Output, Def, Input>, state: SchemaState) => Schema;
@@ -1,10 +0,0 @@
1
- import type { EnumLike, ZodNativeEnum } from 'zod';
2
- import type { Schema, SchemaState } from '../../schema';
3
- export declare const createNativeEnumSchema: <T extends EnumLike>(zodEnum: ZodNativeEnum<T>, state: SchemaState) => Schema;
4
- interface StringsAndNumbers {
5
- strings: string[];
6
- numbers: number[];
7
- }
8
- export declare const getValidEnumValues: (enumValues: EnumLike) => number[];
9
- export declare const sortStringsAndNumbers: (values: Array<string | number>) => StringsAndNumbers;
10
- export {};
@@ -1,2 +0,0 @@
1
- import type { Schema } from '..';
2
- export declare const createNullSchema: () => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodNullable, ZodTypeAny } from 'zod';
2
- import { type Schema, type SchemaState } from '../../schema';
3
- export declare const createNullableSchema: <T extends ZodTypeAny>(zodNullable: ZodNullable<T>, state: SchemaState) => Schema;
@@ -1,13 +0,0 @@
1
- import type { ZodNumber, ZodNumberCheck } from 'zod';
2
- import type { oas30, oas31 } from '../../../openapi3-ts/dist';
3
- import type { ZodOpenApiVersion } from '../../document';
4
- import type { Schema, SchemaState } from '../../schema';
5
- export declare const createNumberSchema: (zodNumber: ZodNumber, state: SchemaState) => Schema;
6
- export declare const mapMaximum: (zodNumberCheck: ZodNumberCheckMap, openapi: ZodOpenApiVersion) => Pick<oas31.SchemaObject | oas30.SchemaObject, 'maximum' | 'exclusiveMaximum'> | undefined;
7
- export declare const mapMinimum: (zodNumberCheck: ZodNumberCheckMap, openapi: ZodOpenApiVersion) => Pick<oas31.SchemaObject | oas30.SchemaObject, 'minimum' | 'exclusiveMinimum'> | undefined;
8
- type ZodNumberCheckMap = {
9
- [kind in ZodNumberCheck['kind']]?: Extract<ZodNumberCheck, {
10
- kind: kind;
11
- }>;
12
- };
13
- export {};
@@ -1,21 +0,0 @@
1
- import type { UnknownKeysParam, ZodObject, ZodRawShape, ZodType, ZodTypeAny, objectInputType, objectOutputType } from 'zod';
2
- import type { oas31 } from '../../../openapi3-ts/dist';
3
- import { type Effect } from '../../components';
4
- import { type Schema, type SchemaState } from '../../schema';
5
- export declare const createObjectSchema: <T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<T, Catchall, UnknownKeys>, Input = objectInputType<T, Catchall, UnknownKeys>>(zodObject: ZodObject<T, UnknownKeys, Catchall, Output, Input>, state: SchemaState) => Schema;
6
- export declare const createExtendedSchema: <T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<T, Catchall, UnknownKeys>, Input = objectInputType<T, Catchall, UnknownKeys>>(zodObject: ZodObject<T, UnknownKeys, Catchall, Output, Input>, baseZodObject: ZodObject<T, UnknownKeys, Catchall, Output, Input> | undefined, state: SchemaState) => Schema | undefined;
7
- interface AdditionalPropertyOptions {
8
- unknownKeys?: UnknownKeysParam;
9
- catchAll: ZodType;
10
- }
11
- export declare const createObjectSchemaFromShape: (shape: ZodRawShape, { unknownKeys, catchAll }: AdditionalPropertyOptions, state: SchemaState) => Schema;
12
- export declare const mapRequired: (shape: ZodRawShape, state: SchemaState) => {
13
- required: string[];
14
- effects?: Effect[];
15
- } | undefined;
16
- interface PropertyMap {
17
- properties: NonNullable<oas31.SchemaObject['properties']>;
18
- effects: Array<Effect[] | undefined>;
19
- }
20
- export declare const mapProperties: (shape: ZodRawShape, state: SchemaState) => PropertyMap | undefined;
21
- export {};
@@ -1,10 +0,0 @@
1
- import type { ZodOptional, ZodTypeAny } from 'zod';
2
- import type { Effect } from '../../components';
3
- import { type Schema, type SchemaState } from '../../schema';
4
- export declare const createOptionalSchema: <T extends ZodTypeAny>(zodOptional: ZodOptional<T>, state: SchemaState) => Schema;
5
- type OptionalResult = {
6
- optional: boolean;
7
- effects?: Effect[];
8
- };
9
- export declare const isOptionalSchema: (zodSchema: ZodTypeAny, state: SchemaState) => OptionalResult;
10
- export {};
@@ -1,3 +0,0 @@
1
- import type { ZodPipeline, ZodTypeAny } from 'zod';
2
- import { type Schema, type SchemaState } from '../../schema';
3
- export declare const createPipelineSchema: <A extends ZodTypeAny, B extends ZodTypeAny>(zodPipeline: ZodPipeline<A, B>, state: SchemaState) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodEffects, ZodTypeAny, input, output } from 'zod';
2
- import { type Schema, type SchemaState } from '../../schema';
3
- export declare const createPreprocessSchema: <T extends ZodTypeAny, Output = output<T>, Input = input<T>>(zodPreprocess: ZodEffects<T, Output, Input>, state: SchemaState) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodReadonly, ZodTypeAny } from 'zod';
2
- import { type Schema, type SchemaState } from '../../schema';
3
- export declare const createReadonlySchema: <T extends ZodTypeAny>(zodReadonly: ZodReadonly<T>, state: SchemaState) => Schema;
@@ -1,3 +0,0 @@
1
- import type { KeySchema, ZodRecord, ZodString, ZodTypeAny } from 'zod';
2
- import { type Schema, type SchemaState } from '../../schema';
3
- export declare const createRecordSchema: <Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny>(zodRecord: ZodRecord<Key, Value>, state: SchemaState) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodEffects, ZodTypeAny, input, output } from 'zod';
2
- import { type Schema, type SchemaState } from '../../schema';
3
- export declare const createRefineSchema: <T extends ZodTypeAny, Output = output<T>, Input = input<T>>(zodRefine: ZodEffects<T, Output, Input>, state: SchemaState) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodSet, ZodTypeAny } from 'zod';
2
- import { type Schema, type SchemaState } from '../../schema';
3
- export declare const createSetSchema: <Value extends ZodTypeAny = ZodTypeAny>(zodSet: ZodSet<Value>, state: SchemaState) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodString } from 'zod';
2
- import type { Schema, SchemaState } from '..';
3
- export declare const createStringSchema: (zodString: ZodString, state: SchemaState) => Schema;
@@ -1,10 +0,0 @@
1
- import type { ZodEffects, ZodTypeAny, input, output } from 'zod';
2
- import type { oas31 } from '../../../openapi3-ts/dist';
3
- import type { Effect, ResolvedEffect } from '../../components';
4
- import { type Schema, type SchemaState } from '../../schema';
5
- export declare const createTransformSchema: <T extends ZodTypeAny, Output = output<T>, Input = input<T>>(zodTransform: ZodEffects<T, Output, Input>, state: SchemaState) => Schema;
6
- export declare const createManualOutputTransformSchema: <T extends ZodTypeAny, Output = output<T>, Input = input<T>>(zodTransform: ZodEffects<T, Output, Input>, state: SchemaState) => oas31.SchemaObject;
7
- export declare const throwTransformError: (effect: ResolvedEffect) => never;
8
- export declare const resolveEffect: (effects: Effect[], state: SchemaState) => ResolvedEffect | undefined;
9
- export declare const verifyEffects: (effects: Effect[], state: SchemaState) => void;
10
- export declare const flattenEffects: (effects: Array<Effect[] | undefined>) => Effect[] | undefined;
@@ -1,3 +0,0 @@
1
- import type { ZodTuple, ZodTypeAny } from 'zod';
2
- import { type Schema, type SchemaState } from '../../schema';
3
- export declare const createTupleSchema: <T extends [] | [ZodTypeAny, ...ZodTypeAny[]] = [ZodTypeAny, ...ZodTypeAny[]], Rest extends ZodTypeAny | null = null>(zodTuple: ZodTuple<T, Rest>, state: SchemaState) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodTypeAny, ZodUnion } from 'zod';
2
- import { type Schema, type SchemaState } from '../../schema';
3
- export declare const createUnionSchema: <T extends readonly [ZodTypeAny, ...ZodTypeAny[]]>(zodUnion: ZodUnion<T>, state: SchemaState) => Schema;
@@ -1,3 +0,0 @@
1
- import type { ZodAny, ZodUnknown } from 'zod';
2
- import type { Schema } from '..';
3
- export declare const createUnknownSchema: (_zodUnknown: ZodUnknown | ZodAny) => Schema;
@@ -1 +0,0 @@
1
- export declare const isISpecificationExtension: (key: string) => key is `x-${string}`;
@@ -1 +0,0 @@
1
- export * from './extendZodTypes';
@@ -1,3 +0,0 @@
1
- import type { z } from 'zod';
2
- import './extendZodTypes';
3
- export declare function extendZodWithOpenApi(zod: typeof z): void;