digitalbazaar / pyld

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

@requireAll does not work with @type #165

Open ioggstream opened 2 years ago

ioggstream commented 2 years ago

Question

How can I require multiple types?

I expect

frame = {
"@type": {
  @requireAll: true,
  @value: [ skos:Concept, dct:Location ]
}
}

Instead

E Cause: ('Invalid JSON-LD syntax; "@type" value must be a string, an array of strings, or an empty object.',)

Trace

E           pyld.jsonld.JsonLdError: ('Could not expand frame before framing.',)
E           Type: jsonld.FrameError
E           Cause: ('Invalid JSON-LD syntax; "@type" value must be a string, an array of strings, or an empty object.',)
E           Type: jsonld.SyntaxError
E           Code: invalid type value
E           Details: {'value': {'@value': ['http://www.w3.org/2004/02/skos/core#Concept', 'http://publications.europa.eu/ontology/authority/Country', 'http://purl.org/dc/terms/Location']}}  File "~/.local/lib/python3.9/site-packages/pyld/jsonld.py", line 1043, in frame
E               expanded_frame = self.expand(frame, opts)
E             File "~/.local/lib/python3.9/site-packages/pyld/jsonld.py", line 870, in expand
E               expanded = self._expand(active_ctx, None, document, options,
E             File "~/.local/lib/python3.9/site-packages/pyld/jsonld.py", line 2336, in _expand
E               self._expand_object(
E             File "~/.local/lib/python3.9/site-packages/pyld/jsonld.py", line 2542, in _expand_object
E               _validate_type_value(value, options.get('isFrame'))
E             File ~/.local/lib/python3.9/site-packages/pyld/jsonld.py", line 6361, in _validate_type_value