Resolve uri references in remote schemas against those schemas' base uris #308
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Presently when resolving a remote schema, uri-references within that schema are not correctly resolved against the base uri of the original reference.
For example, my schema references
https://json-schema.org/draft/2020-12/schema
which in turn referencesmeta/core
. The current result is a joined path ofwhich doesn't exist, and in turn results in an incomplete doc, and the following output:
Fix
Before attempting to join the paths using
os.path.join
as a filesystem path, test if the current file is from a remote URL, and if so, resolve theuri_part
as a URL path instead.Testing
From local testing this has resolved the errors I was getting, and the docs render correctly. Additionally I ran the
poetry run pytest tests
command from the contributing doc.