WebThingsIO / gateway-addon-ipc-schema

JSON-Schema for add-on IPC messages
Mozilla Public License 2.0
5 stars 8 forks source link

Changes to device schema needed for W3C compliance #20

Open benfrancis opened 2 years ago

benfrancis commented 2 years ago

For better or worse the schemas defined in definitions.json are currently used by the WebThings Gateway application to validate parts of Thing Descriptions and to generate TypeScript types used to represent them.

There are certain changes needed to these schemas in order to validate W3C compliant Thing Descriptions. Notably:

  1. Add data wrapper for event data schema https://github.com/WebThingsIO/gateway/issues/2810
  2. Change mediaType to type for links in API https://github.com/WebThingsIO/gateway/issues/2808
  3. Change @context of Thing Descriptions to an array https://github.com/WebThingsIO/gateway/issues/2809

Ideally we would also remove or vendor-prefix non-standard members of the Thing Description

  1. Remove name member of property affordances in Thing Descriptions https://github.com/WebThingsIO/gateway/issues/2855
  2. Remove value member of property affordances in Thing Descriptions https://github.com/WebThingsIO/gateway/issues/2854
  3. Add prefix to proprietary members of Thing Descriptions https://github.com/WebThingsIO/gateway/issues/2832

Before releasing these changes we'll need to evaluate the impact on any existing add-ons which may use these terms directly.

benfrancis commented 2 years ago

Draft PR #21 implements the first three by allowing the old and new formats.

Similarly, I suggest adding back in support for links as a deprecated alternative to forms.

benfrancis commented 2 years ago

@tim-hellhake What do you think about also marking the following members as deprecated?

We should also consider vendor-prefixing the following members on some way:

e.g. using a new JSON-LD context

{
  "schema": [{"wtg": "https://webthings.io/schemas/webthings-gateway" }],
  "wtg:pin": {},
  "wtg:credentialsRequired": {}
}