DCA-01 / src /common /validation.py
Shorx's picture
Upload 33 files
201449b verified
Raw History Blame Contribute Delete
313 Bytes
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