Mentions légales du service

Skip to content

#152 jsonschema

Van-Tuan Bui requested to merge #152_jsonschema into master

We have warnings in the newest version jsonschema: DeprecationWarning: "Subclassing validator classes is not intended to "
# "be part of their public API. A future version "
# "will make doing so an error, as the behavior of "
# "subclasses isn't guaranteed to stay the same "
# "between releases of jsonschema. Instead, prefer "
# "composition of validators, wrapping them in an object "
# "owned entirely by the downstream library."

To address this, it is advisable to wrap the validators rather than using subclassing. I have encapsulated all validators within the class ConfigValidator. Consequently, the behavior changes, leading to changes in the error messages. Now, it is challenging to trace the path of errors as previously demonstrated for example in tests/test_schemas.py:

assert ("'learned_params.selection': must be an object like:"
assert ("'selection': must be an object like:" in str(exc.value)).

As you have known that RefResolver was migrated to referencing.Registry which represents a set of resources that must contain an $id keyword. Considering that relative $ref does not seem to function effectively with the registry, I have converted all $ref instances to absolute paths.

Merge request reports