You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you run jsonschema-gentypes with a path like --json=../path/to/some.json, and that file has relative $ref entries in it, resolution will fail.
Repro:
$ cat base.json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$ref": "sub.json"
}
$ cat sub.json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type":"object",
"properties": { "x": { "type": "string" } }
}
$ jsonschema-gentypes --json=base.json --python=out.py
Processing base.json
$ cd subdir
$ jsonschema-gentypes --json=../base.json --python=out.py
Processing ../base.json
Traceback (most recent call last):
File "/Users/dbushong/.pyenv/versions/3.8.14/lib/python3.8/site-packages/referencing/_core.py", line 417, in get_or_retrieve
resource = registry._retrieve(uri)
File "/Users/dbushong/.pyenv/versions/3.8.14/lib/python3.8/site-packages/jsonschema_gentypes/resolver.py", line 83, in _open_uri_resolver
my_resource = referencing.Resource.from_contents(_open_uri(uri))
File "/Users/dbushong/.pyenv/versions/3.8.14/lib/python3.8/site-packages/jsonschema_gentypes/resolver.py", line 63, in _open_uri
with open(uri, encoding="utf-8") as open_file:
FileNotFoundError: [Errno 2] No such file or directory: 'sub.json'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/dbushong/.pyenv/versions/3.8.14/lib/python3.8/site-packages/referencing/_core.py", line 667, in lookup
retrieved = self._registry.get_or_retrieve(uri)
File "/Users/dbushong/.pyenv/versions/3.8.14/lib/python3.8/site-packages/referencing/_core.py", line 424, in get_or_retrieve
raise exceptions.Unretrievable(ref=uri) from error
referencing.exceptions.Unretrievable: 'sub.json'
Note that it works fine if you don't have .. in your path
The text was updated successfully, but these errors were encountered:
If you run
jsonschema-gentypes
with a path like--json=../path/to/some.json
, and that file has relative$ref
entries in it, resolution will fail.Repro:
Note that it works fine if you don't have
..
in your pathThe text was updated successfully, but these errors were encountered: