@orpc/zod 0.0.0-next.f99e554 → 0.0.0-next.fb0d07c
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 +142 -0
- package/dist/index.d.mts +82 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.mjs +822 -0
- 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 +19 -12
- package/dist/index.js +0 -973
- package/dist/src/coercer.d.ts +0 -6
- package/dist/src/converter.d.ts +0 -50
- package/dist/src/index.d.ts +0 -4
- package/dist/src/schemas.d.ts +0 -31
@@ -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 } 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
|
+
]>[];
|
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): [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 };
|
@@ -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 } 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
|
+
]>[];
|
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): [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 };
|