Spaces:
Sleeping
Sleeping
Download validators.py from RigDataDynamics/cygnus_server: direct link, hf CLI and curl.
- Browser
- Download file 465 Bytes
-
https://huggingface.co/spaces/RigDataDynamics/cygnus_server/resolve/main/validators.py
- Command line
-
hf download hf://spaces/RigDataDynamics/cygnus_server/validators.py
-
curl -L -o validators.py https://huggingface.co/spaces/RigDataDynamics/cygnus_server/resolve/main/validators.py
465 Bytes
| from typing import Any, Dict | |
| from fastapi import HTTPException | |
| from jsonschema import exceptions | |
| from jsonschema.validators import Draft202012Validator | |
| def validate_json_schema(schema: Dict[str, Any]) -> None: | |
| """Validate a JSON schema.""" | |
| try: | |
| Draft202012Validator.check_schema(schema) | |
| except exceptions.ValidationError as e: | |
| raise HTTPException( | |
| status_code=422, detail=f"Not a valid JSON schema: {e.message}" | |
| ) | |