validate
ensembl.io.genomio.schemas.json.validate
¶
    Validates a JSON file with the provided JSON schema.
Examples:
>>> from ensembl.io.genomio.schemas import json
>>> json.schema_validator(json_file="functional_annotation.json", json_schema="functional_annotation")
>>> json.schema_validator(json_file="functional_annotation.json", json_schema="genome")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "ensembl-genomio/src/python/ensembl/io/genomio/schemas/json/validate.py", line 63,
  in schema_validator
    jsonschema.validate(instance=content, schema=schema)
  File ".venv/dev/lib/python3.10/site-packages/jsonschema/validators.py", line 1306, in validate
    raise error
<list of all the elements from functional_annotation.json that failed validation>
main()
¶
    Main script entry-point.
Source code in src/python/ensembl/io/genomio/schemas/json/validate.py
              | 74 75 76 77 78 79 80 81 82 83 84 |  | 
schema_validator(json_file, json_schema)
¶
    Validates a JSON file with the provided JSON schema.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| json_file | PathLike | Path to the JSON file to check. | required | 
| json_schema | Union[str, PathLike] | JSON schema to validate  | required | 
Source code in src/python/ensembl/io/genomio/schemas/json/validate.py
              | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |  |