[heycam/webidl] Describe JSON-LD with WebIDL - How to handle @ tags (#541)

Hi WebIDL community,

we in the [WoT working group](https://www.w3.org/WoT/WG/)  and specifically the task force around scripting are working on a document ([current version](https://www.w3.org/TR/wot-scripting-api/)) that tries to describe the functionality of a WoT thing description ([TD](https://www.w3.org/TR/wot-thing-description/)) that is based on JSON-LD. Moreover, based on this TD JSON-LD document scripting acts as a wrapper and adds further functionality to manipulate the content.

JSON-LD documents tend to have lots of `@` tagnames. For example a TD snippet:

```
{
  "@context": ["https://w3c.github.io/wot/w3c-wot-td-context.jsonld"],
  "@type": ["Thing"],
  "name": "MyLampThing"
  ...
}
```

These `@` tags cause issues in WebIDL (as in any programming language) given that those names are not valid identifiers.

```
interface WoTTD {
 readonly attribute DOMString @type;
 ...
}
```

Moreover, a naive solutions to this issue like removing/replacing the `@` prefix all together is also not very usable/practical given that
* besides `@type` there might be also `type` fields
* serializing the _wrapped_ JSON-LD content again requires additional processing
* no _"correct"_ representation/match between TD and scripting  

Hence, I was wondering whether you, as the WebIDL experts, have additional proposals or another way of tackle this issue. Have you (or others?) run into the same issue with JSON-LD and WebIDL?
How could we describe the content of a JSON-LD document with WebIDL?

Thanks a lot for any insight or tip!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/541

Received on Friday, 6 April 2018 09:38:47 UTC