Spaces:
Running
Running
Commit ·
088ac34
1
Parent(s): 9199ba5
Validate schema date formats (#7)
Browse files- Validate schema date formats (3de3fcb165b5f3237cfdbdae5fb364cde7250ac9)
Co-authored-by: Chaewon Yoon <melover24@users.noreply.huggingface.co>
scripts/validate_questions.py
CHANGED
|
@@ -15,6 +15,7 @@ except ImportError:
|
|
| 15 |
ROOT = Path(__file__).resolve().parent.parent
|
| 16 |
SCHEMA = json.loads((ROOT / "schema.json").read_text())
|
| 17 |
QUESTIONS_DIR = ROOT / "questions"
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
def main() -> int:
|
|
@@ -40,7 +41,7 @@ def main() -> int:
|
|
| 40 |
continue
|
| 41 |
|
| 42 |
try:
|
| 43 |
-
jsonschema.validate(item, SCHEMA)
|
| 44 |
except jsonschema.ValidationError as e:
|
| 45 |
print(f"{path.name}:{lineno}: {e.message}")
|
| 46 |
errors += 1
|
|
|
|
| 15 |
ROOT = Path(__file__).resolve().parent.parent
|
| 16 |
SCHEMA = json.loads((ROOT / "schema.json").read_text())
|
| 17 |
QUESTIONS_DIR = ROOT / "questions"
|
| 18 |
+
FORMAT_CHECKER = jsonschema.FormatChecker()
|
| 19 |
|
| 20 |
|
| 21 |
def main() -> int:
|
|
|
|
| 41 |
continue
|
| 42 |
|
| 43 |
try:
|
| 44 |
+
jsonschema.validate(item, SCHEMA, format_checker=FORMAT_CHECKER)
|
| 45 |
except jsonschema.ValidationError as e:
|
| 46 |
print(f"{path.name}:{lineno}: {e.message}")
|
| 47 |
errors += 1
|