Open JKRhb opened 1 month ago
Pasting this in Playground results in JSON-LD validation error jsonld.SyntaxError: Invalid JSON-LD syntax; @context term values must be strings or objects.
. However, as you have noted, there is no assertion that says that TDs MUST be valid JSON-LDs in the first place. There are many implicit wordings but nothing very obvious.
Dealing with the @context definition once more, I noticed that our JSON Schema currently allows for @context definitions that contain objects with non-string values (e.g.,
{"foo": 42}
, see here and the example TD below). However, passing the same TD into a JSON-LD processor (see here) leads to an error since according to JSON-LD, all values have to be strings.I therefore wonder if we could on the one hand fix the JSON Schema to enforce the usage of valid JSON-LD within TDs and, on the other hand, if we should make the type definition in the TD Specification a bit stricter for TD 2.0. While there are some restrictions on the shape of the key-value pairs of the Maps within the
@context
, I think there is no MUST requirement for a map entry to have values of typestring
. So maybe this is something we can revisit for the next version.Example Thing Description
```json { "@context": [ "https://www.w3.org/2022/wot/td/v1.1", { "foo": 2 } ], "title": "Test-Thing", "securityDefinitions": { "nosec_sc": {"scheme": "nosec"} }, "security": "nosec_sc" } ```