@orpc/zod 0.0.0-next.f356b86 → 0.0.0-next.f397ca2
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 +10 -5
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +5 -8
- package/dist/zod4/index.d.mts +8 -8
- package/dist/zod4/index.d.ts +8 -8
- package/dist/zod4/index.mjs +17 -16
- package/package.json +8 -9
package/README.md
CHANGED
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
<a href="https://discord.gg/TXEbwRBvQn">
|
|
18
18
|
<img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
|
|
19
19
|
</a>
|
|
20
|
+
<a href="https://deepwiki.com/unnoq/orpc">
|
|
21
|
+
<img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki">
|
|
22
|
+
</a>
|
|
20
23
|
</div>
|
|
21
24
|
|
|
22
25
|
<h3 align="center">Typesafe APIs Made Simple 🪄</h3>
|
|
@@ -30,7 +33,8 @@
|
|
|
30
33
|
- **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
|
|
31
34
|
- **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
|
|
32
35
|
- **📝 Contract-First Development**: Optionally define your API contract before implementation.
|
|
33
|
-
-
|
|
36
|
+
- **🔍 First-Class OpenTelemetry**: Seamlessly integrate with OpenTelemetry for observability.
|
|
37
|
+
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), SWR, Pinia Colada, and more.
|
|
34
38
|
- **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
|
|
35
39
|
- **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
|
|
36
40
|
- **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
|
|
@@ -38,7 +42,6 @@
|
|
|
38
42
|
- **📡 SSE & Streaming**: Enjoy full type-safe support for SSE and streaming.
|
|
39
43
|
- **🌍 Multi-Runtime Support**: Fast and lightweight on Cloudflare, Deno, Bun, Node.js, and beyond.
|
|
40
44
|
- **🔌 Extendability**: Easily extend functionality with plugins, middleware, and interceptors.
|
|
41
|
-
- **🛡️ Reliability**: Well-tested, TypeScript-based, production-ready, and MIT licensed.
|
|
42
45
|
|
|
43
46
|
## Documentation
|
|
44
47
|
|
|
@@ -50,9 +53,11 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
|
50
53
|
- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
|
|
51
54
|
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
|
|
52
55
|
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
|
|
56
|
+
- [@orpc/otel](https://www.npmjs.com/package/@orpc/otel): [OpenTelemetry](https://opentelemetry.io/) integration for observability.
|
|
53
57
|
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
|
|
54
58
|
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
|
55
59
|
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
|
|
60
|
+
- [@orpc/experimental-react-swr](https://www.npmjs.com/package/@orpc/experimental-react-swr): [SWR](https://swr.vercel.app/) integration.
|
|
56
61
|
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
57
62
|
- [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
|
|
58
63
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
|
@@ -72,7 +77,7 @@ More schemas that [Zod](https://zod.dev/) doesn't support yet, and provides `Zod
|
|
|
72
77
|
|
|
73
78
|
```ts
|
|
74
79
|
import { oz } from '@orpc/zod'
|
|
75
|
-
import { z } from 'zod'
|
|
80
|
+
import { z } from 'zod/v3'
|
|
76
81
|
|
|
77
82
|
const Example = z.object({
|
|
78
83
|
url: oz.url(),
|
|
@@ -86,7 +91,7 @@ const Example = z.object({
|
|
|
86
91
|
|
|
87
92
|
```ts
|
|
88
93
|
import { OpenAPIGenerator } from '@orpc/openapi'
|
|
89
|
-
import { ZodToJsonSchemaConverter } from '@orpc/zod'
|
|
94
|
+
import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4'
|
|
90
95
|
|
|
91
96
|
const openAPIGenerator = new OpenAPIGenerator({
|
|
92
97
|
schemaConverters: [new ZodToJsonSchemaConverter()],
|
|
@@ -111,7 +116,7 @@ const specFromRouter = await openAPIGenerator.generate(router, {
|
|
|
111
116
|
|
|
112
117
|
```ts
|
|
113
118
|
import { oz } from '@orpc/zod'
|
|
114
|
-
import
|
|
119
|
+
import * as z from 'zod'
|
|
115
120
|
|
|
116
121
|
const InputSchema = oz.openapi(
|
|
117
122
|
z.object({
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSONSchema, ConditionalSchemaConverter, SchemaConvertOptions } from '@orpc/openapi';
|
|
2
|
-
import { ZodTypeAny, input, output, ZodTypeDef, CustomErrorParams, ZodType, ZodEffects } from 'zod';
|
|
2
|
+
import { ZodTypeAny, input, output, ZodTypeDef, CustomErrorParams, ZodType, ZodEffects } from 'zod/v3';
|
|
3
3
|
import { Context } from '@orpc/server';
|
|
4
4
|
import { StandardHandlerPlugin, StandardHandlerOptions } from '@orpc/server/standard';
|
|
5
5
|
import { AnySchema } from '@orpc/contract';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSONSchema, ConditionalSchemaConverter, SchemaConvertOptions } from '@orpc/openapi';
|
|
2
|
-
import { ZodTypeAny, input, output, ZodTypeDef, CustomErrorParams, ZodType, ZodEffects } from 'zod';
|
|
2
|
+
import { ZodTypeAny, input, output, ZodTypeDef, CustomErrorParams, ZodType, ZodEffects } from 'zod/v3';
|
|
3
3
|
import { Context } from '@orpc/server';
|
|
4
4
|
import { StandardHandlerPlugin, StandardHandlerOptions } from '@orpc/server/standard';
|
|
5
5
|
import { AnySchema } from '@orpc/contract';
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { custom, ZodFirstPartyTypeKind } from 'zod';
|
|
1
|
+
import { custom, ZodFirstPartyTypeKind } from 'zod/v3';
|
|
2
2
|
import wcmatch from 'wildcard-match';
|
|
3
3
|
import { isObject, guard, toArray } from '@orpc/shared';
|
|
4
4
|
import { JsonSchemaXNativeType } from '@orpc/json-schema';
|
|
@@ -129,7 +129,7 @@ class ZodSmartCoercionPlugin {
|
|
|
129
129
|
options.clientInterceptors ??= [];
|
|
130
130
|
options.clientInterceptors.unshift((options2) => {
|
|
131
131
|
const inputSchema = options2.procedure["~orpc"].inputSchema;
|
|
132
|
-
if (!inputSchema || inputSchema["~standard"].vendor !== "zod") {
|
|
132
|
+
if (!inputSchema || inputSchema["~standard"].vendor !== "zod" || "_zod" in inputSchema) {
|
|
133
133
|
return options2.next();
|
|
134
134
|
}
|
|
135
135
|
const coercedInput = zodCoerceInternal(inputSchema, options2.input);
|
|
@@ -401,7 +401,7 @@ class ZodToJsonSchemaConverter {
|
|
|
401
401
|
this.anyJsonSchema = options.anyJsonSchema ?? {};
|
|
402
402
|
}
|
|
403
403
|
condition(schema) {
|
|
404
|
-
return schema !== void 0 && schema["~standard"].vendor === "zod";
|
|
404
|
+
return schema !== void 0 && schema["~standard"].vendor === "zod" && !("_zod" in schema);
|
|
405
405
|
}
|
|
406
406
|
convert(schema, options, lazyDepth = 0, isHandledCustomJSONSchema = false, isHandledZodDescription = false, structureDepth = 0) {
|
|
407
407
|
const def = schema._def;
|
|
@@ -724,7 +724,7 @@ class ZodToJsonSchemaConverter {
|
|
|
724
724
|
const anyOf = [];
|
|
725
725
|
let required = true;
|
|
726
726
|
for (const item of schema_._def.options) {
|
|
727
|
-
const [itemRequired, itemJson] = this.convert(item, options, lazyDepth, false, false, structureDepth);
|
|
727
|
+
const [itemRequired, itemJson] = this.convert(item, options, lazyDepth, false, false, structureDepth + 1);
|
|
728
728
|
if (!itemRequired) {
|
|
729
729
|
required = false;
|
|
730
730
|
if (itemJson !== this.unsupportedJsonSchema) {
|
|
@@ -734,9 +734,6 @@ class ZodToJsonSchemaConverter {
|
|
|
734
734
|
anyOf.push(itemJson);
|
|
735
735
|
}
|
|
736
736
|
}
|
|
737
|
-
if (anyOf.length === 1) {
|
|
738
|
-
return [required, anyOf[0]];
|
|
739
|
-
}
|
|
740
737
|
return [required, { anyOf }];
|
|
741
738
|
}
|
|
742
739
|
case ZodFirstPartyTypeKind.ZodIntersection: {
|
|
@@ -744,7 +741,7 @@ class ZodToJsonSchemaConverter {
|
|
|
744
741
|
const allOf = [];
|
|
745
742
|
let required = false;
|
|
746
743
|
for (const item of [schema_._def.left, schema_._def.right]) {
|
|
747
|
-
const [itemRequired, itemJson] = this.convert(item, options, lazyDepth, false, false, structureDepth);
|
|
744
|
+
const [itemRequired, itemJson] = this.convert(item, options, lazyDepth, false, false, structureDepth + 1);
|
|
748
745
|
allOf.push(itemJson);
|
|
749
746
|
if (itemRequired) {
|
|
750
747
|
required = true;
|
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_ZodToJsonSchemaOptions {
|
|
|
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_ZodToJsonSchemaOptions {
|
|
|
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
|
@@ -8,7 +8,7 @@ class experimental_ZodSmartCoercionPlugin {
|
|
|
8
8
|
options.clientInterceptors ??= [];
|
|
9
9
|
options.clientInterceptors.unshift((options2) => {
|
|
10
10
|
const inputSchema = options2.procedure["~orpc"].inputSchema;
|
|
11
|
-
if (!inputSchema || inputSchema["~standard"].vendor !== "zod") {
|
|
11
|
+
if (!inputSchema || inputSchema["~standard"].vendor !== "zod" || !("_zod" in inputSchema)) {
|
|
12
12
|
return options2.next();
|
|
13
13
|
}
|
|
14
14
|
const coercedInput = this.#coerce(inputSchema, options2.input);
|
|
@@ -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;
|
|
@@ -289,7 +289,7 @@ class experimental_ZodToJsonSchemaConverter {
|
|
|
289
289
|
this.interceptors = options.interceptors ?? [];
|
|
290
290
|
}
|
|
291
291
|
condition(schema) {
|
|
292
|
-
return schema !== void 0 && schema["~standard"].vendor === "zod";
|
|
292
|
+
return schema !== void 0 && schema["~standard"].vendor === "zod" && "_zod" in schema;
|
|
293
293
|
}
|
|
294
294
|
convert(schema, options) {
|
|
295
295
|
return this.#convert(schema, options, 0, 0);
|
|
@@ -446,7 +446,7 @@ class experimental_ZodToJsonSchemaConverter {
|
|
|
446
446
|
const anyOf = [];
|
|
447
447
|
let required = true;
|
|
448
448
|
for (const item of union._zod.def.options) {
|
|
449
|
-
const [itemRequired, itemJson] = this.#convert(item, options2, lazyDepth2, structureDepth);
|
|
449
|
+
const [itemRequired, itemJson] = this.#convert(item, options2, lazyDepth2, structureDepth + 1);
|
|
450
450
|
if (!itemRequired) {
|
|
451
451
|
required = false;
|
|
452
452
|
}
|
|
@@ -460,14 +460,14 @@ class experimental_ZodToJsonSchemaConverter {
|
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
return [required,
|
|
463
|
+
return [required, { anyOf }];
|
|
464
464
|
}
|
|
465
465
|
case "intersection": {
|
|
466
466
|
const intersection = schema2;
|
|
467
467
|
const json = { allOf: [] };
|
|
468
468
|
let required = false;
|
|
469
469
|
for (const item of [intersection._zod.def.left, intersection._zod.def.right]) {
|
|
470
|
-
const [itemRequired, itemJson] = this.#convert(item, options2, lazyDepth2, structureDepth);
|
|
470
|
+
const [itemRequired, itemJson] = this.#convert(item, options2, lazyDepth2, structureDepth + 1);
|
|
471
471
|
json.allOf.push(itemJson);
|
|
472
472
|
if (itemRequired) {
|
|
473
473
|
required = true;
|
|
@@ -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.f397ca2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -29,20 +29,19 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"zod": ">=3.
|
|
33
|
-
"@orpc/contract": "0.0.0-next.
|
|
34
|
-
"@orpc/server": "0.0.0-next.
|
|
32
|
+
"zod": ">=3.25.0",
|
|
33
|
+
"@orpc/contract": "0.0.0-next.f397ca2",
|
|
34
|
+
"@orpc/server": "0.0.0-next.f397ca2"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"escape-string-regexp": "^5.0.0",
|
|
38
38
|
"wildcard-match": "^5.1.3",
|
|
39
|
-
"@orpc/json-schema": "0.0.0-next.
|
|
40
|
-
"@orpc/
|
|
41
|
-
"@orpc/
|
|
39
|
+
"@orpc/json-schema": "0.0.0-next.f397ca2",
|
|
40
|
+
"@orpc/shared": "0.0.0-next.f397ca2",
|
|
41
|
+
"@orpc/openapi": "0.0.0-next.f397ca2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"zod": "^
|
|
45
|
-
"zod-to-json-schema": "^3.24.6"
|
|
44
|
+
"zod": "^4.1.12"
|
|
46
45
|
},
|
|
47
46
|
"scripts": {
|
|
48
47
|
"build": "unbuild",
|