Skip to content

Commit 9cd4eb7

Browse files
authored
feat(zod): promote zod4 converter to stable (#763)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Updated all documentation and example code to reference `ZodToJsonSchemaConverter` instead of the previous experimental alias. This streamlines and clarifies usage instructions for OpenAPI spec generation. * **Refactor** * Renamed the interface and class for the JSON Schema converter to remove the experimental prefix, reflecting their stable status. * Updated all references in the codebase and tests to use the new names, ensuring consistency throughout. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent c84c835 commit 9cd4eb7

19 files changed

Lines changed: 27 additions & 31 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ This is a quick overview of how to use oRPC. For more details, please refer to t
177177

178178
```ts
179179
import { OpenAPIGenerator } from '@orpc/openapi'
180-
import { experimental_ZodToJsonSchemaConverter as ZodToJsonSchemaConverter } from '@orpc/zod/zod4'
180+
import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4'
181181

182182
const generator = new OpenAPIGenerator({
183183
schemaConverters: [new ZodToJsonSchemaConverter()]

apps/content/docs/openapi/getting-started.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,7 @@ Just a small tweak makes your oRPC API OpenAPI-compliant!
171171

172172
```ts twoslash
173173
import { OpenAPIGenerator } from '@orpc/openapi'
174-
import {
175-
experimental_ZodToJsonSchemaConverter as ZodToJsonSchemaConverter
176-
} from '@orpc/zod/zod4'
174+
import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4'
177175
import { router } from './shared/planet'
178176
179177
const generator = new OpenAPIGenerator({

apps/content/docs/openapi/openapi-specification.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ import {
7272
ZodToJsonSchemaConverter
7373
} from '@orpc/zod' // <-- zod v3
7474
import {
75-
experimental_ZodToJsonSchemaConverter as ZodToJsonSchemaConverter
75+
ZodToJsonSchemaConverter
7676
} from '@orpc/zod/zod4' // <-- zod v4
7777
import {
7878
experimental_ValibotToJsonSchemaConverter as ValibotToJsonSchemaConverter

apps/content/docs/openapi/plugins/openapi-reference.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ This plugin relies on the [OpenAPI Generator](/docs/openapi/openapi-specificatio
1414
## Setup
1515

1616
```ts
17-
import {
18-
experimental_ZodToJsonSchemaConverter as ZodToJsonSchemaConverter
19-
} from '@orpc/zod/zod4'
17+
import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4'
2018
import { OpenAPIReferencePlugin } from '@orpc/openapi/plugins'
2119

2220
const handler = new OpenAPIHandler(router, {

packages/json-schema/src/smart-coercion-plugin.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as z from 'zod'
2-
import { experimental_ZodToJsonSchemaConverter as ZodToJsonSchemaConverter } from '../../zod/src/zod4'
2+
import { ZodToJsonSchemaConverter } from '../../zod/src/zod4'
33
import { experimental_SmartCoercionPlugin as SmartCoercionPlugin } from './smart-coercion-plugin'
44

55
describe('smartCoercionPlugin', () => {

packages/openapi/src/openapi-generator.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { AnyContractProcedure } from '@orpc/contract'
22
import { eventIterator, oc } from '@orpc/contract'
33
import * as z from 'zod'
4-
import { experimental_ZodToJsonSchemaConverter as ZodToJsonSchemaConverter } from '../../zod/src/zod4'
4+
import { ZodToJsonSchemaConverter } from '../../zod/src/zod4'
55
import { customOpenAPIOperation } from './openapi-custom'
66
import { OpenAPIGenerator } from './openapi-generator'
77

packages/zod/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const Example = z.object({
8686

8787
```ts
8888
import { OpenAPIGenerator } from '@orpc/openapi'
89-
import { experimental_ZodToJsonSchemaConverter as ZodToJsonSchemaConverter } from '@orpc/zod/zod4'
89+
import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4'
9090

9191
const openAPIGenerator = new OpenAPIGenerator({
9292
schemaConverters: [new ZodToJsonSchemaConverter()],

packages/zod/src/zod4/converter.components.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { z } from 'zod/v4'
2-
import { experimental_ZodToJsonSchemaConverter as ZodToJsonSchemaConverter } from './converter'
2+
import { ZodToJsonSchemaConverter } from './converter'
33

44
const User = z.object({
55
id: z.string(),

packages/zod/src/zod4/converter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as z from 'zod/v4'
22
import * as zm from 'zod/v4-mini'
33
import {
4-
experimental_ZodToJsonSchemaConverter as ZodToJsonSchemaConverter,
4+
ZodToJsonSchemaConverter,
55
} from './converter'
66

77
describe('zodToJsonSchemaConverter', () => {

packages/zod/src/zod4/converter.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import {
3939
experimental_JSON_SCHEMA_REGISTRY as JSON_SCHEMA_REGISTRY,
4040
} from './registries'
4141

42-
export interface experimental_ZodToJsonSchemaConverterOptions {
42+
export interface ZodToJsonSchemaConverterOptions {
4343
/**
4444
* Max depth of lazy type.
4545
*
@@ -85,15 +85,15 @@ export interface experimental_ZodToJsonSchemaConverterOptions {
8585
>[]
8686
}
8787

88-
export class experimental_ZodToJsonSchemaConverter implements ConditionalSchemaConverter {
89-
private readonly maxLazyDepth: Exclude<experimental_ZodToJsonSchemaConverterOptions['maxLazyDepth'], undefined>
90-
private readonly maxStructureDepth: Exclude<experimental_ZodToJsonSchemaConverterOptions['maxStructureDepth'], undefined>
91-
private readonly anyJsonSchema: Exclude<experimental_ZodToJsonSchemaConverterOptions['anyJsonSchema'], undefined>
92-
private readonly unsupportedJsonSchema: Exclude<experimental_ZodToJsonSchemaConverterOptions['unsupportedJsonSchema'], undefined>
93-
private readonly undefinedJsonSchema: Exclude<experimental_ZodToJsonSchemaConverterOptions['undefinedJsonSchema'], undefined>
94-
private readonly interceptors: Exclude<experimental_ZodToJsonSchemaConverterOptions['interceptors'], undefined>
88+
export class ZodToJsonSchemaConverter implements ConditionalSchemaConverter {
89+
private readonly maxLazyDepth: Exclude<ZodToJsonSchemaConverterOptions['maxLazyDepth'], undefined>
90+
private readonly maxStructureDepth: Exclude<ZodToJsonSchemaConverterOptions['maxStructureDepth'], undefined>
91+
private readonly anyJsonSchema: Exclude<ZodToJsonSchemaConverterOptions['anyJsonSchema'], undefined>
92+
private readonly unsupportedJsonSchema: Exclude<ZodToJsonSchemaConverterOptions['unsupportedJsonSchema'], undefined>
93+
private readonly undefinedJsonSchema: Exclude<ZodToJsonSchemaConverterOptions['undefinedJsonSchema'], undefined>
94+
private readonly interceptors: Exclude<ZodToJsonSchemaConverterOptions['interceptors'], undefined>
9595

96-
constructor(options: experimental_ZodToJsonSchemaConverterOptions = {}) {
96+
constructor(options: ZodToJsonSchemaConverterOptions = {}) {
9797
this.maxLazyDepth = options.maxLazyDepth ?? 2
9898
this.maxStructureDepth = options.maxStructureDepth ?? 10
9999
this.anyJsonSchema = options.anyJsonSchema ?? {}

0 commit comments

Comments
 (0)