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

Empty base selection for grab should not create an empty object schema for validation #25

Closed
gksander opened this issue Jan 12, 2023 · 1 comment · May be fixed by #75
Closed

Empty base selection for grab should not create an empty object schema for validation #25

gksander opened this issue Jan 12, 2023 · 1 comment · May be fixed by #75
Assignees
Labels
bug Something isn't working

Comments

@gksander
Copy link
Contributor

Per this comment, we should look into the case where an empty object is provided as the first arg to grab. Right now, grab will generate an empty object schema that then gets thrown into a union schema, which will cause some weird results.

In code, we have this:

// ...
z.union([...conditionalFieldSchemas, baseSchema])

and when the first arg to grab is an empty object, that baseSchema field should be omitted from this union.

@gksander
Copy link
Contributor Author

The .select suite of methods resolves this issue 👨‍🍳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant