@orpc/zod 0.0.0-next.c84c835 → 0.0.0-next.c8607a4
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 +1 -1
- package/dist/zod4/index.d.mts +8 -8
- package/dist/zod4/index.d.ts +8 -8
- package/dist/zod4/index.mjs +12 -11
- package/package.json +6 -6
package/README.md
CHANGED
@@ -86,7 +86,7 @@ const Example = z.object({
|
|
86
86
|
|
87
87
|
```ts
|
88
88
|
import { OpenAPIGenerator } from '@orpc/openapi'
|
89
|
-
import {
|
89
|
+
import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4'
|
90
90
|
|
91
91
|
const openAPIGenerator = new OpenAPIGenerator({
|
92
92
|
schemaConverters: [new ZodToJsonSchemaConverter()],
|
package/dist/zod4/index.d.mts
CHANGED
@@ -14,7 +14,7 @@ declare class experimental_ZodSmartCoercionPlugin<TContext extends Context> impl
|
|
14
14
|
init(options: StandardHandlerOptions<TContext>): void;
|
15
15
|
}
|
16
16
|
|
17
|
-
interface
|
17
|
+
interface ZodToJsonSchemaConverterOptions {
|
18
18
|
/**
|
19
19
|
* Max depth of lazy type.
|
20
20
|
*
|
@@ -59,7 +59,7 @@ interface experimental_ZodToJsonSchemaConverterOptions {
|
|
59
59
|
jsonSchema: Exclude<JSONSchema, boolean>
|
60
60
|
]>[];
|
61
61
|
}
|
62
|
-
declare class
|
62
|
+
declare class ZodToJsonSchemaConverter implements ConditionalSchemaConverter {
|
63
63
|
#private;
|
64
64
|
private readonly maxLazyDepth;
|
65
65
|
private readonly maxStructureDepth;
|
@@ -67,7 +67,7 @@ declare class experimental_ZodToJsonSchemaConverter implements ConditionalSchema
|
|
67
67
|
private readonly unsupportedJsonSchema;
|
68
68
|
private readonly undefinedJsonSchema;
|
69
69
|
private readonly interceptors;
|
70
|
-
constructor(options?:
|
70
|
+
constructor(options?: ZodToJsonSchemaConverterOptions);
|
71
71
|
condition(schema: AnySchema | undefined): boolean;
|
72
72
|
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: Exclude<JSONSchema, boolean>];
|
73
73
|
}
|
@@ -89,7 +89,7 @@ declare class experimental_ZodToJsonSchemaConverter implements ConditionalSchema
|
|
89
89
|
* })
|
90
90
|
* ```
|
91
91
|
*/
|
92
|
-
declare const
|
92
|
+
declare const JSON_SCHEMA_REGISTRY: zod_v4_core.$ZodRegistry<{
|
93
93
|
$anchor?: string;
|
94
94
|
$comment?: string;
|
95
95
|
$defs?: Record<string, JSONSchema>;
|
@@ -168,7 +168,7 @@ declare const experimental_JSON_SCHEMA_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
168
168
|
* })
|
169
169
|
* ```
|
170
170
|
*/
|
171
|
-
declare const
|
171
|
+
declare const JSON_SCHEMA_INPUT_REGISTRY: zod_v4_core.$ZodRegistry<{
|
172
172
|
$anchor?: string;
|
173
173
|
$comment?: string;
|
174
174
|
$defs?: Record<string, JSONSchema>;
|
@@ -247,7 +247,7 @@ declare const experimental_JSON_SCHEMA_INPUT_REGISTRY: zod_v4_core.$ZodRegistry<
|
|
247
247
|
* })
|
248
248
|
* ```
|
249
249
|
*/
|
250
|
-
declare const
|
250
|
+
declare const JSON_SCHEMA_OUTPUT_REGISTRY: zod_v4_core.$ZodRegistry<{
|
251
251
|
$anchor?: string;
|
252
252
|
$comment?: string;
|
253
253
|
$defs?: Record<string, JSONSchema>;
|
@@ -310,5 +310,5 @@ declare const experimental_JSON_SCHEMA_OUTPUT_REGISTRY: zod_v4_core.$ZodRegistry
|
|
310
310
|
writeOnly?: boolean;
|
311
311
|
}, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
312
312
|
|
313
|
-
export {
|
314
|
-
export type {
|
313
|
+
export { JSON_SCHEMA_INPUT_REGISTRY, JSON_SCHEMA_OUTPUT_REGISTRY, JSON_SCHEMA_REGISTRY, ZodToJsonSchemaConverter, experimental_ZodSmartCoercionPlugin };
|
314
|
+
export type { ZodToJsonSchemaConverterOptions };
|
package/dist/zod4/index.d.ts
CHANGED
@@ -14,7 +14,7 @@ declare class experimental_ZodSmartCoercionPlugin<TContext extends Context> impl
|
|
14
14
|
init(options: StandardHandlerOptions<TContext>): void;
|
15
15
|
}
|
16
16
|
|
17
|
-
interface
|
17
|
+
interface ZodToJsonSchemaConverterOptions {
|
18
18
|
/**
|
19
19
|
* Max depth of lazy type.
|
20
20
|
*
|
@@ -59,7 +59,7 @@ interface experimental_ZodToJsonSchemaConverterOptions {
|
|
59
59
|
jsonSchema: Exclude<JSONSchema, boolean>
|
60
60
|
]>[];
|
61
61
|
}
|
62
|
-
declare class
|
62
|
+
declare class ZodToJsonSchemaConverter implements ConditionalSchemaConverter {
|
63
63
|
#private;
|
64
64
|
private readonly maxLazyDepth;
|
65
65
|
private readonly maxStructureDepth;
|
@@ -67,7 +67,7 @@ declare class experimental_ZodToJsonSchemaConverter implements ConditionalSchema
|
|
67
67
|
private readonly unsupportedJsonSchema;
|
68
68
|
private readonly undefinedJsonSchema;
|
69
69
|
private readonly interceptors;
|
70
|
-
constructor(options?:
|
70
|
+
constructor(options?: ZodToJsonSchemaConverterOptions);
|
71
71
|
condition(schema: AnySchema | undefined): boolean;
|
72
72
|
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): [required: boolean, jsonSchema: Exclude<JSONSchema, boolean>];
|
73
73
|
}
|
@@ -89,7 +89,7 @@ declare class experimental_ZodToJsonSchemaConverter implements ConditionalSchema
|
|
89
89
|
* })
|
90
90
|
* ```
|
91
91
|
*/
|
92
|
-
declare const
|
92
|
+
declare const JSON_SCHEMA_REGISTRY: zod_v4_core.$ZodRegistry<{
|
93
93
|
$anchor?: string;
|
94
94
|
$comment?: string;
|
95
95
|
$defs?: Record<string, JSONSchema>;
|
@@ -168,7 +168,7 @@ declare const experimental_JSON_SCHEMA_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
168
168
|
* })
|
169
169
|
* ```
|
170
170
|
*/
|
171
|
-
declare const
|
171
|
+
declare const JSON_SCHEMA_INPUT_REGISTRY: zod_v4_core.$ZodRegistry<{
|
172
172
|
$anchor?: string;
|
173
173
|
$comment?: string;
|
174
174
|
$defs?: Record<string, JSONSchema>;
|
@@ -247,7 +247,7 @@ declare const experimental_JSON_SCHEMA_INPUT_REGISTRY: zod_v4_core.$ZodRegistry<
|
|
247
247
|
* })
|
248
248
|
* ```
|
249
249
|
*/
|
250
|
-
declare const
|
250
|
+
declare const JSON_SCHEMA_OUTPUT_REGISTRY: zod_v4_core.$ZodRegistry<{
|
251
251
|
$anchor?: string;
|
252
252
|
$comment?: string;
|
253
253
|
$defs?: Record<string, JSONSchema>;
|
@@ -310,5 +310,5 @@ declare const experimental_JSON_SCHEMA_OUTPUT_REGISTRY: zod_v4_core.$ZodRegistry
|
|
310
310
|
writeOnly?: boolean;
|
311
311
|
}, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
312
312
|
|
313
|
-
export {
|
314
|
-
export type {
|
313
|
+
export { JSON_SCHEMA_INPUT_REGISTRY, JSON_SCHEMA_OUTPUT_REGISTRY, JSON_SCHEMA_REGISTRY, ZodToJsonSchemaConverter, experimental_ZodSmartCoercionPlugin };
|
314
|
+
export type { ZodToJsonSchemaConverterOptions };
|
package/dist/zod4/index.mjs
CHANGED
@@ -269,11 +269,11 @@ class experimental_ZodSmartCoercionPlugin {
|
|
269
269
|
}
|
270
270
|
}
|
271
271
|
|
272
|
-
const
|
273
|
-
const
|
274
|
-
const
|
272
|
+
const JSON_SCHEMA_REGISTRY = registry();
|
273
|
+
const JSON_SCHEMA_INPUT_REGISTRY = registry();
|
274
|
+
const JSON_SCHEMA_OUTPUT_REGISTRY = registry();
|
275
275
|
|
276
|
-
class
|
276
|
+
class ZodToJsonSchemaConverter {
|
277
277
|
maxLazyDepth;
|
278
278
|
maxStructureDepth;
|
279
279
|
anyJsonSchema;
|
@@ -627,18 +627,19 @@ class experimental_ZodToJsonSchemaConverter {
|
|
627
627
|
);
|
628
628
|
}
|
629
629
|
#getCustomJsonSchema(schema, options) {
|
630
|
-
if (options.strategy === "input" &&
|
631
|
-
return
|
630
|
+
if (options.strategy === "input" && JSON_SCHEMA_INPUT_REGISTRY.has(schema)) {
|
631
|
+
return JSON_SCHEMA_INPUT_REGISTRY.get(schema);
|
632
632
|
}
|
633
|
-
if (options.strategy === "output" &&
|
634
|
-
return
|
633
|
+
if (options.strategy === "output" && JSON_SCHEMA_OUTPUT_REGISTRY.has(schema)) {
|
634
|
+
return JSON_SCHEMA_OUTPUT_REGISTRY.get(schema);
|
635
635
|
}
|
636
|
-
if (
|
637
|
-
return
|
636
|
+
if (JSON_SCHEMA_REGISTRY.has(schema)) {
|
637
|
+
return JSON_SCHEMA_REGISTRY.get(schema);
|
638
638
|
}
|
639
639
|
const global = globalRegistry.get(schema);
|
640
640
|
if (global) {
|
641
641
|
return {
|
642
|
+
title: global.title,
|
642
643
|
description: global.description,
|
643
644
|
examples: Array.isArray(global.examples) ? global.examples : void 0
|
644
645
|
};
|
@@ -676,4 +677,4 @@ class experimental_ZodToJsonSchemaConverter {
|
|
676
677
|
}
|
677
678
|
}
|
678
679
|
|
679
|
-
export {
|
680
|
+
export { JSON_SCHEMA_INPUT_REGISTRY, JSON_SCHEMA_OUTPUT_REGISTRY, JSON_SCHEMA_REGISTRY, ZodToJsonSchemaConverter, experimental_ZodSmartCoercionPlugin };
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/zod",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.0-next.
|
4
|
+
"version": "0.0.0-next.c8607a4",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -30,15 +30,15 @@
|
|
30
30
|
],
|
31
31
|
"peerDependencies": {
|
32
32
|
"zod": ">=3.25.0",
|
33
|
-
"@orpc/contract": "0.0.0-next.
|
34
|
-
"@orpc/server": "0.0.0-next.
|
33
|
+
"@orpc/contract": "0.0.0-next.c8607a4",
|
34
|
+
"@orpc/server": "0.0.0-next.c8607a4"
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
37
|
"escape-string-regexp": "^5.0.0",
|
38
38
|
"wildcard-match": "^5.1.3",
|
39
|
-
"@orpc/
|
40
|
-
"@orpc/
|
41
|
-
"@orpc/
|
39
|
+
"@orpc/shared": "0.0.0-next.c8607a4",
|
40
|
+
"@orpc/openapi": "0.0.0-next.c8607a4",
|
41
|
+
"@orpc/json-schema": "0.0.0-next.c8607a4"
|
42
42
|
},
|
43
43
|
"devDependencies": {
|
44
44
|
"zod": "^4.0.5"
|