-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove object wrappers from API payloads #2807
Comments
Some thoughts on the open questions... I've submitted a proposal to the W3C for how to standardise this using forms w3c/wot-thing-description#892 (comment) but it's not pretty. If we don't think this is going to get into WoT Thing Description 1.1 we have a couple of options for WebThings Gateway:
(We would probably also have to remove event log features from all 16 web thing libraries in the WebThings Framework since there would be no W3C compliant way to implement it.)
This has been discussed in the W3C Working Group in w3c/wot-thing-description#302 and w3c/wot-thing-description#899. I have made a proposal (just slightly tweaked @egekorkan's proposal) in w3c/wot-thing-description#302 (comment) If we don't think this is going to get into WoT Thing Description 1.1 then we may have to remove the concept of action queues from WebThings (until someone comes up with a solution which fits into the W3C forms model at some point into the future) and only support invoking actions. For the gateway this isn't the end of the world because the built-in web interface doesn't currently provide a cancel action feature anyway, but I don't know whether third party consumers of the gateway's API or the users of the WebThings Framework rely on this feature.
Let's worry about this if the action queue issue above gets resolved. If there's no way to represent these in a W3C Thing Description then we may have to remove this feature too and re-write the gateway front end to use individual action endpoints rather than the top level actions endpoint when invoking actions. |
I've tried to figure out a way to model these resources as interaction affordances in a W3C Thing Description and discussed potential new The hardest part is how to model the payloads of these resources, which not only include the raw event data, but also metadata like timestamps. In trying to write text for the specification which explains how to describe these resources in a Thing Description I think I've come to the conclusion that we actually shouldn't try. What makes these resources unusual is that they describe historical stored data, rather than live data being read from or emitted directly from a device. Requiring that devices be able to provide a historical log of events assume they have the storage needed to so, which may not always be the case. In our implementation it's actually the gateway that logs this data and not the devices themselves, so you could argue that the event logs are actually a feature of the gateway rather than an affordance of the device itself. I'd therefore like to propose that we take a different approach: API
UI
The quickest way to unblock this issue might be to initially remove the links/forms from the event affordances altogether and modify the event log UI to only show live events using the existing WebSocket endpoint. But ideally we would replace the existing event endpoints with new ones using Server Sent Events. @relu91 What do you think? |
I have to admit this feature felt a little bit weird from the beginning. Even if I reconsigned its utility, I have never seen IoT devices that kept track of the fired events. Even in our research experiments, we decided that the As for the proposed approach, it's a similar architecture that we employed in our WoT based monitoring projects so I am aligned with the API design. We have still tried to expose the
I would do it in a single dev sprint since Afforndaces could not have empty forms, so we are forced to fill those with the new Server-Sent Events links. Other than that it a good plan 👍🏻 |
Blocks: #2802
Currently for a property definition in a Thing Description exposed by the gateway as below:
a response to a GET request on the Property resource looks something like:
where the payload is a JSON object with a map representation of the property's name and value. The payloads of PUT requests and responses also follow the same format.
To be compliant with the W3C Thing Description specification, let's change payloads to match the data schema in the Thing Description, e.g. for the above example this would simply be:
21
See WebThingsIO/api#143 for some background on this topic.
This includes:
The excludes:
readallproperties
andwriteallproperties
ops with values keyed by property names, but I can't find it in the current draft, can anyone confirm this?)Open questions:
The text was updated successfully, but these errors were encountered: