Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative path $ref schemas should get base URL from parent schema #63

Open
acka47 opened this issue Nov 30, 2020 · 1 comment
Open

Relative path $ref schemas should get base URL from parent schema #63

acka47 opened this issue Nov 30, 2020 · 1 comment
Assignees

Comments

@acka47
Copy link
Member

acka47 commented Nov 30, 2020

From @stefandesu in #39 (comment):

I have an issue that seems to be related to this one. Our JSON Schemas for JSKOS are split up and reference each other. However, we are using relative URLs instead of absolute. For example, https://gbv.github.io/jskos/scheme.schema.json references several other schemas, like resource.schema.json. In SkoHub Editor, these don't get resolved properly. It uses the URL where the editor is hosted as the base URL instead of the id.

In the JSON Schema documentation, it says:

The $id property is a URI-reference that serves two purposes:

  • It declares a unique identifier for the schema.
  • It declares a base URI against which $ref URI-references are resolved.

So as far as I understand, if I reference resource.schema.json in a schema with the ID https://gbv.github.io/jskos/scheme.schema.json, it should be resolved as https://gbv.github.io/jskos/resource.schema.json.

The lookup mechanism for ref in SkoHub Editor should thus be adjusted so that the base URL is taken from the $id parent schema where $ref occurs.

@stefandesu
Copy link

I'm pretty sure this has to be implemented in the json-schema-ref-parser library since all you're doing is to use their dereference method. I couldn't find anything in their documentation or issues regarding this though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants