Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Unable to reference local "urn:" URI when used in indirection (draft-07 schema)

Open
#549 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
cli

Research direction

Start by reproducing the draft-07 example with check_jsonschema --schemafile values.schema.json values.yaml, then inspect the schema-resolution path around check_jsonschema/checker.py:85 and the referenced jsonschema resolver frames. Done means the local urn: indirection is handled correctly for draft-07 while preserving the existing 2019-09 behavior, with regression coverage for the supplied schemas.

Written by the indexing model from the issue text.

Description

check-jsonschema seems to fail to resolve a $ref in draft-07 schema when used as indirection.

I do not rule out an error in the schema I am using, but I have personally been unable to verify any non-compliance to the spec: https://json-schema.org/draft-07

Notes:

  • The schema will work with check-jsonschema if draft-07 is changed to 2019-09 (and "definitions" changed to "$defs").
  • The schema works fine when used with helm.

Contrived example:

values.yaml:

someVal: "a string"

values.schema.json:

{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$id": "urn:my-project:helm:schemas:v1:my-helm-chart",
  "type": "object",
  "properties": {
    "someVal": {
      "$ref": "urn:my-project:helm:schemas:v1:my-helm-chart/unnecessary-indirection"
    }
  },
  "definitions": {
    "indirection": {
      "$id": "urn:my-project:helm:schemas:v1:my-helm-chart/unnecessary-indirection",
      "$ref": "urn:my-project:helm:schemas:v1:my-helm-chart/string-type"
    },
    "string": {
      "$id": "urn:my-project:helm:schemas:v1:my-helm-chart/string-type",
      "type": "string"
    }
  }
}

Results:

> check_jsonschema --schemafile values.schema.json values.yaml
Failure resolving $ref within schema

_WrappedReferencingError: Unresolvable: urn:my-project:helm:schemas:v1:my-helm-chart/unnecessary-indirection
  in "/local/workspace/repos/_external/check-jsonschema/venv/lib/python3.12/site-packages/check_jsonschema/checker.py", line 85
  >>> result = self._build_result()

  caused by

  Unresolvable: urn:my-project:helm:schemas:v1:my-helm-chart/unnecessary-indirection
    in "/local/workspace/repos/_external/check-jsonschema/venv/lib/python3.12/site-packages/jsonschema/validators.py", line 463
    >>> resolved = self._resolver.lookup(ref)

    caused by

    Unretrievable: 'urn:my-project:helm:schemas:v1:my-helm-chart/unnecessary-indirection'
      in "/local/workspace/repos/_external/check-jsonschema/venv/lib/python3.12/site-packages/referencing/_core.py", line 682
      >>> retrieved = self._registry.get_or_retrieve(uri)

      caused by

      FileNotFoundError: [Errno 2] No such file or directory: '/local/workspace/repos/_external/check-jsonschema/urn:my-project:helm:schemas:v1:my-helm-chart/unnecessary-indirection'
        in "/local/workspace/repos/_external/check-jsonschema/venv/lib/python3.12/site-packages/referencing/_core.py", line 428
        >>> resource = registry._retrieve(uri)

Background
At $workplace, all helm charts gets their values.schema.json generated by a tool that heavily uses $ref properties to split up the file into multiple schemas. The resulting schema works as intended with helm CLI command.

I have started running the schemas against other schema validators than helm to see if there are any differences in the validation results. I do this both for fun and for trying to find possible improvements to our schemas.

Dominant language
Python
Stars
341
Forks
71
Avg merge
6d 13h
Merged PRs (30d)
6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from python-jsonschema/check-jsonschema

All issues in python-jsonschema/check-jsonschema

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.