-
Notifications
You must be signed in to change notification settings - Fork 80
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
Design questions around the exploreDirectory
method
#1221
Comments
@relu91 would you be opposed to such a change in the spec?
I would try to avoid doing that. |
Yes as I mentioned the value function is behaving correctly. However, as I said in #1217 supporting TDD without schema is a TODO, it is just a matter of aligning the implementation with Example 3. I can provide a PR for this. I would say that updating the official TDD schema for
I hope so, when the times comes we have to remember to take this use-case into account. |
Oh, sorry, you are right, I somehow did not take into account that you have already mentioned that 🙈 However, I am wondering whether requiring the {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
}
]
} could also not be supported at the moment. Do we really want users to implement their own parsing logic for cases like this one? A potential alternative could also be to add support for "subschemas" such as this one to the Scripting API if we want to keep certain restrictions in place.
Maybe a workaround for the time being could be adding an (internal) field like Edit: Thank you for opening w3c/wot-discovery#538, @relu91! |
For example, a
Why this is not supported? 🤔 |
If the node-wot/packages/core/src/interaction-output.ts Lines 94 to 96 in cee07c2
|
Ah gotcha, I see the loophole, but this is just to the fact the we failed to express that the only requirement is that the DataSchema exists and is valid. This is something we have to fix in the ScriptingAPI doc. |
Recently, I've been dealing a lot with the
exploreDirectory
method from the Scripting API and its potential implementation. Although we've made some progress both in node-wot and dart_wot regarding the support of the method, I've been noticing at least two challenges for our current architecture that we need to deal with to have proper support in place.Problem 1: No
type
in TDDthings
propertyThe first problem relates to our current approach of first consuming the Directory TD and then using the
readProperty
method to access thethings
property defined in the standardized API. While this has been working so far, the fix for thevalue()
method in #1217 broke the implementation since calling thevalue()
method with a data schema that has an undefinedtype
field is supposed to throw and thethings
property does not have atype
defined. While this is probably also an oversight in the Discovery specification, this does raise the question of whether we should loosen the requirements a bit, both in node-wot and the Scripting API (as also mentioned by @danielpeintner in #1216).Problem 2: Passing of information from HTTP headers upstream
Another problem that has several implications relates to the fact that pagination information from TDDs is supposed to be transmitted via HTTP headers by default, namely the indication of the
offset
andlimit
that should be used for retrieving the next page of TDs. By default (i.e., when using thearray
format), the directory includes this information in aLink
header with a URL that allows accessing the next page (an example would be/things?offset=10&limit=10
).Currently, we would need to control this behavior at the (HTTP) binding level, as there is no standardized way of mapping this header information to a
DataSchema
at the moment. I think this is a good example of one of the shortcomings mentioned in w3c/wot#1165. A potential alternative could be using thecollection
format by the way, where the information in question is moved from the HTTP headers to the response body. However, it seems to me as if a directory does not have to implement this format (if I am not mistaken), therefore we don't have the guarantee that this variant will work with every TDD.The problem with passing the information upstream made me wonder whether we should create a dedicated method in the
ProtocolClient
interface to handle theexploreDirectory
method. However, this would probably lead to a lot of binding implementations only having a method stub that just throws a "Not implemented" error :/These are just a couple of observations I've made so far which can probably be the basis for further discussions, both on an implementation and use-case/specification level.
The text was updated successfully, but these errors were encountered: