jsonref
jsonref copied to clipboard
Relative references pointers in multiple directories and files
I have 3 json schemas in 2 directories, for example:
/working/A.json
/ressource/B.json
/ressource/C.json
As shown, B and C schemas are in the same directory.
A uses relative references from B (from another directory):
"$ref": "../ressource/B.json#/definitions/myItemFromB"
and B uses relative references from C (from the same directory):
"$ref": "C.json#/definitions/myItemFromC"
If I load A with a base_uri = /working/
and print it, I get a path error for B referencing C:
jsonref.JsonRefError: URLError: <urlopen error [Errno 2] No such file or directory: /working/C.json
meaning that in jsonref, does not "update" the base_uri when jumping to a different schema file when following references chain.
Indeed, I would expect jsonref to search in /ressource/C.json
.
How can I get the behavior I expect there?