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

Preloaded contexts not used by json-ld gem in develop branch #4

Closed
Gargron opened this issue Oct 10, 2019 · 5 comments
Closed

Preloaded contexts not used by json-ld gem in develop branch #4

Gargron opened this issue Oct 10, 2019 · 5 comments

Comments

@Gargron
Copy link

Gargron commented Oct 10, 2019

I have tried to investigate which change could have led to this, but nothing obvious stands out to me. I can confirm that json-ld 3.0.2 and json-ld-preloaded 3.0.2 were using preloaded contexts, not executing any HTTP requests for them (specifically: https://w3id.org/identity/v1).

However, commit e742697a0906e74e8bb777ef98137bc3955d981d of json-ld and json-ld-preloaded 3.0.4 are executing a HTTP request for the very same context URL. I have manually checked and JSON::LD::Context::PRELOADED contains https://w3id.org/identity/v1 in both cases.

@Gargron
Copy link
Author

Gargron commented Oct 10, 2019

Update: It seems like this affects only https://w3id.org/identity/v1... Trying https://www.w3.org/ns/activitystreams does not execute HTTP requests...

@gkellogg
Copy link
Member

The point of json-ld-preloaded is to avoid http requests to common contexts by preloading them. Periodically, contexts are changed, and these need to be rebuilt.

To be used, you specifically need to add the gem to either your Gemfile, or dependencies in your gemspec. The JSON-LD gem tries to load it, and it will insert the cache if it’s there, otherwise, it will go on and do loads.

@Gargron
Copy link
Author

Gargron commented Oct 10, 2019

I’m sorry but I don’t think you understood the problem description. I know how to use the gem and it works for all common contexts except the identity one.

What i have found is that the json-ld gem canonicalizes context URIs before checking the ‘PRELOADED’ constant, which means it checks if the http version is defined (not https). However this gem defines the https version for specifically the identity context (all other contexts are defined against http and creating a preload alias for https), which means it can never be found. I submitted a fix.

@gkellogg
Copy link
Member

Okay, sorry. I left a comment in the PR. The change goes in Rakefile, and re-run the gen_contexts task.

gkellogg added a commit that referenced this issue Oct 10, 2019
…ith canonicalization in JSON-LD.

Fixes #4. Fixes #5.
@gkellogg
Copy link
Member

Fixed in 2adb1df.

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

Successfully merging a pull request may close this issue.

2 participants