Shortcuts module

One liners that make the code shorter

json_schema_validator.shortcuts.validate(schema_text, data_text)

Validate specified JSON text (data_text) with specified schema (schema text). Both are converted to JSON objects with simplesjon.loads().

Parameters:
  • schema_text (str) – Text of the JSON schema to check against
  • data_text (str) – Text of the JSON object to check
Returns:

Same as json_schema_validator.validator.Validator.validate()

Raises:

Whatever may be raised by simplejson (in particular simplejson.decoder.JSONDecoderError, a subclass of ValueError)

Raises:

Whatever may be raised by json_schema_validator.validator.Validator.validate(). In particular json_schema_validator.errors.ValidationError and json_schema_validator.errors.SchemaError

Previous topic

Schema module

Next topic

Validator module

This Page