Closed GerwinBosch closed 2 weeks ago
You should be able to pass the safe: true
option to cause an error to be thrown with some details on what went wrong, see: https://github.com/digitalbazaar/jsonld.js?tab=readme-ov-file#safe-mode
The JSON-LD playground has an Options
tab next to the JSON-LD Input
tab that lets you set safe mode to true
as well. It will default to true
for canonicalized N-Quads, but defaults to false
for other APIs for backwards compatibility.
Ah, thanks for the quick reply!
I did see the safe
option for the expand
function in the documentation. However, the TS types didn't show it in the typescript definitions for toRDF
so I assumed it wasn't available. It works as expected now.
Hey,
When using the
toRDF
to parse lists with invalid IRIs (in our case, containing a space), the function doesn't throw an error. But instead returns a quad withnull
as the subject for therdf:first
relation. This causes issues when further processing the document. We can detect it by checking fornull
in the object position for now, However, the quad on its own is not that informative. In the end, I'd prefer an error to be thrown (as during parsing there should be more contextual information available)The issue can be reproduced with the following snippet