digitalbazaar / pyld

JSON-LD processor written in Python
https://json-ld.org/
Other
602 stars 129 forks source link

[BUG] Framing a document with the traceability context raises an error #188

Closed PatStLouis closed 7 months ago

PatStLouis commented 9 months ago

I'm having issues leveraging pyld for a traceability implementation I'm working on. Could someone provide insight to the following errors:

pyld.jsonld.JsonLdError: ('Could not expand input before framing.',)
Type: jsonld.FrameError
Cause: ('Tried to nullify a context with protected terms outside of a term definition.',)
Type: jsonld.SyntaxError
Code: invalid context nullification

Here is a simple snippet of code to reproduce it. Commenting out the traceability url from the context resolves the issue however it should be present:

from pyld import jsonld
document = {
    "@context": [
        "https://www.w3.org/ns/did/v1",
        "https://w3id.org/traceability/v1"
    ],
    "service": [
        {
            "id": "did:web:example.com#traceability-api",
            "type": "TraceabilityAPI",
            "serviceEndpoint": "https://example.com"
          }
    ]
}
frame = {}
framed = jsonld.frame(document, frame)

@dlongley 👀

Any help appreciated!

davidlehn commented 7 months ago

2.0.4 should fix this.