json-ld / json-ld.org

JSON for Linked Data's documentation and playground site
https://json-ld.org/
Other
859 stars 152 forks source link

Remote Context Tests #658

Closed jcdickinson closed 6 years ago

jcdickinson commented 6 years ago

I ran into an issue with my JSON-LD implementation whereby remote contexts were discarding all previous contexts. Remote contexts have no tests in the conformance suite.

Details

The context.jsonld now contains a remoteContexts parameter for test cases. This is a list of the remote contexts that should be expected to be seen, e.g.

"remoteContexts": [ "expand-ctx001-context1.jsonld", "expand-ctx001-context2.jsonld" ]

The test execution harness can either hit the website (https://json-ld.org/test-suite/tests/) directly, or provide a loadDocument callback that grabs the files locally (which is what I did for my fixes in my implementation).

I did my best to hit all impacted areas in the repository, but I'm not sure what the change to context.jsonld will do the generation of test_suite/index.html (nor do I know ruby well enough to fix any problems that might arise).

Changes

Have a great Wednesday!

BigBlueHat commented 6 years ago

Thanks for adding this @jcdickinson! The JSON-LD WG hasn't yet dug into ongoing testing, but I know @gkellogg is keeping a close eye on changes we're making.

I've requested reviews from the other WG team members to hopefully get this discussed.

Thanks again for the contribution!

gkellogg commented 6 years ago

The Remote document tests specifically require that documents be accessed remotely. It seems to me that we should be able to determine that each referenced context is properly loaded by looking at the resulted expanded document, so I'm not sure why a remoteContexts field would be necessary. Is there something in this PR that tests behavior not currently tested by https://json-ld.org/test-suite/tests/remote-doc-manifest.jsonld?

Also, we're transitioning the test suite to https://github.com/w3c/json-ld-api for the work in the Working Group.

jcdickinson commented 6 years ago

Thanks for the feedback @gkellogg. I'll close the PR and have a second look at my tests and how to get them to more properly emulate remote contexts.