vuetify-jsonschema-form icon indicating copy to clipboard operation
vuetify-jsonschema-form copied to clipboard

Multiple types combined with pattern can break validation

Open jakobsa opened this issue 2 years ago • 2 comments

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.

jakobsa avatar Aug 17 '22 12:08 jakobsa

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 ?

albanm avatar Aug 17 '22 12:08 albanm

https://www.jsonschemavalidator.net/s/O7JdN2OS is fine with it.

jakobsa avatar Aug 17 '22 12:08 jakobsa