use draft-7 jsonschema validator
Change-Id: I6ae9ec146e2aa3e4f2b9875c1a9cc8edb5780b6d
This commit is contained in:
parent
0740ece61a
commit
9f93c8105b
@ -32,6 +32,9 @@ Changed
|
||||
* `xrally/xrally docker image <https://hub.docker.com/r/xrally/xrally>`_ switched
|
||||
to use python3.11-slim as a base image instead of python3.9-slim.
|
||||
|
||||
* Use 'draft-7' as a default jsonschema validator when there is no meta-schema
|
||||
field specified at ``$schema``.
|
||||
|
||||
Added
|
||||
~~~~~
|
||||
|
||||
|
@ -30,8 +30,13 @@ class JsonSchemaValidator(validation.Validator):
|
||||
"""JSON schema validator"""
|
||||
|
||||
def validate(self, context, config, plugin_cls, plugin_cfg):
|
||||
validator = jsonschema.validators.validator_for(
|
||||
plugin_cls.CONFIG_SCHEMA, default=jsonschema.Draft7Validator
|
||||
)
|
||||
try:
|
||||
jsonschema.validate(plugin_cfg, plugin_cls.CONFIG_SCHEMA)
|
||||
jsonschema.validate(
|
||||
plugin_cfg, plugin_cls.CONFIG_SCHEMA, cls=validator
|
||||
)
|
||||
except jsonschema.ValidationError as err:
|
||||
self.fail(str(err))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user