eclipse-thingweb / eclipse-thingweb/node-wot
Actions with `const` inputs
- Dominant language
- TypeScript
- Stars
- 192
- Forks
- 100
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 6
Description
I recently tried to model the possible actions of a legacy device that use the same `href` but differ in their payload which indicates the intended action. I tried to use a `const` value for this like so:
```json
"actions": {
"toggle": {
"input": {
"const": "toggle"
},
"forms": {
"href": "tigger/actions"
}
},
"blink": {
"input": {
"const": "blink"
},
"forms": {
"href": "tigger/actions"
}
}
}
```
Consuming these actions as part of a TD with `node-wot`, however, does not have an effect on the behavior of the `ConsumedThing`, i. e. the `const` value is neither assumed as the (unchangeable) default nor used for an assertion of the actual input.
Do you think one of these two options should be added to `ConsumedThing`? Or should the user be free to use any input they like while the assertion is only performed by the actual thing?
Contributor guide
Assessment
This issue has not been assessed yet.