-
-
Notifications
You must be signed in to change notification settings - Fork 145
feat(zod): promote zod4 converter to stable #763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -39,7 +39,7 @@ import { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| experimental_JSON_SCHEMA_REGISTRY as JSON_SCHEMA_REGISTRY, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from './registries' | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| export interface experimental_ZodToJsonSchemaConverterOptions { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| export interface ZodToJsonSchemaConverterOptions { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Max depth of lazy type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+42
to
44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Public-API rename introduces a breaking change Renaming Add a backward-compatibility shim so existing users are not forced into an immediate major-version upgrade: +/** @deprecated – will be removed in the next major */
+export type experimental_ZodToJsonSchemaConverterOptions =
+ ZodToJsonSchemaConverterOptions📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -85,15 +85,15 @@ export interface experimental_ZodToJsonSchemaConverterOptions { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| >[] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| export class experimental_ZodToJsonSchemaConverter implements ConditionalSchemaConverter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| private readonly maxLazyDepth: Exclude<experimental_ZodToJsonSchemaConverterOptions['maxLazyDepth'], undefined> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| private readonly maxStructureDepth: Exclude<experimental_ZodToJsonSchemaConverterOptions['maxStructureDepth'], undefined> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| private readonly anyJsonSchema: Exclude<experimental_ZodToJsonSchemaConverterOptions['anyJsonSchema'], undefined> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| private readonly unsupportedJsonSchema: Exclude<experimental_ZodToJsonSchemaConverterOptions['unsupportedJsonSchema'], undefined> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| private readonly undefinedJsonSchema: Exclude<experimental_ZodToJsonSchemaConverterOptions['undefinedJsonSchema'], undefined> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| private readonly interceptors: Exclude<experimental_ZodToJsonSchemaConverterOptions['interceptors'], undefined> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| export class ZodToJsonSchemaConverter implements ConditionalSchemaConverter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| private readonly maxLazyDepth: Exclude<ZodToJsonSchemaConverterOptions['maxLazyDepth'], undefined> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| private readonly maxStructureDepth: Exclude<ZodToJsonSchemaConverterOptions['maxStructureDepth'], undefined> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| private readonly anyJsonSchema: Exclude<ZodToJsonSchemaConverterOptions['anyJsonSchema'], undefined> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| private readonly unsupportedJsonSchema: Exclude<ZodToJsonSchemaConverterOptions['unsupportedJsonSchema'], undefined> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| private readonly undefinedJsonSchema: Exclude<ZodToJsonSchemaConverterOptions['undefinedJsonSchema'], undefined> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| private readonly interceptors: Exclude<ZodToJsonSchemaConverterOptions['interceptors'], undefined> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| constructor(options: experimental_ZodToJsonSchemaConverterOptions = {}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| constructor(options: ZodToJsonSchemaConverterOptions = {}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+88
to
+96
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Same breaking change for the class – please keep a deprecated alias +/** @deprecated – will be removed in the next major */
+export class experimental_ZodToJsonSchemaConverter
+ extends ZodToJsonSchemaConverter {}This adds zero runtime cost yet preserves compatibility for downstream libraries/tests that still rely on the experimental identifier. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.maxLazyDepth = options.maxLazyDepth ?? 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.maxStructureDepth = options.maxStructureDepth ?? 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.anyJsonSchema = options.anyJsonSchema ?? {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid naming conflicts, rename the imported
ZodToJsonSchemaConverterfrom@orpc/zod/zod4toZodToJsonSchemaConverterV4.