We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
anyOf
Describe the bug
When using anyOf for an optional field, validation criteria are not generated.
Minimal reproduction
"first_name": { "type": "string", "minLength": 1 "maxLength": 30 }
The above works, and produces:
.object({ first_name: z.string().min(1).max(30), })
The below does not work:
"first_name": { "anyOf": [ { "type": "string", "maxLength": 30, "minLength": 1 }, { "type": "null" } ], "default": null }
and produces:
.object({ first_name: z.union([z.string(), z.null()]), })
Expected behavior
should produce:
.object({ first_name: z.union([z.string().min(1).max(30), z.null()]), })
The text was updated successfully, but these errors were encountered:
.object({ first_name: z.string().min(1).max(30).nullable(), })
Sorry, something went wrong.
No branches or pull requests
Describe the bug
When using
anyOf
for an optional field, validation criteria are not generated.Minimal reproduction
The above works, and produces:
The below does not work:
and produces:
Expected behavior
should produce:
The text was updated successfully, but these errors were encountered: