diff --git a/scripts/validate_content.py b/scripts/validate_content.py index c16f917..2a62fe6 100644 --- a/scripts/validate_content.py +++ b/scripts/validate_content.py @@ -18,8 +18,8 @@ import json import sys from pathlib import Path -import jsonschema from jsonschema import Draft202012Validator +from referencing import Registry, Resource REPO_ROOT = Path(__file__).resolve().parent.parent SKILL_SCHEMA = REPO_ROOT / "content/schemas/skill-def.schema.json" @@ -576,9 +576,13 @@ def _recipe_def_validator() -> Draft202012Validator: """Build a validator that resolves recipe-def $ref to recipe-io-row schema.""" io_schema = json.loads(RECIPE_IO_ROW_SCHEMA.read_text(encoding="utf-8")) def_schema = json.loads(RECIPE_SCHEMA.read_text(encoding="utf-8")) - schema_store = {io_schema["$id"]: io_schema, def_schema["$id"]: def_schema} - resolver = jsonschema.RefResolver.from_schema(def_schema, store=schema_store) - return Draft202012Validator(def_schema, resolver=resolver) + registry = Registry().with_resources( + [ + (def_schema["$id"], Resource.from_contents(def_schema)), + (io_schema["$id"], Resource.from_contents(io_schema)), + ] + ) + return Draft202012Validator(def_schema, registry=registry) def _prototype_slice3_recipe_gate(