ropensci / jsonld

R wrapper for jsonld.js JavaScript library
https://docs.ropensci.org/jsonld
Other
35 stars 0 forks source link

Unit test for 'Link' header #12

Open jeroen opened 6 years ago

jeroen commented 6 years ago

The jsonld spec section 6.8 Interpreting JSON as JSON-LD defines a special case where the context of a regular json file served over http can be set in the Link http response header:

Ordinary JSON documents can be interpreted as JSON-LD by referencing a JSON-LD context document in an HTTP Link Header. Doing so allows JSON to be unambiguously machine-readable without requiring developers to drastically change their documents and provides an upgrade path for existing infrastructure without breaking existing clients that rely on the application/json media type or a media type with a +json suffix as defined in [RFC6839].

The R package should support this but I would like to add a unit test to actually confirm that it works. However I can't find any example server that uses this.

@cboettig @maelle

grosscol commented 6 years ago

The jsonld-java library has tests for this behavior.

https://github.com/jsonld-java/jsonld-java/blob/47353f9e249ae9608781cd7eb8d04a13afd9be9b/core/src/test/resources/json-ld.org/remote-doc-manifest.jsonld#L93-L102

https://github.com/jsonld-java/jsonld-java/blob/master/core/src/test/resources/json-ld.org/remote-doc-0010-in.json

https://github.com/jsonld-java/jsonld-java/blob/master/core/src/test/resources/json-ld.org/remote-doc-0010-out.jsonld