jsonld.js
jsonld.js copied to clipboard
Add feature to throw error when unmapped elements are dropped during processing
When certain elements in a document cannot be mapped to absolute URLs (via @context or a base URL), then are silently dropped during expansion per the spec. There should be a feature in this processor that, instead, causes an error to be raised. This is particularly important when this library is used in conjunction with digital signing libraries.
Related to #178.
Partially supported with expansionMap and compactionMap here: bcae96153a1e7da6669eeaf25f856ab93d833cd8
Still need something for toRDF.
Specifically, when converting to RDF, relative URIs are dropped and this should be handled by another map or similar mechanism.
@dlongley I want to make this explode, whats the easiest way to do that?
I have this PR with a failing test: https://github.com/transmute-industries/vc.js/pull/26
@OR13,
I want to make this explode, whats the easiest way to do that?
Sorry, just seeing this now, a month later. Using an undefined type with no base set or -- as it says in the issue I just linked to -- a non-URI for an id will cause silent droppage. Not sure if that's "exploding" though. :)
explode means that when someone hands json that has been mutated after being signed, a verifier will throw an error on it, not return "verified".