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

fix: discriminatedUnion allOf issue #249

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

nmcdaines
Copy link
Contributor

An issue was previously raised #110 whereby the z.discriminatedUnion caused issues in the gererated schema.

It appears the issue is caused by the z.and type, this breaks inference when used within a z.discriminatedUnion.

In order to solve this, whenever there are multiple objects defined within an allOf block we should instead opt to use a z.union type instead; which then allows the z.and type to be infered correctly.

Copy link

vercel bot commented Dec 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
openapi-zod-client ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 5, 2023 10:22pm

@astahmer
Copy link
Owner

astahmer commented Dec 5, 2023

hey, thank you for working on this ! could you add a a changeset ?

@nmcdaines
Copy link
Contributor Author

Hey @astahmer, thanks for reviewing and apologies for not including a changeset 🙏
I've amended my previous commit to include a changeset 👍

@astahmer astahmer merged commit 8dfb265 into astahmer:main Dec 5, 2023
6 checks passed
@github-actions github-actions bot mentioned this pull request Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants