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
"@vinejs/vine@^3.0.0" "@vinejs/compiler@^3.0.0"
Is it possible to have ability to disallow a field conditionally?
export const createUserValidator = vine.compile( vine.object({ country: vine.enum(Object.values(CountryEnum)), compliance_details: vine.object({ entity_name: vine.string().trim(), tax_id: vine.string().trim(), }).forbiddenWhen("country", "in", [ CountryEnum.ABC, CountryEnum.XYZ, ]) }) );
Currently as far as i checked there is no way for the schema to reject if compliance_details exists along with country = .ABC or .XYZ
The text was updated successfully, but these errors were encountered:
Nope. Not yet!
However you can workaround it by making the compliance_details optional and requiring it when country is not in ABC or XYZ.
compliance_details
ABC
XYZ
vine.object({ country: vine.enum(Object.values(CountryEnum)), compliance_details: vine.object({ entity_name: vine.string().trim(), tax_id: vine.string().trim(), }).optional().requiredWhen("country", "notIn", [ CountryEnum.ABC, CountryEnum.XYZ, ]) })
Sorry, something went wrong.
Thanks. Would you be open to having this functionality? Can i contribute?
No branches or pull requests
"@vinejs/vine@^3.0.0"
"@vinejs/compiler@^3.0.0"
Is it possible to have ability to disallow a field conditionally?
Currently as far as i checked there is no way for the schema to reject if compliance_details exists along with country = .ABC or .XYZ
The text was updated successfully, but these errors were encountered: