import json import jsonschema with open("config.schema.json") as file: schema = json.load(file) def validate(config): try: jsonschema.validate(config, schema) except jsonschema.SchemaError: print("Schema invalid") return False except jsonschema.ValidationError: print("Config invalid") return False return True