Skip to content

patternProperties in conjunction with additionalItems doesn't work as expected #759

Closed
@vadimbo

Description

@vadimbo

I'm having such schema:

"attr": {
	"type": "object",
	"additionalItems": false,
	"patternProperties":{
		"^\\w+$":{
			"type": ["integer", "boolean"],
			"title": "Additional Attributes' Value"
		}
	}
}

So basically I want to accept/validate only attributes with the keyword containing one word only [i.e. test, attribute, etc. and won't accept keywords such as test 1, attribute test etc.

When validating such an input :

{
  "attr": {
    "test1": 1,
    "test2": true,
    "test test": "1"
  }
}

Expected Result:
The regex should not match the input and because additionalItems is false it should throw at least an exception that provided keywords not matching regex

Actual result:
No Exceptions are thrown and validation passes successfully.

jsonschema version: 3.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions