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

Problem with schema including $ref to other schema in GH pages #39

Closed
acka47 opened this issue Apr 8, 2020 · 4 comments · Fixed by #55
Closed

Problem with schema including $ref to other schema in GH pages #39

acka47 opened this issue Apr 8, 2020 · 4 comments · Fixed by #55
Assignees
Labels
bug Something isn't working

Comments

@acka47
Copy link
Member

acka47 commented Apr 8, 2020

(Background: I started to split up the default JSON schema following the approach in https://json-schema.org/learn/getting-started-step-by-step.html#references (see the branch at https://github.com/dini-ag-kim/lrmi-profile/tree/splitUpSchema). Before merging this into master I wanted to try out whether this approach actually works with SkoHub editor.)

So I tried it out at https://github.com/acka47/lrmi-profile with only one reference and the same GH pages setup. The resulting schema is at https://acka47.github.io/lrmi-profile/draft/schemas/schema.json (see the creator property with the reference to https://acka47.github.io/lrmi-profile/draft/schemas/creator.json.

However, loading this schema in https://skohub.io/editor/ does not work, see https://skohub.io/editor/?schema=https://acka47.github.io/lrmi-profile/draft/schemas/schema.json

In the console, there are for one several CORS-related errors ("Cross-Origin Request Blocked") and another error: "Error: Invalid JSON pointer: ttps://acka47.github.io/lrmi-profile/draft/schemas/creator.json index.js:209:36" (Strangely, the "h" in "https" is omitted there.)

Re. CORS and GitHub pages, this has been supported for some time now (see https://stackoverflow.com/questions/26416727/cross-origin-resource-sharing-on-github-pages), so I wonder what is the problem there.

@acka47
Copy link
Member Author

acka47 commented Sep 24, 2020

Just chatted with @sroertgen who is doing very similar stuff with controlled vocabularies and JSON-LD metadata for the school sector like we are doing in OERSI/OER-metadatengruppe for higher ed. I thought about uncluding the school standards in KIM efforts and we discussed how we could create one generic, modular profile/schema that could be referenced and extended for the respective use cases.

This modular approach with a split-up schema makes a lot of sense for implementing this: Both the school and higher-ed schemas could reference/import the generic parts (like metametadata, creator etc.) and add their specific module for their uses cases (e.g. for about/subject where different SKOS vocabs are used).

@dr0i
Copy link
Member

dr0i commented Sep 29, 2020

Deployed, closed.

@stefandesu
Copy link

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.

Maybe I misunderstand it, so any input would be appreciated!

@acka47
Copy link
Member Author

acka47 commented Nov 30, 2020

Thanks for the report, @stefandesu. I think you are interpreting this right. As your case differs from the problem in this issue (where $ref with an absolute URL wouldn't work), I opened a separate issue (#63). (Feel free to open a PR if you have an idea how to handle this. ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants