@orpc/zod 0.0.0-next.e7ee5a9 → 0.0.0-next.e82d760
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 +28 -20
- package/dist/index.d.mts +61 -59
- package/dist/index.d.ts +61 -59
- package/dist/index.mjs +725 -794
- package/dist/zod4/index.d.mts +311 -0
- package/dist/zod4/index.d.ts +311 -0
- package/dist/zod4/index.mjs +668 -0
- package/package.json +15 -8
package/README.md
CHANGED
@@ -21,28 +21,24 @@
|
|
21
21
|
|
22
22
|
<h3 align="center">Typesafe APIs Made Simple 🪄</h3>
|
23
23
|
|
24
|
-
**oRPC is a powerful combination of RPC and OpenAPI**, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards
|
24
|
+
**oRPC is a powerful combination of RPC and OpenAPI**, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards
|
25
25
|
|
26
26
|
---
|
27
27
|
|
28
28
|
## Highlights
|
29
29
|
|
30
|
-
-
|
31
|
-
-
|
32
|
-
-
|
33
|
-
-
|
34
|
-
-
|
35
|
-
-
|
36
|
-
-
|
37
|
-
-
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
41
|
-
-
|
42
|
-
- **Reusability 🔄**: Write once and reuse your code across multiple purposes effortlessly.
|
43
|
-
- **Extendability 🔌**: Easily enhance oRPC with plugins, middleware, and interceptors.
|
44
|
-
- **Reliability 🛡️**: Well-tested, fully TypeScript, production-ready, and MIT licensed for peace of mind.
|
45
|
-
- **Simplicity 💡**: Enjoy straightforward, clean code with no hidden magic.
|
30
|
+
- **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
|
31
|
+
- **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
|
32
|
+
- **📝 Contract-First Development**: Optionally define your API contract before implementation.
|
33
|
+
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), Pinia Colada, and more.
|
34
|
+
- **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
|
35
|
+
- **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
|
36
|
+
- **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
|
37
|
+
- **⏱️ Lazy Router**: Enhance cold start times with our lazy routing feature.
|
38
|
+
- **📡 SSE & Streaming**: Enjoy full type-safe support for SSE and streaming.
|
39
|
+
- **🌍 Multi-Runtime Support**: Fast and lightweight on Cloudflare, Deno, Bun, Node.js, and beyond.
|
40
|
+
- **🔌 Extendability**: Easily extend functionality with plugins, middleware, and interceptors.
|
41
|
+
- **🛡️ Reliability**: Well-tested, TypeScript-based, production-ready, and MIT licensed.
|
46
42
|
|
47
43
|
## Documentation
|
48
44
|
|
@@ -53,11 +49,15 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
53
49
|
- [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
|
54
50
|
- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
|
55
51
|
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
56
|
-
- [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
|
57
|
-
- [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
|
58
|
-
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
59
52
|
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
53
|
+
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
|
54
|
+
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
55
|
+
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
|
56
|
+
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
57
|
+
- [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
|
60
58
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
59
|
+
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
|
60
|
+
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
|
61
61
|
|
62
62
|
## `@orpc/zod`
|
63
63
|
|
@@ -127,6 +127,14 @@ const InputSchema = oz.openapi(
|
|
127
127
|
)
|
128
128
|
```
|
129
129
|
|
130
|
+
## Sponsors
|
131
|
+
|
132
|
+
<p align="center">
|
133
|
+
<a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg">
|
134
|
+
<img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/>
|
135
|
+
</a>
|
136
|
+
</p>
|
137
|
+
|
130
138
|
## License
|
131
139
|
|
132
140
|
Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
|
package/dist/index.d.mts
CHANGED
@@ -1,89 +1,91 @@
|
|
1
|
+
import { JSONSchema, ConditionalSchemaConverter, SchemaConvertOptions } from '@orpc/openapi';
|
2
|
+
import { ZodTypeAny, input, output, ZodTypeDef, CustomErrorParams, ZodType, ZodEffects } from 'zod';
|
1
3
|
import { Context } from '@orpc/server';
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import { Schema } from '@orpc/contract';
|
5
|
-
import { JSONSchema, SchemaConverter, SchemaConvertOptions } from '@orpc/openapi';
|
6
|
-
import { StandardSchemaV1 } from '@standard-schema/spec';
|
7
|
-
import { JSONSchema as JSONSchema$1 } from 'json-schema-typed/draft-2020-12';
|
8
|
-
import { ZodTypeDef, CustomErrorParams, ZodType, ZodEffects, ZodTypeAny, input, output } from 'zod';
|
4
|
+
import { StandardHandlerPlugin, StandardHandlerOptions } from '@orpc/server/standard';
|
5
|
+
import { AnySchema } from '@orpc/contract';
|
9
6
|
|
10
|
-
declare
|
11
|
-
|
12
|
-
}
|
7
|
+
declare function getCustomJsonSchema(def: ZodTypeDef, options: {
|
8
|
+
strategy: 'input' | 'output' | 'both';
|
9
|
+
}): Exclude<JSONSchema, boolean> | undefined;
|
10
|
+
declare function customJsonSchema<T extends ZodTypeAny, TStrategy extends 'input' | 'output' | 'both' = 'both'>(schema: T, custom: Exclude<JSONSchema<TStrategy extends 'input' ? input<T> : TStrategy extends 'output' ? output<T> : input<T> & output<T>>, boolean>, options?: {
|
11
|
+
strategy?: TStrategy;
|
12
|
+
}): T;
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
not: {};
|
14
|
+
type CustomParams = CustomErrorParams & {
|
15
|
+
fatal?: boolean;
|
17
16
|
};
|
18
|
-
|
19
|
-
|
17
|
+
type CustomZodDef = {
|
18
|
+
type: 'blob' | 'regexp' | 'url';
|
19
|
+
} | {
|
20
|
+
type: 'file';
|
21
|
+
mimeType?: string;
|
20
22
|
};
|
23
|
+
declare function setCustomZodDef<T extends ZodTypeDef>(def: T, custom: CustomZodDef): void;
|
24
|
+
declare function getCustomZodDef(def: ZodTypeDef): CustomZodDef | undefined;
|
25
|
+
declare function composeParams<T = unknown>(defaultMessage: (input: T) => string, params: undefined | string | CustomParams | ((input: T) => CustomParams)): (input: T) => CustomParams;
|
26
|
+
|
27
|
+
declare function blob(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<Blob, ZodTypeDef, Blob>;
|
28
|
+
|
29
|
+
declare function file(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<File, ZodTypeDef, File> & {
|
30
|
+
type(mimeType: string, params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodEffects<ZodType<File, ZodTypeDef, File>, File, File>;
|
31
|
+
};
|
32
|
+
|
33
|
+
declare function regexp(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<RegExp, ZodTypeDef, RegExp>;
|
34
|
+
|
35
|
+
declare function url(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<URL, ZodTypeDef, URL>;
|
36
|
+
|
37
|
+
declare class ZodSmartCoercionPlugin<TContext extends Context> implements StandardHandlerPlugin<TContext> {
|
38
|
+
init(options: StandardHandlerOptions<TContext>): void;
|
39
|
+
}
|
40
|
+
|
21
41
|
interface ZodToJsonSchemaOptions {
|
22
42
|
/**
|
23
|
-
* Max depth of lazy type
|
43
|
+
* Max depth of lazy type
|
24
44
|
*
|
25
|
-
* Used `{}` when
|
45
|
+
* Used `{}` when exceed max depth
|
26
46
|
*
|
27
|
-
* @default
|
47
|
+
* @default 3
|
28
48
|
*/
|
29
49
|
maxLazyDepth?: number;
|
30
50
|
/**
|
31
|
-
*
|
51
|
+
* Max depth of nested types
|
32
52
|
*
|
33
|
-
*
|
34
|
-
*/
|
35
|
-
lazyDepth?: number;
|
36
|
-
/**
|
37
|
-
* The expected json schema for input or output zod schema
|
53
|
+
* Used anyJsonSchema (`{}`) when exceed max depth
|
38
54
|
*
|
39
|
-
* @default
|
55
|
+
* @default 10
|
40
56
|
*/
|
41
|
-
|
57
|
+
maxStructureDepth?: number;
|
42
58
|
/**
|
43
|
-
*
|
59
|
+
* The schema to be used to represent the any | unknown type.
|
44
60
|
*
|
45
|
-
* @
|
61
|
+
* @default { }
|
46
62
|
*/
|
47
|
-
|
63
|
+
anyJsonSchema?: Exclude<JSONSchema, boolean>;
|
48
64
|
/**
|
49
|
-
*
|
65
|
+
* The schema to be used when the Zod schema is unsupported.
|
50
66
|
*
|
51
|
-
* @
|
67
|
+
* @default { not: {} }
|
52
68
|
*/
|
53
|
-
|
69
|
+
unsupportedJsonSchema?: Exclude<JSONSchema, boolean>;
|
54
70
|
}
|
55
|
-
declare
|
56
|
-
|
57
|
-
|
58
|
-
|
71
|
+
declare class ZodToJsonSchemaConverter implements ConditionalSchemaConverter {
|
72
|
+
#private;
|
73
|
+
private readonly maxLazyDepth;
|
74
|
+
private readonly maxStructureDepth;
|
75
|
+
private readonly unsupportedJsonSchema;
|
76
|
+
private readonly anyJsonSchema;
|
77
|
+
constructor(options?: ZodToJsonSchemaOptions);
|
78
|
+
condition(schema: AnySchema | undefined): boolean;
|
79
|
+
convert(schema: AnySchema | undefined, options: SchemaConvertOptions, lazyDepth?: number, isHandledCustomJSONSchema?: boolean, isHandledZodDescription?: boolean, structureDepth?: number): [required: boolean, jsonSchema: Exclude<JSONSchema, boolean>];
|
59
80
|
}
|
60
81
|
|
61
|
-
type CustomZodType = 'File' | 'Blob' | 'Invalid Date' | 'RegExp' | 'URL';
|
62
|
-
type CustomParams = CustomErrorParams & {
|
63
|
-
fatal?: boolean;
|
64
|
-
};
|
65
|
-
declare function getCustomZodType(def: ZodTypeDef): CustomZodType | undefined;
|
66
|
-
declare function getCustomZodFileMimeType(def: ZodTypeDef): string | undefined;
|
67
|
-
declare function getCustomJSONSchema(def: ZodTypeDef, options?: {
|
68
|
-
mode?: 'input' | 'output';
|
69
|
-
}): Exclude<JSONSchema$1, boolean> | undefined;
|
70
|
-
declare function file(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<InstanceType<typeof File>, ZodTypeDef, InstanceType<typeof File>> & {
|
71
|
-
type(mimeType: string, params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodEffects<ZodType<InstanceType<typeof File>, ZodTypeDef, InstanceType<typeof File>>, InstanceType<typeof File>, InstanceType<typeof File>>;
|
72
|
-
};
|
73
|
-
declare function blob(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<InstanceType<typeof Blob>, ZodTypeDef, InstanceType<typeof Blob>>;
|
74
|
-
declare function invalidDate(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<Date, ZodTypeDef, Date>;
|
75
|
-
declare function regexp(options?: CustomParams): ZodType<RegExp, ZodTypeDef, RegExp>;
|
76
|
-
declare function url(options?: CustomParams): ZodType<URL, ZodTypeDef, URL>;
|
77
|
-
declare function openapi<T extends ZodTypeAny, TMode extends 'input' | 'output' | 'both' = 'both'>(schema: T, custom: Exclude<JSONSchema$1<TMode extends 'input' ? input<T> : TMode extends 'output' ? output<T> : input<T> & output<T>>, boolean>, options?: {
|
78
|
-
mode: TMode;
|
79
|
-
}): ReturnType<T['refine']>;
|
80
82
|
declare const oz: {
|
81
|
-
openapi: typeof openapi;
|
82
83
|
file: typeof file;
|
83
84
|
blob: typeof blob;
|
84
|
-
invalidDate: typeof invalidDate;
|
85
|
-
regexp: typeof regexp;
|
86
85
|
url: typeof url;
|
86
|
+
regexp: typeof regexp;
|
87
|
+
openapi: typeof customJsonSchema;
|
87
88
|
};
|
88
89
|
|
89
|
-
export {
|
90
|
+
export { ZodSmartCoercionPlugin, ZodToJsonSchemaConverter, blob, composeParams, customJsonSchema, file, getCustomJsonSchema, getCustomZodDef, oz, regexp, setCustomZodDef, url };
|
91
|
+
export type { CustomParams, CustomZodDef, ZodToJsonSchemaOptions };
|
package/dist/index.d.ts
CHANGED
@@ -1,89 +1,91 @@
|
|
1
|
+
import { JSONSchema, ConditionalSchemaConverter, SchemaConvertOptions } from '@orpc/openapi';
|
2
|
+
import { ZodTypeAny, input, output, ZodTypeDef, CustomErrorParams, ZodType, ZodEffects } from 'zod';
|
1
3
|
import { Context } from '@orpc/server';
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import { Schema } from '@orpc/contract';
|
5
|
-
import { JSONSchema, SchemaConverter, SchemaConvertOptions } from '@orpc/openapi';
|
6
|
-
import { StandardSchemaV1 } from '@standard-schema/spec';
|
7
|
-
import { JSONSchema as JSONSchema$1 } from 'json-schema-typed/draft-2020-12';
|
8
|
-
import { ZodTypeDef, CustomErrorParams, ZodType, ZodEffects, ZodTypeAny, input, output } from 'zod';
|
4
|
+
import { StandardHandlerPlugin, StandardHandlerOptions } from '@orpc/server/standard';
|
5
|
+
import { AnySchema } from '@orpc/contract';
|
9
6
|
|
10
|
-
declare
|
11
|
-
|
12
|
-
}
|
7
|
+
declare function getCustomJsonSchema(def: ZodTypeDef, options: {
|
8
|
+
strategy: 'input' | 'output' | 'both';
|
9
|
+
}): Exclude<JSONSchema, boolean> | undefined;
|
10
|
+
declare function customJsonSchema<T extends ZodTypeAny, TStrategy extends 'input' | 'output' | 'both' = 'both'>(schema: T, custom: Exclude<JSONSchema<TStrategy extends 'input' ? input<T> : TStrategy extends 'output' ? output<T> : input<T> & output<T>>, boolean>, options?: {
|
11
|
+
strategy?: TStrategy;
|
12
|
+
}): T;
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
not: {};
|
14
|
+
type CustomParams = CustomErrorParams & {
|
15
|
+
fatal?: boolean;
|
17
16
|
};
|
18
|
-
|
19
|
-
|
17
|
+
type CustomZodDef = {
|
18
|
+
type: 'blob' | 'regexp' | 'url';
|
19
|
+
} | {
|
20
|
+
type: 'file';
|
21
|
+
mimeType?: string;
|
20
22
|
};
|
23
|
+
declare function setCustomZodDef<T extends ZodTypeDef>(def: T, custom: CustomZodDef): void;
|
24
|
+
declare function getCustomZodDef(def: ZodTypeDef): CustomZodDef | undefined;
|
25
|
+
declare function composeParams<T = unknown>(defaultMessage: (input: T) => string, params: undefined | string | CustomParams | ((input: T) => CustomParams)): (input: T) => CustomParams;
|
26
|
+
|
27
|
+
declare function blob(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<Blob, ZodTypeDef, Blob>;
|
28
|
+
|
29
|
+
declare function file(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<File, ZodTypeDef, File> & {
|
30
|
+
type(mimeType: string, params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodEffects<ZodType<File, ZodTypeDef, File>, File, File>;
|
31
|
+
};
|
32
|
+
|
33
|
+
declare function regexp(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<RegExp, ZodTypeDef, RegExp>;
|
34
|
+
|
35
|
+
declare function url(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<URL, ZodTypeDef, URL>;
|
36
|
+
|
37
|
+
declare class ZodSmartCoercionPlugin<TContext extends Context> implements StandardHandlerPlugin<TContext> {
|
38
|
+
init(options: StandardHandlerOptions<TContext>): void;
|
39
|
+
}
|
40
|
+
|
21
41
|
interface ZodToJsonSchemaOptions {
|
22
42
|
/**
|
23
|
-
* Max depth of lazy type
|
43
|
+
* Max depth of lazy type
|
24
44
|
*
|
25
|
-
* Used `{}` when
|
45
|
+
* Used `{}` when exceed max depth
|
26
46
|
*
|
27
|
-
* @default
|
47
|
+
* @default 3
|
28
48
|
*/
|
29
49
|
maxLazyDepth?: number;
|
30
50
|
/**
|
31
|
-
*
|
51
|
+
* Max depth of nested types
|
32
52
|
*
|
33
|
-
*
|
34
|
-
*/
|
35
|
-
lazyDepth?: number;
|
36
|
-
/**
|
37
|
-
* The expected json schema for input or output zod schema
|
53
|
+
* Used anyJsonSchema (`{}`) when exceed max depth
|
38
54
|
*
|
39
|
-
* @default
|
55
|
+
* @default 10
|
40
56
|
*/
|
41
|
-
|
57
|
+
maxStructureDepth?: number;
|
42
58
|
/**
|
43
|
-
*
|
59
|
+
* The schema to be used to represent the any | unknown type.
|
44
60
|
*
|
45
|
-
* @
|
61
|
+
* @default { }
|
46
62
|
*/
|
47
|
-
|
63
|
+
anyJsonSchema?: Exclude<JSONSchema, boolean>;
|
48
64
|
/**
|
49
|
-
*
|
65
|
+
* The schema to be used when the Zod schema is unsupported.
|
50
66
|
*
|
51
|
-
* @
|
67
|
+
* @default { not: {} }
|
52
68
|
*/
|
53
|
-
|
69
|
+
unsupportedJsonSchema?: Exclude<JSONSchema, boolean>;
|
54
70
|
}
|
55
|
-
declare
|
56
|
-
|
57
|
-
|
58
|
-
|
71
|
+
declare class ZodToJsonSchemaConverter implements ConditionalSchemaConverter {
|
72
|
+
#private;
|
73
|
+
private readonly maxLazyDepth;
|
74
|
+
private readonly maxStructureDepth;
|
75
|
+
private readonly unsupportedJsonSchema;
|
76
|
+
private readonly anyJsonSchema;
|
77
|
+
constructor(options?: ZodToJsonSchemaOptions);
|
78
|
+
condition(schema: AnySchema | undefined): boolean;
|
79
|
+
convert(schema: AnySchema | undefined, options: SchemaConvertOptions, lazyDepth?: number, isHandledCustomJSONSchema?: boolean, isHandledZodDescription?: boolean, structureDepth?: number): [required: boolean, jsonSchema: Exclude<JSONSchema, boolean>];
|
59
80
|
}
|
60
81
|
|
61
|
-
type CustomZodType = 'File' | 'Blob' | 'Invalid Date' | 'RegExp' | 'URL';
|
62
|
-
type CustomParams = CustomErrorParams & {
|
63
|
-
fatal?: boolean;
|
64
|
-
};
|
65
|
-
declare function getCustomZodType(def: ZodTypeDef): CustomZodType | undefined;
|
66
|
-
declare function getCustomZodFileMimeType(def: ZodTypeDef): string | undefined;
|
67
|
-
declare function getCustomJSONSchema(def: ZodTypeDef, options?: {
|
68
|
-
mode?: 'input' | 'output';
|
69
|
-
}): Exclude<JSONSchema$1, boolean> | undefined;
|
70
|
-
declare function file(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<InstanceType<typeof File>, ZodTypeDef, InstanceType<typeof File>> & {
|
71
|
-
type(mimeType: string, params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodEffects<ZodType<InstanceType<typeof File>, ZodTypeDef, InstanceType<typeof File>>, InstanceType<typeof File>, InstanceType<typeof File>>;
|
72
|
-
};
|
73
|
-
declare function blob(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<InstanceType<typeof Blob>, ZodTypeDef, InstanceType<typeof Blob>>;
|
74
|
-
declare function invalidDate(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<Date, ZodTypeDef, Date>;
|
75
|
-
declare function regexp(options?: CustomParams): ZodType<RegExp, ZodTypeDef, RegExp>;
|
76
|
-
declare function url(options?: CustomParams): ZodType<URL, ZodTypeDef, URL>;
|
77
|
-
declare function openapi<T extends ZodTypeAny, TMode extends 'input' | 'output' | 'both' = 'both'>(schema: T, custom: Exclude<JSONSchema$1<TMode extends 'input' ? input<T> : TMode extends 'output' ? output<T> : input<T> & output<T>>, boolean>, options?: {
|
78
|
-
mode: TMode;
|
79
|
-
}): ReturnType<T['refine']>;
|
80
82
|
declare const oz: {
|
81
|
-
openapi: typeof openapi;
|
82
83
|
file: typeof file;
|
83
84
|
blob: typeof blob;
|
84
|
-
invalidDate: typeof invalidDate;
|
85
|
-
regexp: typeof regexp;
|
86
85
|
url: typeof url;
|
86
|
+
regexp: typeof regexp;
|
87
|
+
openapi: typeof customJsonSchema;
|
87
88
|
};
|
88
89
|
|
89
|
-
export {
|
90
|
+
export { ZodSmartCoercionPlugin, ZodToJsonSchemaConverter, blob, composeParams, customJsonSchema, file, getCustomJsonSchema, getCustomZodDef, oz, regexp, setCustomZodDef, url };
|
91
|
+
export type { CustomParams, CustomZodDef, ZodToJsonSchemaOptions };
|