I have a schema defined this way:
"permissions": {
"type": "array",
"properties": {
"items":
{
"$ref": "#/definitions/permissionsType"
}
}
},
and permissionsType:
"permissionsType": {
"type": "string",
"pattern": "^[a-zA-Z0-9]+(:[a-zA-Z0-9][a-zA-Z0-9-]+)+$"
},
...
I am not sure why the pattern regex is ignored.
Remove the properties
keyword and it will work as expected.
I'm not sure what you're trying to do with the properties
keyword here. properties
only applies when the instance being validated is an object. Because the instance is an array, properties
is ignored. If the instance were an object, the properties
keyword would apply, but it would be expecting an object with a property name "items"
that matches #/definitions/permissionsType
. I don't think that's what you meant. I think you wanted an array whose items all match #/definitions/permissionsType
.
"permissions": {
"type": "array",
"items": { "$ref": "#/definitions/permissionsType" }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With