jsonld.js icon indicating copy to clipboard operation
jsonld.js copied to clipboard

Add feature to throw error when unmapped elements are dropped during processing

Open dlongley opened this issue 8 years ago • 5 comments

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.

dlongley avatar Sep 12 '17 19:09 dlongley

Partially supported with expansionMap and compactionMap here: bcae96153a1e7da6669eeaf25f856ab93d833cd8

Still need something for toRDF.

dlongley avatar Sep 22 '17 21:09 dlongley

Specifically, when converting to RDF, relative URIs are dropped and this should be handled by another map or similar mechanism.

dlongley avatar Oct 27 '17 15:10 dlongley

@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 avatar Nov 09 '20 15:11 OR13

@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. :)

dlongley avatar Dec 09 '20 16:12 dlongley

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".

OR13 avatar Dec 11 '20 14:12 OR13