vuetify-jsonschema-form
vuetify-jsonschema-form copied to clipboard
Multiple types combined with pattern can break validation
Given:
{
type: 'object',
properties: {
anyProp: {
"type": [
"string",
"boolean"
],
"pattern": "^[^${}]+$",
"default": true
}
}
}
Expected result:
validation ok, and {anyProp: true}
Actual result:
TypeError: e.match is not a function
Analysis: when applying validation rules, string is expected but other type (in this case: boolean) is given.
What does json-schema say about that ? Are you sure a validator like ajv will ever accept a boolean value, or will it always estimate that it fails the pattern rule ?
https://www.jsonschemavalidator.net/s/O7JdN2OS is fine with it.