fix: require the jsonschema format checkers

This commit is contained in:
Abdessamad Derraz committed 2026-10-06 09:45:25 +02:00
1 parent 892cff38bc
commit e9653069a2
7 files changed
+59 -5

No files matched your search

+3 -1
View File
@@ -804,7 +804,9 @@ def _check_fbneo(cache_dir: str, offline: bool) -> Finding:
# --- CI toolchain -----------------------------------------------------------
_PIN_RE = re.compile(r'"?([A-Za-z0-9_.\-]+)((?:[<>=!~]=?[^,"\s]+)(?:,[<>=!~]=?[^,"\s]+)*)?"?')
_PIN_RE = re.compile(
r'"?([A-Za-z0-9_.\-]+)(?:\[[^\]]*\])?((?:[<>=!~]=?[^,"\s]+)(?:,[<>=!~]=?[^,"\s]+)*)?"?'
)
_USES_RE = re.compile(r"uses:\s*([\w.\-]+/[\w.\-]+)@([0-9a-f]{40})\s*(?:#\s*(\S+))?")
+24
View File
@@ -254,6 +254,20 @@ def _semantic_install_checks(path: Path, manifest: dict) -> list[str]:
return out
def unchecked_formats() -> list[str]:
"""Formats the schemas declare that this jsonschema install cannot check.
date-time and uri need the format extras; without them the ten format
constraints of the published schemas were accepted unread.
"""
used = {
match
for path in SCHEMAS.glob("*.json")
for match in re.findall(r'"format"\s*:\s*"([^"]+)"', path.read_text(encoding="utf-8"))
}
return sorted(used - set(FormatChecker().checkers))
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
@@ -263,6 +277,16 @@ def main() -> int:
)
args = parser.parse_args()
unchecked = unchecked_formats()
if unchecked:
# jsonschema skips a format it has no checker for, silently.
print(
f"ERROR no checker for format(s) {', '.join(unchecked)}: "
'install "jsonschema[format-nongpl]"',
file=sys.stderr,
)
return 1
errors: list[str] = []
errors.extend(
_validate_yaml_directory(ROOT / "emulators", "emulator.schema.json")