@orpc/zod 0.0.0-next.f4d410a → 0.0.0-next.f4ed9ab
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 +25 -17
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/zod4/index.d.mts +302 -0
- package/dist/zod4/index.d.ts +302 -0
- package/dist/zod4/index.mjs +660 -0
- package/package.json +13 -7
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), 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,6 +49,8 @@ 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.
|
52
|
+
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with NestJS.
|
53
|
+
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
56
54
|
- [@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
55
|
- [@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
56
|
- [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
|
@@ -60,6 +58,8 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
60
58
|
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
61
59
|
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
62
60
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
61
|
+
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
|
62
|
+
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
|
63
63
|
|
64
64
|
## `@orpc/zod`
|
65
65
|
|
@@ -129,6 +129,14 @@ const InputSchema = oz.openapi(
|
|
129
129
|
)
|
130
130
|
```
|
131
131
|
|
132
|
+
## Sponsors
|
133
|
+
|
134
|
+
<p align="center">
|
135
|
+
<a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg">
|
136
|
+
<img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/>
|
137
|
+
</a>
|
138
|
+
</p>
|
139
|
+
|
132
140
|
## License
|
133
141
|
|
134
142
|
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,8 +1,7 @@
|
|
1
1
|
import { JSONSchema, ConditionalSchemaConverter, SchemaConvertOptions } from '@orpc/openapi';
|
2
2
|
import { ZodTypeAny, input, output, ZodTypeDef, CustomErrorParams, ZodType, ZodEffects } from 'zod';
|
3
3
|
import { Context } from '@orpc/server';
|
4
|
-
import {
|
5
|
-
import { StandardHandlerOptions } from '@orpc/server/standard';
|
4
|
+
import { StandardHandlerPlugin, StandardHandlerOptions } from '@orpc/server/standard';
|
6
5
|
import { AnySchema } from '@orpc/contract';
|
7
6
|
|
8
7
|
declare function getCustomJsonSchema(def: ZodTypeDef, options: {
|
@@ -35,7 +34,7 @@ declare function regexp(params?: string | CustomParams | ((input: unknown) => Cu
|
|
35
34
|
|
36
35
|
declare function url(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<URL, ZodTypeDef, URL>;
|
37
36
|
|
38
|
-
declare class ZodSmartCoercionPlugin<TContext extends Context> implements
|
37
|
+
declare class ZodSmartCoercionPlugin<TContext extends Context> implements StandardHandlerPlugin<TContext> {
|
39
38
|
init(options: StandardHandlerOptions<TContext>): void;
|
40
39
|
}
|
41
40
|
|
@@ -79,4 +78,5 @@ declare const oz: {
|
|
79
78
|
openapi: typeof customJsonSchema;
|
80
79
|
};
|
81
80
|
|
82
|
-
export {
|
81
|
+
export { ZodSmartCoercionPlugin, ZodToJsonSchemaConverter, blob, composeParams, customJsonSchema, file, getCustomJsonSchema, getCustomZodDef, oz, regexp, setCustomZodDef, url };
|
82
|
+
export type { CustomParams, CustomZodDef, ZodToJsonSchemaOptions };
|
package/dist/index.d.ts
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
import { JSONSchema, ConditionalSchemaConverter, SchemaConvertOptions } from '@orpc/openapi';
|
2
2
|
import { ZodTypeAny, input, output, ZodTypeDef, CustomErrorParams, ZodType, ZodEffects } from 'zod';
|
3
3
|
import { Context } from '@orpc/server';
|
4
|
-
import {
|
5
|
-
import { StandardHandlerOptions } from '@orpc/server/standard';
|
4
|
+
import { StandardHandlerPlugin, StandardHandlerOptions } from '@orpc/server/standard';
|
6
5
|
import { AnySchema } from '@orpc/contract';
|
7
6
|
|
8
7
|
declare function getCustomJsonSchema(def: ZodTypeDef, options: {
|
@@ -35,7 +34,7 @@ declare function regexp(params?: string | CustomParams | ((input: unknown) => Cu
|
|
35
34
|
|
36
35
|
declare function url(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<URL, ZodTypeDef, URL>;
|
37
36
|
|
38
|
-
declare class ZodSmartCoercionPlugin<TContext extends Context> implements
|
37
|
+
declare class ZodSmartCoercionPlugin<TContext extends Context> implements StandardHandlerPlugin<TContext> {
|
39
38
|
init(options: StandardHandlerOptions<TContext>): void;
|
40
39
|
}
|
41
40
|
|
@@ -79,4 +78,5 @@ declare const oz: {
|
|
79
78
|
openapi: typeof customJsonSchema;
|
80
79
|
};
|
81
80
|
|
82
|
-
export {
|
81
|
+
export { ZodSmartCoercionPlugin, ZodToJsonSchemaConverter, blob, composeParams, customJsonSchema, file, getCustomJsonSchema, getCustomZodDef, oz, regexp, setCustomZodDef, url };
|
82
|
+
export type { CustomParams, CustomZodDef, ZodToJsonSchemaOptions };
|
@@ -0,0 +1,302 @@
|
|
1
|
+
import { Context } from '@orpc/server';
|
2
|
+
import { StandardHandlerPlugin, StandardHandlerOptions } from '@orpc/server/standard';
|
3
|
+
import { AnySchema } from '@orpc/contract';
|
4
|
+
import { JSONSchema, SchemaConvertOptions, ConditionalSchemaConverter } from '@orpc/openapi';
|
5
|
+
import { Interceptor, ThrowableError, Promisable } from '@orpc/shared';
|
6
|
+
import * as zod_v4_core from 'zod/v4/core';
|
7
|
+
import { $ZodType, $input, $output } from 'zod/v4/core';
|
8
|
+
|
9
|
+
declare class experimental_ZodSmartCoercionPlugin<TContext extends Context> implements StandardHandlerPlugin<TContext> {
|
10
|
+
#private;
|
11
|
+
init(options: StandardHandlerOptions<TContext>): void;
|
12
|
+
}
|
13
|
+
|
14
|
+
interface experimental_ZodToJsonSchemaOptions {
|
15
|
+
/**
|
16
|
+
* Max depth of lazy type, if it exceeds.
|
17
|
+
*
|
18
|
+
* Used anyJsonSchema (`{}`) when reach max depth
|
19
|
+
*
|
20
|
+
* @default 2
|
21
|
+
*/
|
22
|
+
maxLazyDepth?: number;
|
23
|
+
/**
|
24
|
+
* The schema to be used to represent the any | unknown type.
|
25
|
+
*
|
26
|
+
* @default { }
|
27
|
+
*/
|
28
|
+
anyJsonSchema?: Exclude<JSONSchema, boolean>;
|
29
|
+
/**
|
30
|
+
* The schema to be used when the Zod schema is unsupported.
|
31
|
+
*
|
32
|
+
* @default { not: {} }
|
33
|
+
*/
|
34
|
+
unsupportedJsonSchema?: Exclude<JSONSchema, boolean>;
|
35
|
+
/**
|
36
|
+
* The schema to be used to represent the undefined type.
|
37
|
+
*
|
38
|
+
* @default { not: {} }
|
39
|
+
*/
|
40
|
+
undefinedJsonSchema?: Exclude<JSONSchema, boolean>;
|
41
|
+
interceptors?: Interceptor<{
|
42
|
+
schema: $ZodType;
|
43
|
+
options: SchemaConvertOptions;
|
44
|
+
lazyDepth: number;
|
45
|
+
isHandledCustomJSONSchema: boolean;
|
46
|
+
}, [
|
47
|
+
required: boolean,
|
48
|
+
jsonSchema: Exclude<JSONSchema, boolean>
|
49
|
+
], ThrowableError>[];
|
50
|
+
}
|
51
|
+
declare class experimental_ZodToJsonSchemaConverter implements ConditionalSchemaConverter {
|
52
|
+
#private;
|
53
|
+
private readonly maxLazyDepth;
|
54
|
+
private readonly anyJsonSchema;
|
55
|
+
private readonly unsupportedJsonSchema;
|
56
|
+
private readonly undefinedJsonSchema;
|
57
|
+
private readonly interceptors;
|
58
|
+
constructor(options?: experimental_ZodToJsonSchemaOptions);
|
59
|
+
condition(schema: AnySchema | undefined): boolean;
|
60
|
+
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): Promisable<[required: boolean, jsonSchema: Exclude<JSONSchema, boolean>]>;
|
61
|
+
}
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Zod registry for customizing generated JSON schema, can use both for .input and .output
|
65
|
+
*
|
66
|
+
* @example
|
67
|
+
* ```ts
|
68
|
+
* import { JSON_SCHEMA_REGISTRY } from '@orpc/zod/zod4'
|
69
|
+
*
|
70
|
+
* const user = z.object({
|
71
|
+
* name: z.string(),
|
72
|
+
* age: z.number(),
|
73
|
+
* })
|
74
|
+
*
|
75
|
+
* JSON_SCHEMA_REGISTRY.add(user, {
|
76
|
+
* examples: [{ name: 'John', age: 20 }],
|
77
|
+
* })
|
78
|
+
* ```
|
79
|
+
*/
|
80
|
+
declare const experimental_JSON_SCHEMA_REGISTRY: zod_v4_core.$ZodRegistry<{
|
81
|
+
$anchor?: string;
|
82
|
+
$comment?: string;
|
83
|
+
$defs?: Record<string, JSONSchema>;
|
84
|
+
$dynamicAnchor?: string;
|
85
|
+
$dynamicRef?: string;
|
86
|
+
$id?: string;
|
87
|
+
$ref?: string;
|
88
|
+
$schema?: string;
|
89
|
+
$vocabulary?: Record<string, string>;
|
90
|
+
additionalItems?: JSONSchema;
|
91
|
+
additionalProperties?: JSONSchema;
|
92
|
+
allOf?: (JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue>[]) | undefined;
|
93
|
+
anyOf?: (JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue>[]) | undefined;
|
94
|
+
const?: typeof $input | typeof $output | undefined;
|
95
|
+
contains?: JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue> | undefined;
|
96
|
+
contentEncoding?: "7bit" | "8bit" | "base64" | "binary" | "ietf-token" | "quoted-printable" | "x-token";
|
97
|
+
contentMediaType?: string;
|
98
|
+
contentSchema?: JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue> | undefined;
|
99
|
+
default?: typeof $input | typeof $output | undefined;
|
100
|
+
definitions?: Record<string, JSONSchema>;
|
101
|
+
dependencies?: Record<string, (string[] | readonly string[]) | JSONSchema>;
|
102
|
+
dependentRequired?: Record<string, string[] | readonly string[]>;
|
103
|
+
dependentSchemas?: Record<string, JSONSchema>;
|
104
|
+
deprecated?: boolean;
|
105
|
+
description?: string;
|
106
|
+
else?: JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue> | undefined;
|
107
|
+
enum?: ((typeof $input | typeof $output)[] | readonly (typeof $input | typeof $output)[]) | undefined;
|
108
|
+
examples?: ((typeof $input | typeof $output)[] | readonly (typeof $input | typeof $output)[]) | undefined;
|
109
|
+
exclusiveMaximum?: number;
|
110
|
+
exclusiveMinimum?: number;
|
111
|
+
format?: string;
|
112
|
+
if?: JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue> | undefined;
|
113
|
+
items?: JSONSchema;
|
114
|
+
maxContains?: number;
|
115
|
+
maximum?: number;
|
116
|
+
maxItems?: number;
|
117
|
+
maxLength?: number;
|
118
|
+
maxProperties?: number;
|
119
|
+
minContains?: number;
|
120
|
+
minimum?: number;
|
121
|
+
minItems?: number;
|
122
|
+
minLength?: number;
|
123
|
+
minProperties?: number;
|
124
|
+
multipleOf?: number;
|
125
|
+
not?: JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue> | undefined;
|
126
|
+
oneOf?: (JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue>[]) | undefined;
|
127
|
+
pattern?: string;
|
128
|
+
patternProperties?: Record<string, JSONSchema>;
|
129
|
+
prefixItems?: (JSONSchema<any, JSONSchema.TypeValue>[] | readonly JSONSchema<any, JSONSchema.TypeValue>[]) | JSONSchema;
|
130
|
+
properties?: Record<string, JSONSchema>;
|
131
|
+
propertyNames?: JSONSchema;
|
132
|
+
readOnly?: boolean;
|
133
|
+
required?: string[] | readonly string[];
|
134
|
+
then?: JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue> | undefined;
|
135
|
+
title?: string;
|
136
|
+
type?: JSONSchema.TypeValue | undefined;
|
137
|
+
unevaluatedItems?: JSONSchema;
|
138
|
+
unevaluatedProperties?: JSONSchema;
|
139
|
+
uniqueItems?: boolean;
|
140
|
+
writeOnly?: boolean;
|
141
|
+
}, zod_v4_core.$ZodType<unknown, unknown>>;
|
142
|
+
/**
|
143
|
+
* Zod registry for customizing generated JSON schema, only useful for .input
|
144
|
+
*
|
145
|
+
* @example
|
146
|
+
* ```ts
|
147
|
+
* import { JSON_SCHEMA_INPUT_REGISTRY } from '@orpc/zod/zod4'
|
148
|
+
*
|
149
|
+
* const user = z.object({
|
150
|
+
* name: z.string(),
|
151
|
+
* age: z.string().transform(v => Number(v)),
|
152
|
+
* })
|
153
|
+
*
|
154
|
+
* JSON_SCHEMA_REGISTRY.add(user, {
|
155
|
+
* examples: [{ name: 'John', age: "20" }],
|
156
|
+
* })
|
157
|
+
* ```
|
158
|
+
*/
|
159
|
+
declare const experimental_JSON_SCHEMA_INPUT_REGISTRY: zod_v4_core.$ZodRegistry<{
|
160
|
+
$anchor?: string;
|
161
|
+
$comment?: string;
|
162
|
+
$defs?: Record<string, JSONSchema>;
|
163
|
+
$dynamicAnchor?: string;
|
164
|
+
$dynamicRef?: string;
|
165
|
+
$id?: string;
|
166
|
+
$ref?: string;
|
167
|
+
$schema?: string;
|
168
|
+
$vocabulary?: Record<string, string>;
|
169
|
+
additionalItems?: JSONSchema;
|
170
|
+
additionalProperties?: JSONSchema;
|
171
|
+
allOf?: (JSONSchema<typeof $input, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $input, JSONSchema.TypeValue>[]) | undefined;
|
172
|
+
anyOf?: (JSONSchema<typeof $input, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $input, JSONSchema.TypeValue>[]) | undefined;
|
173
|
+
const?: typeof $input | undefined;
|
174
|
+
contains?: JSONSchema<typeof $input, JSONSchema.TypeValue> | undefined;
|
175
|
+
contentEncoding?: "7bit" | "8bit" | "base64" | "binary" | "ietf-token" | "quoted-printable" | "x-token";
|
176
|
+
contentMediaType?: string;
|
177
|
+
contentSchema?: JSONSchema<typeof $input, JSONSchema.TypeValue> | undefined;
|
178
|
+
default?: typeof $input | undefined;
|
179
|
+
definitions?: Record<string, JSONSchema>;
|
180
|
+
dependencies?: Record<string, (string[] | readonly string[]) | JSONSchema>;
|
181
|
+
dependentRequired?: Record<string, string[] | readonly string[]>;
|
182
|
+
dependentSchemas?: Record<string, JSONSchema>;
|
183
|
+
deprecated?: boolean;
|
184
|
+
description?: string;
|
185
|
+
else?: JSONSchema<typeof $input, JSONSchema.TypeValue> | undefined;
|
186
|
+
enum?: ((typeof $input)[] | readonly (typeof $input)[]) | undefined;
|
187
|
+
examples?: ((typeof $input)[] | readonly (typeof $input)[]) | undefined;
|
188
|
+
exclusiveMaximum?: number;
|
189
|
+
exclusiveMinimum?: number;
|
190
|
+
format?: string;
|
191
|
+
if?: JSONSchema<typeof $input, JSONSchema.TypeValue> | undefined;
|
192
|
+
items?: JSONSchema;
|
193
|
+
maxContains?: number;
|
194
|
+
maximum?: number;
|
195
|
+
maxItems?: number;
|
196
|
+
maxLength?: number;
|
197
|
+
maxProperties?: number;
|
198
|
+
minContains?: number;
|
199
|
+
minimum?: number;
|
200
|
+
minItems?: number;
|
201
|
+
minLength?: number;
|
202
|
+
minProperties?: number;
|
203
|
+
multipleOf?: number;
|
204
|
+
not?: JSONSchema<typeof $input, JSONSchema.TypeValue> | undefined;
|
205
|
+
oneOf?: (JSONSchema<typeof $input, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $input, JSONSchema.TypeValue>[]) | undefined;
|
206
|
+
pattern?: string;
|
207
|
+
patternProperties?: Record<string, JSONSchema>;
|
208
|
+
prefixItems?: (JSONSchema<any, JSONSchema.TypeValue>[] | readonly JSONSchema<any, JSONSchema.TypeValue>[]) | JSONSchema;
|
209
|
+
properties?: Record<string, JSONSchema>;
|
210
|
+
propertyNames?: JSONSchema;
|
211
|
+
readOnly?: boolean;
|
212
|
+
required?: string[] | readonly string[];
|
213
|
+
then?: JSONSchema<typeof $input, JSONSchema.TypeValue> | undefined;
|
214
|
+
title?: string;
|
215
|
+
type?: JSONSchema.TypeValue | undefined;
|
216
|
+
unevaluatedItems?: JSONSchema;
|
217
|
+
unevaluatedProperties?: JSONSchema;
|
218
|
+
uniqueItems?: boolean;
|
219
|
+
writeOnly?: boolean;
|
220
|
+
}, zod_v4_core.$ZodType<unknown, unknown>>;
|
221
|
+
/**
|
222
|
+
* Zod registry for customizing generated JSON schema, only useful for .input
|
223
|
+
*
|
224
|
+
* @example
|
225
|
+
* ```ts
|
226
|
+
* import { JSON_SCHEMA_OUTPUT_REGISTRY } from '@orpc/zod/zod4'
|
227
|
+
*
|
228
|
+
* const user = z.object({
|
229
|
+
* name: z.string(),
|
230
|
+
* age: z.string().transform(v => Number(v)),
|
231
|
+
* })
|
232
|
+
*
|
233
|
+
* JSON_SCHEMA_OUTPUT_REGISTRY.add(user, {
|
234
|
+
* examples: [{ name: 'John', age: 20 }],
|
235
|
+
* })
|
236
|
+
* ```
|
237
|
+
*/
|
238
|
+
declare const experimental_JSON_SCHEMA_OUTPUT_REGISTRY: zod_v4_core.$ZodRegistry<{
|
239
|
+
$anchor?: string;
|
240
|
+
$comment?: string;
|
241
|
+
$defs?: Record<string, JSONSchema>;
|
242
|
+
$dynamicAnchor?: string;
|
243
|
+
$dynamicRef?: string;
|
244
|
+
$id?: string;
|
245
|
+
$ref?: string;
|
246
|
+
$schema?: string;
|
247
|
+
$vocabulary?: Record<string, string>;
|
248
|
+
additionalItems?: JSONSchema;
|
249
|
+
additionalProperties?: JSONSchema;
|
250
|
+
allOf?: (JSONSchema<typeof $output, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $output, JSONSchema.TypeValue>[]) | undefined;
|
251
|
+
anyOf?: (JSONSchema<typeof $output, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $output, JSONSchema.TypeValue>[]) | undefined;
|
252
|
+
const?: typeof $output | undefined;
|
253
|
+
contains?: JSONSchema<typeof $output, JSONSchema.TypeValue> | undefined;
|
254
|
+
contentEncoding?: "7bit" | "8bit" | "base64" | "binary" | "ietf-token" | "quoted-printable" | "x-token";
|
255
|
+
contentMediaType?: string;
|
256
|
+
contentSchema?: JSONSchema<typeof $output, JSONSchema.TypeValue> | undefined;
|
257
|
+
default?: typeof $output | undefined;
|
258
|
+
definitions?: Record<string, JSONSchema>;
|
259
|
+
dependencies?: Record<string, (string[] | readonly string[]) | JSONSchema>;
|
260
|
+
dependentRequired?: Record<string, string[] | readonly string[]>;
|
261
|
+
dependentSchemas?: Record<string, JSONSchema>;
|
262
|
+
deprecated?: boolean;
|
263
|
+
description?: string;
|
264
|
+
else?: JSONSchema<typeof $output, JSONSchema.TypeValue> | undefined;
|
265
|
+
enum?: ((typeof $output)[] | readonly (typeof $output)[]) | undefined;
|
266
|
+
examples?: ((typeof $output)[] | readonly (typeof $output)[]) | undefined;
|
267
|
+
exclusiveMaximum?: number;
|
268
|
+
exclusiveMinimum?: number;
|
269
|
+
format?: string;
|
270
|
+
if?: JSONSchema<typeof $output, JSONSchema.TypeValue> | undefined;
|
271
|
+
items?: JSONSchema;
|
272
|
+
maxContains?: number;
|
273
|
+
maximum?: number;
|
274
|
+
maxItems?: number;
|
275
|
+
maxLength?: number;
|
276
|
+
maxProperties?: number;
|
277
|
+
minContains?: number;
|
278
|
+
minimum?: number;
|
279
|
+
minItems?: number;
|
280
|
+
minLength?: number;
|
281
|
+
minProperties?: number;
|
282
|
+
multipleOf?: number;
|
283
|
+
not?: JSONSchema<typeof $output, JSONSchema.TypeValue> | undefined;
|
284
|
+
oneOf?: (JSONSchema<typeof $output, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $output, JSONSchema.TypeValue>[]) | undefined;
|
285
|
+
pattern?: string;
|
286
|
+
patternProperties?: Record<string, JSONSchema>;
|
287
|
+
prefixItems?: (JSONSchema<any, JSONSchema.TypeValue>[] | readonly JSONSchema<any, JSONSchema.TypeValue>[]) | JSONSchema;
|
288
|
+
properties?: Record<string, JSONSchema>;
|
289
|
+
propertyNames?: JSONSchema;
|
290
|
+
readOnly?: boolean;
|
291
|
+
required?: string[] | readonly string[];
|
292
|
+
then?: JSONSchema<typeof $output, JSONSchema.TypeValue> | undefined;
|
293
|
+
title?: string;
|
294
|
+
type?: JSONSchema.TypeValue | undefined;
|
295
|
+
unevaluatedItems?: JSONSchema;
|
296
|
+
unevaluatedProperties?: JSONSchema;
|
297
|
+
uniqueItems?: boolean;
|
298
|
+
writeOnly?: boolean;
|
299
|
+
}, zod_v4_core.$ZodType<unknown, unknown>>;
|
300
|
+
|
301
|
+
export { experimental_JSON_SCHEMA_INPUT_REGISTRY, experimental_JSON_SCHEMA_OUTPUT_REGISTRY, experimental_JSON_SCHEMA_REGISTRY, experimental_ZodSmartCoercionPlugin, experimental_ZodToJsonSchemaConverter };
|
302
|
+
export type { experimental_ZodToJsonSchemaOptions };
|