Jsonschema¶
Functions and classes to wrap around and extend the jsonschema library.
- metatrain.utils.jsonschema.validate(instance, schema, cls=None, *args, **kwargs) None [source]¶
Validate an instance under the given schema.
Function similar to
jsonschema.validate
but displaying only the human readable error message without showing the reference schema and path if the instance is invalid. In addition, if the error is caused by unallowedadditionalProperties
the closest matching properties will be suggested.- Parameters:
instance – Instance to validate
schema – Schema to validate with
- Raises:
jsonschema.exceptions.ValidationError – If the instance is invalid
jsonschema.exceptions.SchemaError – If the schema itself is invalid
- Return type:
None