@orpc/zod 2.0.0-beta.32 → 2.0.0-beta.34
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 +44 -29
- package/dist/index.d.mts +4 -187
- package/dist/index.d.ts +4 -187
- package/dist/index.mjs +2 -19
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -29,44 +29,54 @@ You can read the documentation [here](https://orpc.dev).
|
|
|
29
29
|
|
|
30
30
|
**Core**
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
| Package | Purpose | Docs |
|
|
33
|
+
| -------------------------------------------------------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
34
|
+
| [@orpc/contract](https://www.npmjs.com/package/@orpc/contract) | Define API contract as the single source of truth. | [Procedure Contract](https://orpc.dev/docs/contract/procedure), [Contract Router](https://orpc.dev/docs/contract/router), [Implementation](https://orpc.dev/docs/contract/implementation), [Generate from OpenAPI](https://orpc.dev/docs/contract/generate-from-openapi) |
|
|
35
|
+
| [@orpc/server](https://www.npmjs.com/package/@orpc/server) | Build APIs or implement contracts. | [Procedure](https://orpc.dev/docs/procedure), [Router](https://orpc.dev/docs/router), [Middleware](https://orpc.dev/docs/middleware), [Context](https://orpc.dev/docs/context), [RPC Handler](https://orpc.dev/docs/rpc/handler) |
|
|
36
|
+
| [@orpc/client](https://www.npmjs.com/package/@orpc/client) | Consume APIs with end-to-end type safety. | [Client-Side Clients](https://orpc.dev/docs/client/client-side), [Server-Side Clients](https://orpc.dev/docs/client/server-side), [RPC Link](https://orpc.dev/docs/rpc/link), [Error Handling](https://orpc.dev/docs/client/error-handling) |
|
|
37
|
+
| [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi) | Add OpenAPI compatibility to APIs. | [OpenAPI Handler](https://orpc.dev/docs/openapi/handler), [OpenAPI Link](https://orpc.dev/docs/openapi/link), [Specification](https://orpc.dev/docs/openapi/specification), [Scalar](https://orpc.dev/docs/openapi/scalar) |
|
|
36
38
|
|
|
37
39
|
**Schema validation**
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
| Package | Purpose | Docs |
|
|
42
|
+
| ------------------------------------------------------------ | ----------------------------------------------- | ----------------------------------------------------- |
|
|
43
|
+
| [@orpc/zod](https://www.npmjs.com/package/@orpc/zod) | Integrate with [Zod](https://zod.dev/). | [Zod](https://orpc.dev/docs/integrations/zod) |
|
|
44
|
+
| [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot) | Integrate with [Valibot](https://valibot.dev/). | [Valibot](https://orpc.dev/docs/integrations/valibot) |
|
|
45
|
+
| [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype) | Integrate with [ArkType](https://arktype.io/). | [ArkType](https://orpc.dev/docs/integrations/arktype) |
|
|
42
46
|
|
|
43
47
|
**Built-in features**
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
| Package | Purpose | Docs |
|
|
50
|
+
| -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
|
|
51
|
+
| [@orpc/publisher](https://www.npmjs.com/package/@orpc/publisher) | Pub/Sub with memory, Redis, and Upstash adapters. | [Publisher](https://orpc.dev/docs/helpers/publisher) |
|
|
52
|
+
| [@orpc/ratelimit](https://www.npmjs.com/package/@orpc/ratelimit) | Rate limiting with memory, Redis, and Upstash adapters. | [Rate Limit](https://orpc.dev/docs/helpers/ratelimit) |
|
|
53
|
+
| [@orpc/hibernation](https://www.npmjs.com/package/@orpc/hibernation) | Leverage Hibernation APIs like [Cloudflare's Hibernation WebSocket](https://developers.cloudflare.com/durable-objects/best-practices/websockets/#durable-objects-hibernation-websocket-api). | [Hibernation](https://orpc.dev/docs/integrations/hibernation) |
|
|
54
|
+
| [@orpc/json-schema](https://www.npmjs.com/package/@orpc/json-schema) | Smart coercion for OpenAPI requests. | [Smart Coercion](https://orpc.dev/docs/plugins/smart-coercion) |
|
|
49
55
|
|
|
50
56
|
**Framework & ecosystem integrations**
|
|
51
57
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
| Package | Purpose | Docs |
|
|
59
|
+
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
60
|
+
| [@orpc/next](https://www.npmjs.com/package/@orpc/next) | Integrate with [Next.js Server Functions](https://nextjs.org/docs/app/getting-started/mutating-data). | [Next.js](https://orpc.dev/docs/integrations/next) |
|
|
61
|
+
| [@orpc/ai-sdk](https://www.npmjs.com/package/@orpc/ai-sdk) | Turn contracts and procedures into [AI SDK](https://ai-sdk.dev/) tools. | [AI SDK](https://orpc.dev/docs/integrations/ai-sdk) |
|
|
62
|
+
| [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query) | Integrate with [TanStack Query](https://tanstack.com/query/latest). | [TanStack Query](https://orpc.dev/docs/integrations/tanstack-query) |
|
|
63
|
+
| [@orpc/pinia-colada](https://www.npmjs.com/package/@orpc/pinia-colada) | Integrate with [Pinia Colada](https://pinia-colada.esm.dev/). | [Pinia Colada](https://orpc.dev/docs/integrations/pinia-colada) |
|
|
64
|
+
| [@orpc/swr](https://www.npmjs.com/package/@orpc/swr) | Integrate with [SWR](https://swr.vercel.app/). | [SWR](https://orpc.dev/docs/integrations/swr) |
|
|
65
|
+
| [@orpc/experimental-msw](https://www.npmjs.com/package/@orpc/experimental-msw) | Mock procedures with [Mock Service Worker](https://mswjs.io/). | [MSW](https://orpc.dev/docs/integrations/msw) |
|
|
66
|
+
| [@orpc/experimental-effect](https://www.npmjs.com/package/@orpc/experimental-effect) | Integrate with [Effect](https://effect.website/). | [Effect](https://orpc.dev/docs/integrations/effect) |
|
|
67
|
+
| [@orpc/nest](https://www.npmjs.com/package/@orpc/nest) | Implement your contract with [NestJS](https://nestjs.com/). | [NestJS](https://orpc.dev/docs/integrations/nest) |
|
|
68
|
+
| [@orpc/node](https://www.npmjs.com/package/@orpc/node) | [Node.js](https://nodejs.org/) plugins for static file serving and large uploads. | [Static File](https://orpc.dev/docs/plugins/static-file), [Tmp File Upload](https://orpc.dev/docs/plugins/tmp-file-upload), [Batch Response Compression](https://orpc.dev/docs/plugins/batch-response-compression) |
|
|
69
|
+
| [@orpc/bun](https://www.npmjs.com/package/@orpc/bun) | Adapters for [Bun's Redis](https://bun.sh/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit) |
|
|
70
|
+
| [@orpc/cloudflare](https://www.npmjs.com/package/@orpc/cloudflare) | Adapters for [Cloudflare's RateLimit and Durable Objects](https://developers.cloudflare.com/workers/). | [Publisher](https://orpc.dev/docs/helpers/publisher), [Rate Limit](https://orpc.dev/docs/helpers/ratelimit) |
|
|
71
|
+
| [@orpc/trpc](https://www.npmjs.com/package/@orpc/trpc) | Reuse existing [tRPC](https://trpc.io/) routers within oRPC. | [tRPC](https://orpc.dev/docs/integrations/trpc) |
|
|
64
72
|
|
|
65
73
|
**Observability**
|
|
66
74
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
75
|
+
| Package | Purpose | Docs |
|
|
76
|
+
| ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
|
|
77
|
+
| [@orpc/opentelemetry](https://www.npmjs.com/package/@orpc/opentelemetry) | Integrate with [OpenTelemetry](https://opentelemetry.io/) for distributed tracing. | [OpenTelemetry](https://orpc.dev/docs/integrations/opentelemetry) |
|
|
78
|
+
| [@orpc/pino](https://www.npmjs.com/package/@orpc/pino) | Integrate with [Pino](https://getpino.io/) for logging. | [Pino](https://orpc.dev/docs/integrations/pino) |
|
|
79
|
+
| [@orpc/evlog](https://www.npmjs.com/package/@orpc/evlog) | Integrate with [Evlog](https://evlog.dev/) for logging. | [Evlog](https://orpc.dev/docs/integrations/evlog) |
|
|
70
80
|
|
|
71
81
|
## Sponsors
|
|
72
82
|
|
|
@@ -76,6 +86,9 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
76
86
|
<tr>
|
|
77
87
|
<td width="2000"><a href="https://screenshotone.com/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener" title="The screenshot API for developers"><img src="https://avatars.githubusercontent.com/u/97035603?v=4" width="64" align="left" hspace="12" alt="ScreenshotOne.com"/><b>ScreenshotOne.com</b></a><br /><sub>The screenshot API for developers</sub></td>
|
|
78
88
|
</tr>
|
|
89
|
+
<tr>
|
|
90
|
+
<td width="2000"><a href="https://yuzu.health/careers?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="We're hiring NYC based engineers"><img src="https://avatars.githubusercontent.com/u/102488956?v=4" width="64" align="left" hspace="12" alt="Yuzu"/><b>Yuzu</b></a><br /><sub>We're hiring NYC based engineers</sub></td>
|
|
91
|
+
</tr>
|
|
79
92
|
<tr>
|
|
80
93
|
<td width="2000"><a href="https://misskey.io/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Decentralized microblogging SNS born on Earth"><img src="https://github.com/MisskeyIO.png" width="64" align="left" hspace="12" alt="MisskeyHQ"/><b>MisskeyHQ</b></a><br /><sub>Decentralized microblogging SNS born on Earth</sub></td>
|
|
81
94
|
</tr>
|
|
@@ -122,30 +135,32 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
122
135
|
<table>
|
|
123
136
|
<tr>
|
|
124
137
|
<td align="center"><a href="https://github.com/rhinodavid?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="David Walsh"><img src="https://avatars.githubusercontent.com/u/5778036?u=b5521f07d2f88c3db2a0dae62b5f2f8357214af0&v=4" width="119" alt="David Walsh"/><br />David Walsh</a></td>
|
|
138
|
+
<td align="center"><a href="https://github.com/IPv4Addr?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="IPv4Addr"><img src="https://avatars.githubusercontent.com/u/100147665?u=59996b72f69bb53063cb7e9ff8b8f898616cd94d&v=4" width="119" alt="IPv4Addr"/><br />IPv4Addr</a></td>
|
|
125
139
|
<td align="center"><a href="https://robbevaes.be/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Robbe Vaes"><img src="https://avatars.githubusercontent.com/u/44748019?u=e0232402c045ad4eac7cbd217f1f47e083103b89&v=4" width="119" alt="Robbe Vaes"/><br />Robbe Vaes</a></td>
|
|
126
140
|
<td align="center"><a href="https://github.com/aidansunbury?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Aidan Sunbury"><img src="https://avatars.githubusercontent.com/u/64103161?v=4" width="119" alt="Aidan Sunbury"/><br />Aidan Sunbury</a></td>
|
|
127
141
|
<td align="center"><a href="https://github.com/soonoo?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="soonoo"><img src="https://avatars.githubusercontent.com/u/5436405?u=5d0b4aa955c87e30e6bda7f0cccae5402da99528&v=4" width="119" alt="soonoo"/><br />soonoo</a></td>
|
|
128
142
|
<td align="center"><a href="https://kevinporten.dev/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Kevin Porten"><img src="https://avatars.githubusercontent.com/u/1839345?u=dc2263d5cfe0d927ce1a0be04a1d55dd6b55405c&v=4" width="119" alt="Kevin Porten"/><br />Kevin Porten</a></td>
|
|
129
143
|
<td align="center"><a href="https://github.com/pumpkinlink?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Denis"><img src="https://avatars.githubusercontent.com/u/11864620?u=5f47bbe6c65d0f6f5cf011021490238e4b0593d0&v=4" width="119" alt="Denis"/><br />Denis</a></td>
|
|
130
|
-
<td align="center"><a href="https://github.com/christopher-kapic?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Christopher Kapic"><img src="https://avatars.githubusercontent.com/u/59740769?u=e7ad4b72b5bf6c9eb1644c26dbf3332a8f987377&v=4" width="119" alt="Christopher Kapic"/><br />Christopher Kapic</a></td>
|
|
131
144
|
</tr>
|
|
132
145
|
<tr>
|
|
146
|
+
<td align="center"><a href="https://github.com/christopher-kapic?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Christopher Kapic"><img src="https://avatars.githubusercontent.com/u/59740769?u=e7ad4b72b5bf6c9eb1644c26dbf3332a8f987377&v=4" width="119" alt="Christopher Kapic"/><br />Christopher Kapic</a></td>
|
|
133
147
|
<td align="center"><a href="http://ballingt.com/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Tom Ballinger"><img src="https://avatars.githubusercontent.com/u/458879?u=4b045ac75d721b6ac2b42a74d7d37f61f0414031&v=4" width="119" alt="Tom Ballinger"/><br />Tom Ballinger</a></td>
|
|
134
148
|
<td align="center"><a href="https://lee-sam.com/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Sam"><img src="https://avatars.githubusercontent.com/u/102863520?u=3c89611f549d5070be232eb4532f690c8f2e7a65&v=4" width="119" alt="Sam"/><br />Sam</a></td>
|
|
135
149
|
<td align="center"><a href="https://github.com/Titoine?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Titoine"><img src="https://avatars.githubusercontent.com/u/3514286?u=1bb1e86b0c99c8a1121372e56d51a177eea12191&v=4" width="119" alt="Titoine"/><br />Titoine</a></td>
|
|
136
150
|
<td align="center"><a href="https://rigtch.fm/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Igor Makowski"><img src="https://avatars.githubusercontent.com/u/56691628?u=ee8c879478f7c151b9156aef6c74243fa3e247a8&v=4" width="119" alt="Igor Makowski"/><br />Igor Makowski</a></td>
|
|
137
151
|
<td align="center"><a href="https://blog.cwang.io/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="hanayashiki"><img src="https://avatars.githubusercontent.com/u/26056783?u=06c3b9205a16fd41a871e82da1cc2a09306d53f5&v=4" width="119" alt="hanayashiki"/><br />hanayashiki</a></td>
|
|
138
152
|
<td align="center"><a href="https://dubinets.io/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Lev Dubinets"><img src="https://avatars.githubusercontent.com/u/3114081?u=f547f5d5012cab54851f1b1ad72d10e537f78fc2&v=4" width="119" alt="Lev Dubinets"/><br />Lev Dubinets</a></td>
|
|
139
|
-
<td align="center"><a href="https://kellychan.im/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Kelly Peilin Chan"><img src="https://avatars.githubusercontent.com/u/520852?u=6b0f7105f694e7b5cacf410a3f04c7044b469dc8&v=4" width="119" alt="Kelly Peilin Chan"/><br />Kelly Peilin Chan</a></td>
|
|
140
153
|
</tr>
|
|
141
154
|
<tr>
|
|
155
|
+
<td align="center"><a href="https://kellychan.im/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Kelly Peilin Chan"><img src="https://avatars.githubusercontent.com/u/520852?u=6b0f7105f694e7b5cacf410a3f04c7044b469dc8&v=4" width="119" alt="Kelly Peilin Chan"/><br />Kelly Peilin Chan</a></td>
|
|
142
156
|
<td align="center"><a href="https://guyariely.com/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Guy Ariely"><img src="https://avatars.githubusercontent.com/u/42813496?u=edb6b7f563bf28e160a290832e7da57c0506f8ca&v=4" width="119" alt="Guy Ariely"/><br />Guy Ariely</a></td>
|
|
157
|
+
<td align="center"><a href="https://paulsenon.com/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="PaulSenon"><img src="https://avatars.githubusercontent.com/u/19531087?u=6385741eb91d200b8c513ec6045482e301767ca6&v=4" width="119" alt="PaulSenon"/><br />PaulSenon</a></td>
|
|
143
158
|
<td align="center"><a href="https://piscis.dev/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Alex"><img src="https://avatars.githubusercontent.com/u/326163?u=b245f368bd940cf51d08c0b6bf55f8257f359437&v=4" width="119" alt="Alex"/><br />Alex</a></td>
|
|
144
159
|
<td align="center"><a href="https://opensource.gubanov.eu/?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Andrey Gubanov"><img src="https://avatars.githubusercontent.com/u/1082083?u=c5f2daf7ebece498e85c83367bb37b4e10e2649d&v=4" width="119" alt="Andrey Gubanov"/><br />Andrey Gubanov</a></td>
|
|
145
160
|
</tr>
|
|
146
161
|
</table>
|
|
147
162
|
|
|
148
|
-
With thanks to [
|
|
163
|
+
With thanks to [36 past sponsors](https://htmlpreview.github.io/?https://github.com/middleapi/static/blob/main/sponsors.svg) who helped get oRPC here.
|
|
149
164
|
|
|
150
165
|
## References
|
|
151
166
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JsonSchemaConverter, AnySchema, JsonSchemaConverterDirection, JsonSchema } from '@orpc/json-schema';
|
|
2
2
|
import * as zod_v4_core from 'zod/v4/core';
|
|
3
3
|
import { ToJSONSchemaParams, $input, $output } from 'zod/v4/core';
|
|
4
|
-
import * as
|
|
4
|
+
import * as _openapi_spec_types_v3_2 from '@openapi-spec/types/v3.2';
|
|
5
5
|
|
|
6
6
|
interface ZodToJsonSchemaConverterOptions extends Omit<ToJSONSchemaParams, 'target' | 'io'> {
|
|
7
7
|
/**
|
|
@@ -51,68 +51,7 @@ declare class ZodToJsonSchemaConverter implements JsonSchemaConverter {
|
|
|
51
51
|
*
|
|
52
52
|
* @see {@link https://orpc.dev/docs/integrations/zod | Zod Integration}
|
|
53
53
|
*/
|
|
54
|
-
declare const JSON_SCHEMA_REGISTRY: zod_v4_core.$ZodRegistry<
|
|
55
|
-
$anchor?: string;
|
|
56
|
-
$comment?: string;
|
|
57
|
-
$defs?: Record<string, json_schema_typed.JSONSchema>;
|
|
58
|
-
$dynamicAnchor?: string;
|
|
59
|
-
$dynamicRef?: string;
|
|
60
|
-
$id?: string;
|
|
61
|
-
$ref?: string;
|
|
62
|
-
$schema?: string;
|
|
63
|
-
$vocabulary?: Record<string, string>;
|
|
64
|
-
additionalItems?: json_schema_typed.JSONSchema;
|
|
65
|
-
additionalProperties?: json_schema_typed.JSONSchema;
|
|
66
|
-
allOf?: (json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
67
|
-
anyOf?: (json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
68
|
-
const?: typeof $input | typeof $output | undefined;
|
|
69
|
-
contains?: json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
70
|
-
contentEncoding?: "7bit" | "8bit" | "base64" | "binary" | "ietf-token" | "quoted-printable" | "x-token";
|
|
71
|
-
contentMediaType?: string;
|
|
72
|
-
contentSchema?: json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
73
|
-
default?: typeof $input | typeof $output | undefined;
|
|
74
|
-
definitions?: Record<string, json_schema_typed.JSONSchema>;
|
|
75
|
-
dependencies?: Record<string, (string[] | readonly string[]) | json_schema_typed.JSONSchema>;
|
|
76
|
-
dependentRequired?: Record<string, string[] | readonly string[]>;
|
|
77
|
-
dependentSchemas?: Record<string, json_schema_typed.JSONSchema>;
|
|
78
|
-
deprecated?: boolean;
|
|
79
|
-
description?: string;
|
|
80
|
-
else?: json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
81
|
-
enum?: ((typeof $input | typeof $output)[] | readonly (typeof $input | typeof $output)[]) | undefined;
|
|
82
|
-
examples?: ((typeof $input | typeof $output)[] | readonly (typeof $input | typeof $output)[]) | undefined;
|
|
83
|
-
exclusiveMaximum?: number;
|
|
84
|
-
exclusiveMinimum?: number;
|
|
85
|
-
format?: string;
|
|
86
|
-
if?: json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
87
|
-
items?: json_schema_typed.JSONSchema;
|
|
88
|
-
maxContains?: number;
|
|
89
|
-
maximum?: number;
|
|
90
|
-
maxItems?: number;
|
|
91
|
-
maxLength?: number;
|
|
92
|
-
maxProperties?: number;
|
|
93
|
-
minContains?: number;
|
|
94
|
-
minimum?: number;
|
|
95
|
-
minItems?: number;
|
|
96
|
-
minLength?: number;
|
|
97
|
-
minProperties?: number;
|
|
98
|
-
multipleOf?: number;
|
|
99
|
-
not?: json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
100
|
-
oneOf?: (json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
101
|
-
pattern?: string;
|
|
102
|
-
patternProperties?: Record<string, json_schema_typed.JSONSchema>;
|
|
103
|
-
prefixItems?: (json_schema_typed.JSONSchema<any, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<any, json_schema_typed.JSONSchema.TypeValue>[]) | json_schema_typed.JSONSchema;
|
|
104
|
-
properties?: Record<string, json_schema_typed.JSONSchema>;
|
|
105
|
-
propertyNames?: json_schema_typed.JSONSchema;
|
|
106
|
-
readOnly?: boolean;
|
|
107
|
-
required?: string[] | readonly string[];
|
|
108
|
-
then?: json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
109
|
-
title?: string;
|
|
110
|
-
type?: json_schema_typed.JSONSchema.TypeValue | undefined;
|
|
111
|
-
unevaluatedItems?: json_schema_typed.JSONSchema;
|
|
112
|
-
unevaluatedProperties?: json_schema_typed.JSONSchema;
|
|
113
|
-
uniqueItems?: boolean;
|
|
114
|
-
writeOnly?: boolean;
|
|
115
|
-
}, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
54
|
+
declare const JSON_SCHEMA_REGISTRY: zod_v4_core.$ZodRegistry<_openapi_spec_types_v3_2.SchemaObjectFields<typeof $input | typeof $output>, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
116
55
|
/**
|
|
117
56
|
* Zod registry for customizing generated JSON schema, only useful for .input
|
|
118
57
|
*
|
|
@@ -132,68 +71,7 @@ declare const JSON_SCHEMA_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
|
132
71
|
*
|
|
133
72
|
* @see {@link https://orpc.dev/docs/integrations/zod | Zod Integration}
|
|
134
73
|
*/
|
|
135
|
-
declare const JSON_SCHEMA_INPUT_REGISTRY: zod_v4_core.$ZodRegistry<
|
|
136
|
-
$anchor?: string;
|
|
137
|
-
$comment?: string;
|
|
138
|
-
$defs?: Record<string, json_schema_typed.JSONSchema>;
|
|
139
|
-
$dynamicAnchor?: string;
|
|
140
|
-
$dynamicRef?: string;
|
|
141
|
-
$id?: string;
|
|
142
|
-
$ref?: string;
|
|
143
|
-
$schema?: string;
|
|
144
|
-
$vocabulary?: Record<string, string>;
|
|
145
|
-
additionalItems?: json_schema_typed.JSONSchema;
|
|
146
|
-
additionalProperties?: json_schema_typed.JSONSchema;
|
|
147
|
-
allOf?: (json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
148
|
-
anyOf?: (json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
149
|
-
const?: typeof $input | undefined;
|
|
150
|
-
contains?: json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
151
|
-
contentEncoding?: "7bit" | "8bit" | "base64" | "binary" | "ietf-token" | "quoted-printable" | "x-token";
|
|
152
|
-
contentMediaType?: string;
|
|
153
|
-
contentSchema?: json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
154
|
-
default?: typeof $input | undefined;
|
|
155
|
-
definitions?: Record<string, json_schema_typed.JSONSchema>;
|
|
156
|
-
dependencies?: Record<string, (string[] | readonly string[]) | json_schema_typed.JSONSchema>;
|
|
157
|
-
dependentRequired?: Record<string, string[] | readonly string[]>;
|
|
158
|
-
dependentSchemas?: Record<string, json_schema_typed.JSONSchema>;
|
|
159
|
-
deprecated?: boolean;
|
|
160
|
-
description?: string;
|
|
161
|
-
else?: json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
162
|
-
enum?: ((typeof $input)[] | readonly (typeof $input)[]) | undefined;
|
|
163
|
-
examples?: ((typeof $input)[] | readonly (typeof $input)[]) | undefined;
|
|
164
|
-
exclusiveMaximum?: number;
|
|
165
|
-
exclusiveMinimum?: number;
|
|
166
|
-
format?: string;
|
|
167
|
-
if?: json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
168
|
-
items?: json_schema_typed.JSONSchema;
|
|
169
|
-
maxContains?: number;
|
|
170
|
-
maximum?: number;
|
|
171
|
-
maxItems?: number;
|
|
172
|
-
maxLength?: number;
|
|
173
|
-
maxProperties?: number;
|
|
174
|
-
minContains?: number;
|
|
175
|
-
minimum?: number;
|
|
176
|
-
minItems?: number;
|
|
177
|
-
minLength?: number;
|
|
178
|
-
minProperties?: number;
|
|
179
|
-
multipleOf?: number;
|
|
180
|
-
not?: json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
181
|
-
oneOf?: (json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
182
|
-
pattern?: string;
|
|
183
|
-
patternProperties?: Record<string, json_schema_typed.JSONSchema>;
|
|
184
|
-
prefixItems?: (json_schema_typed.JSONSchema<any, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<any, json_schema_typed.JSONSchema.TypeValue>[]) | json_schema_typed.JSONSchema;
|
|
185
|
-
properties?: Record<string, json_schema_typed.JSONSchema>;
|
|
186
|
-
propertyNames?: json_schema_typed.JSONSchema;
|
|
187
|
-
readOnly?: boolean;
|
|
188
|
-
required?: string[] | readonly string[];
|
|
189
|
-
then?: json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
190
|
-
title?: string;
|
|
191
|
-
type?: json_schema_typed.JSONSchema.TypeValue | undefined;
|
|
192
|
-
unevaluatedItems?: json_schema_typed.JSONSchema;
|
|
193
|
-
unevaluatedProperties?: json_schema_typed.JSONSchema;
|
|
194
|
-
uniqueItems?: boolean;
|
|
195
|
-
writeOnly?: boolean;
|
|
196
|
-
}, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
74
|
+
declare const JSON_SCHEMA_INPUT_REGISTRY: zod_v4_core.$ZodRegistry<_openapi_spec_types_v3_2.SchemaObjectFields<typeof $input>, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
197
75
|
/**
|
|
198
76
|
* Zod registry for customizing generated JSON schema, only useful for .output
|
|
199
77
|
*
|
|
@@ -213,68 +91,7 @@ declare const JSON_SCHEMA_INPUT_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
|
213
91
|
*
|
|
214
92
|
* @see {@link https://orpc.dev/docs/integrations/zod | Zod Integration}
|
|
215
93
|
*/
|
|
216
|
-
declare const JSON_SCHEMA_OUTPUT_REGISTRY: zod_v4_core.$ZodRegistry<
|
|
217
|
-
$anchor?: string;
|
|
218
|
-
$comment?: string;
|
|
219
|
-
$defs?: Record<string, json_schema_typed.JSONSchema>;
|
|
220
|
-
$dynamicAnchor?: string;
|
|
221
|
-
$dynamicRef?: string;
|
|
222
|
-
$id?: string;
|
|
223
|
-
$ref?: string;
|
|
224
|
-
$schema?: string;
|
|
225
|
-
$vocabulary?: Record<string, string>;
|
|
226
|
-
additionalItems?: json_schema_typed.JSONSchema;
|
|
227
|
-
additionalProperties?: json_schema_typed.JSONSchema;
|
|
228
|
-
allOf?: (json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
229
|
-
anyOf?: (json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
230
|
-
const?: typeof $output | undefined;
|
|
231
|
-
contains?: json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
232
|
-
contentEncoding?: "7bit" | "8bit" | "base64" | "binary" | "ietf-token" | "quoted-printable" | "x-token";
|
|
233
|
-
contentMediaType?: string;
|
|
234
|
-
contentSchema?: json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
235
|
-
default?: typeof $output | undefined;
|
|
236
|
-
definitions?: Record<string, json_schema_typed.JSONSchema>;
|
|
237
|
-
dependencies?: Record<string, (string[] | readonly string[]) | json_schema_typed.JSONSchema>;
|
|
238
|
-
dependentRequired?: Record<string, string[] | readonly string[]>;
|
|
239
|
-
dependentSchemas?: Record<string, json_schema_typed.JSONSchema>;
|
|
240
|
-
deprecated?: boolean;
|
|
241
|
-
description?: string;
|
|
242
|
-
else?: json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
243
|
-
enum?: ((typeof $output)[] | readonly (typeof $output)[]) | undefined;
|
|
244
|
-
examples?: ((typeof $output)[] | readonly (typeof $output)[]) | undefined;
|
|
245
|
-
exclusiveMaximum?: number;
|
|
246
|
-
exclusiveMinimum?: number;
|
|
247
|
-
format?: string;
|
|
248
|
-
if?: json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
249
|
-
items?: json_schema_typed.JSONSchema;
|
|
250
|
-
maxContains?: number;
|
|
251
|
-
maximum?: number;
|
|
252
|
-
maxItems?: number;
|
|
253
|
-
maxLength?: number;
|
|
254
|
-
maxProperties?: number;
|
|
255
|
-
minContains?: number;
|
|
256
|
-
minimum?: number;
|
|
257
|
-
minItems?: number;
|
|
258
|
-
minLength?: number;
|
|
259
|
-
minProperties?: number;
|
|
260
|
-
multipleOf?: number;
|
|
261
|
-
not?: json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
262
|
-
oneOf?: (json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
263
|
-
pattern?: string;
|
|
264
|
-
patternProperties?: Record<string, json_schema_typed.JSONSchema>;
|
|
265
|
-
prefixItems?: (json_schema_typed.JSONSchema<any, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<any, json_schema_typed.JSONSchema.TypeValue>[]) | json_schema_typed.JSONSchema;
|
|
266
|
-
properties?: Record<string, json_schema_typed.JSONSchema>;
|
|
267
|
-
propertyNames?: json_schema_typed.JSONSchema;
|
|
268
|
-
readOnly?: boolean;
|
|
269
|
-
required?: string[] | readonly string[];
|
|
270
|
-
then?: json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
271
|
-
title?: string;
|
|
272
|
-
type?: json_schema_typed.JSONSchema.TypeValue | undefined;
|
|
273
|
-
unevaluatedItems?: json_schema_typed.JSONSchema;
|
|
274
|
-
unevaluatedProperties?: json_schema_typed.JSONSchema;
|
|
275
|
-
uniqueItems?: boolean;
|
|
276
|
-
writeOnly?: boolean;
|
|
277
|
-
}, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
94
|
+
declare const JSON_SCHEMA_OUTPUT_REGISTRY: zod_v4_core.$ZodRegistry<_openapi_spec_types_v3_2.SchemaObjectFields<typeof $output>, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
278
95
|
|
|
279
96
|
export { JSON_SCHEMA_INPUT_REGISTRY, JSON_SCHEMA_OUTPUT_REGISTRY, JSON_SCHEMA_REGISTRY, ZodToJsonSchemaConverter };
|
|
280
97
|
export type { ZodToJsonSchemaConverterOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JsonSchemaConverter, AnySchema, JsonSchemaConverterDirection, JsonSchema } from '@orpc/json-schema';
|
|
2
2
|
import * as zod_v4_core from 'zod/v4/core';
|
|
3
3
|
import { ToJSONSchemaParams, $input, $output } from 'zod/v4/core';
|
|
4
|
-
import * as
|
|
4
|
+
import * as _openapi_spec_types_v3_2 from '@openapi-spec/types/v3.2';
|
|
5
5
|
|
|
6
6
|
interface ZodToJsonSchemaConverterOptions extends Omit<ToJSONSchemaParams, 'target' | 'io'> {
|
|
7
7
|
/**
|
|
@@ -51,68 +51,7 @@ declare class ZodToJsonSchemaConverter implements JsonSchemaConverter {
|
|
|
51
51
|
*
|
|
52
52
|
* @see {@link https://orpc.dev/docs/integrations/zod | Zod Integration}
|
|
53
53
|
*/
|
|
54
|
-
declare const JSON_SCHEMA_REGISTRY: zod_v4_core.$ZodRegistry<
|
|
55
|
-
$anchor?: string;
|
|
56
|
-
$comment?: string;
|
|
57
|
-
$defs?: Record<string, json_schema_typed.JSONSchema>;
|
|
58
|
-
$dynamicAnchor?: string;
|
|
59
|
-
$dynamicRef?: string;
|
|
60
|
-
$id?: string;
|
|
61
|
-
$ref?: string;
|
|
62
|
-
$schema?: string;
|
|
63
|
-
$vocabulary?: Record<string, string>;
|
|
64
|
-
additionalItems?: json_schema_typed.JSONSchema;
|
|
65
|
-
additionalProperties?: json_schema_typed.JSONSchema;
|
|
66
|
-
allOf?: (json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
67
|
-
anyOf?: (json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
68
|
-
const?: typeof $input | typeof $output | undefined;
|
|
69
|
-
contains?: json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
70
|
-
contentEncoding?: "7bit" | "8bit" | "base64" | "binary" | "ietf-token" | "quoted-printable" | "x-token";
|
|
71
|
-
contentMediaType?: string;
|
|
72
|
-
contentSchema?: json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
73
|
-
default?: typeof $input | typeof $output | undefined;
|
|
74
|
-
definitions?: Record<string, json_schema_typed.JSONSchema>;
|
|
75
|
-
dependencies?: Record<string, (string[] | readonly string[]) | json_schema_typed.JSONSchema>;
|
|
76
|
-
dependentRequired?: Record<string, string[] | readonly string[]>;
|
|
77
|
-
dependentSchemas?: Record<string, json_schema_typed.JSONSchema>;
|
|
78
|
-
deprecated?: boolean;
|
|
79
|
-
description?: string;
|
|
80
|
-
else?: json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
81
|
-
enum?: ((typeof $input | typeof $output)[] | readonly (typeof $input | typeof $output)[]) | undefined;
|
|
82
|
-
examples?: ((typeof $input | typeof $output)[] | readonly (typeof $input | typeof $output)[]) | undefined;
|
|
83
|
-
exclusiveMaximum?: number;
|
|
84
|
-
exclusiveMinimum?: number;
|
|
85
|
-
format?: string;
|
|
86
|
-
if?: json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
87
|
-
items?: json_schema_typed.JSONSchema;
|
|
88
|
-
maxContains?: number;
|
|
89
|
-
maximum?: number;
|
|
90
|
-
maxItems?: number;
|
|
91
|
-
maxLength?: number;
|
|
92
|
-
maxProperties?: number;
|
|
93
|
-
minContains?: number;
|
|
94
|
-
minimum?: number;
|
|
95
|
-
minItems?: number;
|
|
96
|
-
minLength?: number;
|
|
97
|
-
minProperties?: number;
|
|
98
|
-
multipleOf?: number;
|
|
99
|
-
not?: json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
100
|
-
oneOf?: (json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
101
|
-
pattern?: string;
|
|
102
|
-
patternProperties?: Record<string, json_schema_typed.JSONSchema>;
|
|
103
|
-
prefixItems?: (json_schema_typed.JSONSchema<any, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<any, json_schema_typed.JSONSchema.TypeValue>[]) | json_schema_typed.JSONSchema;
|
|
104
|
-
properties?: Record<string, json_schema_typed.JSONSchema>;
|
|
105
|
-
propertyNames?: json_schema_typed.JSONSchema;
|
|
106
|
-
readOnly?: boolean;
|
|
107
|
-
required?: string[] | readonly string[];
|
|
108
|
-
then?: json_schema_typed.JSONSchema<typeof $input | typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
109
|
-
title?: string;
|
|
110
|
-
type?: json_schema_typed.JSONSchema.TypeValue | undefined;
|
|
111
|
-
unevaluatedItems?: json_schema_typed.JSONSchema;
|
|
112
|
-
unevaluatedProperties?: json_schema_typed.JSONSchema;
|
|
113
|
-
uniqueItems?: boolean;
|
|
114
|
-
writeOnly?: boolean;
|
|
115
|
-
}, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
54
|
+
declare const JSON_SCHEMA_REGISTRY: zod_v4_core.$ZodRegistry<_openapi_spec_types_v3_2.SchemaObjectFields<typeof $input | typeof $output>, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
116
55
|
/**
|
|
117
56
|
* Zod registry for customizing generated JSON schema, only useful for .input
|
|
118
57
|
*
|
|
@@ -132,68 +71,7 @@ declare const JSON_SCHEMA_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
|
132
71
|
*
|
|
133
72
|
* @see {@link https://orpc.dev/docs/integrations/zod | Zod Integration}
|
|
134
73
|
*/
|
|
135
|
-
declare const JSON_SCHEMA_INPUT_REGISTRY: zod_v4_core.$ZodRegistry<
|
|
136
|
-
$anchor?: string;
|
|
137
|
-
$comment?: string;
|
|
138
|
-
$defs?: Record<string, json_schema_typed.JSONSchema>;
|
|
139
|
-
$dynamicAnchor?: string;
|
|
140
|
-
$dynamicRef?: string;
|
|
141
|
-
$id?: string;
|
|
142
|
-
$ref?: string;
|
|
143
|
-
$schema?: string;
|
|
144
|
-
$vocabulary?: Record<string, string>;
|
|
145
|
-
additionalItems?: json_schema_typed.JSONSchema;
|
|
146
|
-
additionalProperties?: json_schema_typed.JSONSchema;
|
|
147
|
-
allOf?: (json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
148
|
-
anyOf?: (json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
149
|
-
const?: typeof $input | undefined;
|
|
150
|
-
contains?: json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
151
|
-
contentEncoding?: "7bit" | "8bit" | "base64" | "binary" | "ietf-token" | "quoted-printable" | "x-token";
|
|
152
|
-
contentMediaType?: string;
|
|
153
|
-
contentSchema?: json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
154
|
-
default?: typeof $input | undefined;
|
|
155
|
-
definitions?: Record<string, json_schema_typed.JSONSchema>;
|
|
156
|
-
dependencies?: Record<string, (string[] | readonly string[]) | json_schema_typed.JSONSchema>;
|
|
157
|
-
dependentRequired?: Record<string, string[] | readonly string[]>;
|
|
158
|
-
dependentSchemas?: Record<string, json_schema_typed.JSONSchema>;
|
|
159
|
-
deprecated?: boolean;
|
|
160
|
-
description?: string;
|
|
161
|
-
else?: json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
162
|
-
enum?: ((typeof $input)[] | readonly (typeof $input)[]) | undefined;
|
|
163
|
-
examples?: ((typeof $input)[] | readonly (typeof $input)[]) | undefined;
|
|
164
|
-
exclusiveMaximum?: number;
|
|
165
|
-
exclusiveMinimum?: number;
|
|
166
|
-
format?: string;
|
|
167
|
-
if?: json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
168
|
-
items?: json_schema_typed.JSONSchema;
|
|
169
|
-
maxContains?: number;
|
|
170
|
-
maximum?: number;
|
|
171
|
-
maxItems?: number;
|
|
172
|
-
maxLength?: number;
|
|
173
|
-
maxProperties?: number;
|
|
174
|
-
minContains?: number;
|
|
175
|
-
minimum?: number;
|
|
176
|
-
minItems?: number;
|
|
177
|
-
minLength?: number;
|
|
178
|
-
minProperties?: number;
|
|
179
|
-
multipleOf?: number;
|
|
180
|
-
not?: json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
181
|
-
oneOf?: (json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
182
|
-
pattern?: string;
|
|
183
|
-
patternProperties?: Record<string, json_schema_typed.JSONSchema>;
|
|
184
|
-
prefixItems?: (json_schema_typed.JSONSchema<any, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<any, json_schema_typed.JSONSchema.TypeValue>[]) | json_schema_typed.JSONSchema;
|
|
185
|
-
properties?: Record<string, json_schema_typed.JSONSchema>;
|
|
186
|
-
propertyNames?: json_schema_typed.JSONSchema;
|
|
187
|
-
readOnly?: boolean;
|
|
188
|
-
required?: string[] | readonly string[];
|
|
189
|
-
then?: json_schema_typed.JSONSchema<typeof $input, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
190
|
-
title?: string;
|
|
191
|
-
type?: json_schema_typed.JSONSchema.TypeValue | undefined;
|
|
192
|
-
unevaluatedItems?: json_schema_typed.JSONSchema;
|
|
193
|
-
unevaluatedProperties?: json_schema_typed.JSONSchema;
|
|
194
|
-
uniqueItems?: boolean;
|
|
195
|
-
writeOnly?: boolean;
|
|
196
|
-
}, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
74
|
+
declare const JSON_SCHEMA_INPUT_REGISTRY: zod_v4_core.$ZodRegistry<_openapi_spec_types_v3_2.SchemaObjectFields<typeof $input>, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
197
75
|
/**
|
|
198
76
|
* Zod registry for customizing generated JSON schema, only useful for .output
|
|
199
77
|
*
|
|
@@ -213,68 +91,7 @@ declare const JSON_SCHEMA_INPUT_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
|
213
91
|
*
|
|
214
92
|
* @see {@link https://orpc.dev/docs/integrations/zod | Zod Integration}
|
|
215
93
|
*/
|
|
216
|
-
declare const JSON_SCHEMA_OUTPUT_REGISTRY: zod_v4_core.$ZodRegistry<
|
|
217
|
-
$anchor?: string;
|
|
218
|
-
$comment?: string;
|
|
219
|
-
$defs?: Record<string, json_schema_typed.JSONSchema>;
|
|
220
|
-
$dynamicAnchor?: string;
|
|
221
|
-
$dynamicRef?: string;
|
|
222
|
-
$id?: string;
|
|
223
|
-
$ref?: string;
|
|
224
|
-
$schema?: string;
|
|
225
|
-
$vocabulary?: Record<string, string>;
|
|
226
|
-
additionalItems?: json_schema_typed.JSONSchema;
|
|
227
|
-
additionalProperties?: json_schema_typed.JSONSchema;
|
|
228
|
-
allOf?: (json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
229
|
-
anyOf?: (json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
230
|
-
const?: typeof $output | undefined;
|
|
231
|
-
contains?: json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
232
|
-
contentEncoding?: "7bit" | "8bit" | "base64" | "binary" | "ietf-token" | "quoted-printable" | "x-token";
|
|
233
|
-
contentMediaType?: string;
|
|
234
|
-
contentSchema?: json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
235
|
-
default?: typeof $output | undefined;
|
|
236
|
-
definitions?: Record<string, json_schema_typed.JSONSchema>;
|
|
237
|
-
dependencies?: Record<string, (string[] | readonly string[]) | json_schema_typed.JSONSchema>;
|
|
238
|
-
dependentRequired?: Record<string, string[] | readonly string[]>;
|
|
239
|
-
dependentSchemas?: Record<string, json_schema_typed.JSONSchema>;
|
|
240
|
-
deprecated?: boolean;
|
|
241
|
-
description?: string;
|
|
242
|
-
else?: json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
243
|
-
enum?: ((typeof $output)[] | readonly (typeof $output)[]) | undefined;
|
|
244
|
-
examples?: ((typeof $output)[] | readonly (typeof $output)[]) | undefined;
|
|
245
|
-
exclusiveMaximum?: number;
|
|
246
|
-
exclusiveMinimum?: number;
|
|
247
|
-
format?: string;
|
|
248
|
-
if?: json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
249
|
-
items?: json_schema_typed.JSONSchema;
|
|
250
|
-
maxContains?: number;
|
|
251
|
-
maximum?: number;
|
|
252
|
-
maxItems?: number;
|
|
253
|
-
maxLength?: number;
|
|
254
|
-
maxProperties?: number;
|
|
255
|
-
minContains?: number;
|
|
256
|
-
minimum?: number;
|
|
257
|
-
minItems?: number;
|
|
258
|
-
minLength?: number;
|
|
259
|
-
minProperties?: number;
|
|
260
|
-
multipleOf?: number;
|
|
261
|
-
not?: json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
262
|
-
oneOf?: (json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue>[]) | undefined;
|
|
263
|
-
pattern?: string;
|
|
264
|
-
patternProperties?: Record<string, json_schema_typed.JSONSchema>;
|
|
265
|
-
prefixItems?: (json_schema_typed.JSONSchema<any, json_schema_typed.JSONSchema.TypeValue>[] | readonly json_schema_typed.JSONSchema<any, json_schema_typed.JSONSchema.TypeValue>[]) | json_schema_typed.JSONSchema;
|
|
266
|
-
properties?: Record<string, json_schema_typed.JSONSchema>;
|
|
267
|
-
propertyNames?: json_schema_typed.JSONSchema;
|
|
268
|
-
readOnly?: boolean;
|
|
269
|
-
required?: string[] | readonly string[];
|
|
270
|
-
then?: json_schema_typed.JSONSchema<typeof $output, json_schema_typed.JSONSchema.TypeValue> | undefined;
|
|
271
|
-
title?: string;
|
|
272
|
-
type?: json_schema_typed.JSONSchema.TypeValue | undefined;
|
|
273
|
-
unevaluatedItems?: json_schema_typed.JSONSchema;
|
|
274
|
-
unevaluatedProperties?: json_schema_typed.JSONSchema;
|
|
275
|
-
uniqueItems?: boolean;
|
|
276
|
-
writeOnly?: boolean;
|
|
277
|
-
}, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
94
|
+
declare const JSON_SCHEMA_OUTPUT_REGISTRY: zod_v4_core.$ZodRegistry<_openapi_spec_types_v3_2.SchemaObjectFields<typeof $output>, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
278
95
|
|
|
279
96
|
export { JSON_SCHEMA_INPUT_REGISTRY, JSON_SCHEMA_OUTPUT_REGISTRY, JSON_SCHEMA_REGISTRY, ZodToJsonSchemaConverter };
|
|
280
97
|
export type { ZodToJsonSchemaConverterOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JsonSchemaXNativeType, JsonSchemaFormat
|
|
2
|
-
import { registry, toJSONSchema
|
|
1
|
+
import { JsonSchemaXNativeType, JsonSchemaFormat } from '@orpc/json-schema';
|
|
2
|
+
import { registry, toJSONSchema } from 'zod/v4/core';
|
|
3
3
|
|
|
4
4
|
const JSON_SCHEMA_REGISTRY = registry();
|
|
5
5
|
const JSON_SCHEMA_INPUT_REGISTRY = registry();
|
|
@@ -85,23 +85,6 @@ class ZodToJsonSchemaConverter {
|
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
const { $schema, ...rest } = jsonSchema;
|
|
88
|
-
const registry = this.toJSONSchemaParams.metadata ?? globalRegistry;
|
|
89
|
-
const { id } = registry.get(schema) || {};
|
|
90
|
-
if (typeof id === "string" && rest.$ref === void 0) {
|
|
91
|
-
const { $defs = {}, ...restWithoutDefs } = rest;
|
|
92
|
-
let defName = id;
|
|
93
|
-
let index = 0;
|
|
94
|
-
while (defName in $defs) {
|
|
95
|
-
defName = `${defName}__${index++}`;
|
|
96
|
-
}
|
|
97
|
-
return {
|
|
98
|
-
$ref: `#/$defs/${encodeJsonPointerSegment(defName)}`,
|
|
99
|
-
$defs: {
|
|
100
|
-
...$defs,
|
|
101
|
-
[defName]: restWithoutDefs
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
88
|
return rest;
|
|
106
89
|
}
|
|
107
90
|
getCustomJsonSchema(schema, direction) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/zod",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.34",
|
|
5
5
|
"description": "Zod integration for oRPC: convert Zod schemas into JSON Schema for OpenAPI generation",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": [
|
|
@@ -36,17 +36,16 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"zod": ">=4.
|
|
39
|
+
"zod": ">=4.5.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@
|
|
43
|
-
"json-schema
|
|
42
|
+
"@openapi-spec/types": "~0.1.0",
|
|
43
|
+
"@orpc/json-schema": "2.0.0-beta.34"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"zod": "^4.4
|
|
46
|
+
"zod": "^4.5.4"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
|
-
"build": "unbuild",
|
|
50
49
|
"type:check": "tsc -b"
|
|
51
50
|
}
|
|
52
51
|
}
|