def _validate ( data , schema , ac_schema_safe = True , * * options ) : try : jsonschema . validate ( data , schema , * * options ) except ( jsonschema . ValidationError , jsonschema . SchemaError , Exception ) as exc : if ac_schema_safe : return ( False , str ( exc ) ) # Validation was failed. raise return ( True , '' )
python jsonschema validate schema file
See the descritpion of : func : validate for more details of parameters and return value .
def _validate(data, schema, ac_schema_safe=True, **options):
    """
    See the descritpion of :func:`validate` for more details of parameters and
    return value.

    Validate target object 'data' with given schema object.
    """
    try:
        jsonschema.validate(data, schema, **options)

    except (jsonschema.ValidationError, jsonschema.SchemaError,
            Exception) as exc:
        if ac_schema_safe:
            return (False, str(exc))  # Validation was failed.
        raise

    return (True, '')