w3c / wot-thing-description

Web of Things (WoT) Thing Description
http://w3c.github.io/wot-thing-description/
Other
131 stars 63 forks source link

Clarify the relationship between Form, Form::op and protocol bindings #1782

Open lu-zero opened 1 year ago

lu-zero commented 1 year ago

The protocol bindings usually extend Form in two ways:

If the default mapping is used and only op is different in Forms, they can be collapsed in a single one with an Array.

Would be good to either have an explicit verb field that is a single-entry to structurally prevent having invalid Forms with an explicit verb AND op in Array from or add a third form for op as a Map<opstring, verb>.

Originally discussed in https://github.com/w3c/wot-binding-templates/issues/194

benfrancis commented 1 year ago

Just a thought, but not all protocols use "verbs", in fact possibly only HTTP and CoAP follow that pattern (e.g. See the MQTT and Modbus binding documents).

Non-default bindings are also rarely as simple as just one vocabulary term, so you'd actually need a map of maps. At that point it may just be simpler/clearer to provide separate forms.

lu-zero commented 1 year ago

mqtt uses 3 verbs and they cannot be overridden (I already discussed about removing mqv:controlPacket for that reason with @relu91), on the other hand modbus has some variety of modbus:function that act as verbs.

I'm fine with either having the verb field, the map or even deprecating the op-Array form. Just I'd avoid having an open ambiguity if we can easily avoid it.

relu91 commented 1 year ago

Yes, I was quite surprised how the concept of verbs could be adapted to MQTT and Modbus too. Still, I'm a little bit unsure if this can be transposed to also any future protocol that we could support.

I probably need to think more about this issue, because I don't dislike even a more drastic solution of deprecating the op-Array form.