-
-
Notifications
You must be signed in to change notification settings - Fork 610
Closed
Labels
BugSomething doesn't work the way it should.Something doesn't work the way it should.
Description
It seems the applicable_validators property from c6b0fc4 never made it to extend.
This means that extending Draft4Validator (or other legacy validators) makes it consider properties next to $ref again. (This made connexion break OpenAPI 3.0 spec - spec-first/connexion#1721)
Steps to reproduce
import jsonschema
schema = {
"$defs": { "test": { "type": "number" } },
"$ref": "#/$defs/test",
"maximum": 1
}
# no error, maximum is ignored as per spec
jsonschema.validate(schema=schema, instance=2, cls=jsonschema.Draft4Validator)
# extend() with no changes
BadValidator = jsonschema.validators.extend(jsonschema.Draft4Validator)
# jsonschema.exceptions.ValidationError: 2 is greater than the maximum of 1
jsonschema.validate(schema=schema, instance=2, cls=BadValidator)Environment
$ python --version
Python 3.11.2
$ pip show jsonschema | grep Version
Version: 4.18.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugSomething doesn't work the way it should.Something doesn't work the way it should.