File size: 313 Bytes
201449b
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
import json, jsonschema
from pathlib import Path

def validate_against_schema(instance: dict, schema_name: str):
    schema_path = Path(__file__).parent.parent.parent / "schemas" / schema_name
    with open(schema_path) as f:
        schema = json.load(f)
    jsonschema.validate(instance, schema)
    return True