json-ld / json-ld.org

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

Playground is choking on `http://schema.org` (no trailing slash) #798

Closed BigBlueHat closed 11 months ago

BigBlueHat commented 1 year ago

Throws this error:

jsonld.InvalidUrl: Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.

Looks like maybe it's just not following the 301 response's Location header to https://schema.org/.

gkellogg commented 1 year ago

This would be something for @davidlehn to look at, I think. But, that said, our advice is that contexts be cached, and given how slowly schema.org actually changes, we should have a built-in version of that context so we're not irking DanBri more than necessary.

davidlehn commented 1 year ago

I can look later, but maybe a quick fix for the common schema.org case is to just add a no trailing slash check here: https://github.com/json-ld/json-ld.org/blob/main/playground/playground.js#L1599-L1601

Maybe the real reason is the proxy hack needs work to handle redirects, but I'd rather just see this entirely go away: https://github.com/json-ld/json-ld.org/blob/main/playground/proxy.php

rlzijdeman commented 1 year ago

Hi, could I please nudge this issue? https://dataverse.org provides "http://schema.org" in their Linked Data representation (e.g. see the header in the source code of: https://datasets.iisg.amsterdam/dataset.xhtml?persistentId=hdl:10622/XZAHCX ).

However, since the playground doesn't accept the json-ld as valid, our national heritage network argues that the Linked Data doesn't comply with json-ld standards.

davidlehn commented 11 months ago

I covered up the problem by also rewriting schema.org URL without the trailing slash. A proper fix is a bit more involved: https://github.com/json-ld/json-ld.org/issues/813.