Skip to content
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

remove warning on Zod union conversions to Jzod #9

Open
miroir-framework opened this issue Jun 17, 2024 · 0 comments
Open

remove warning on Zod union conversions to Jzod #9

miroir-framework opened this issue Jun 17, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@miroir-framework
Copy link
Owner

miroir-framework commented Jun 17, 2024

There's a warning:

zodToJzod: Zod discriminated unions are converted to unions in Jzod, which are converted back as plain unions in Zod, not discriminated unions as the original Zod Schema.

It shall be removed, as Zod discriminated unions are correctly converted to Jzod discriminated unions. The problem lies in the conversion of Jzod discriminated unions to Zod "plain" (not discriminated) unions. Jzod discriminated unions are not converted into Zod discriminated unions because Zod discriminated unions can not be harmoniously nested, there is an irregularity in the "result" (is it the created TS type from zod-to-ts or the parse() behavior?). TODO: CREATE AN ISSUE ON ZOD / ZOD-TO-TS DESCRIBING THE PROBLEM).

A warning shall be added during the conversion of Jzod discriminated unions with multiple discriminators (discriminatorType="array") to Zod, since Zod does not support discriminated unions with multiple discriminators.

@miroir-framework miroir-framework added the enhancement New feature or request label Jun 17, 2024
@miroir-framework miroir-framework added this to the 0.8.0 milestone Jun 17, 2024
@miroir-framework miroir-framework self-assigned this Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

1 participant