-
Notifications
You must be signed in to change notification settings - Fork 63
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
Allow for more TM fields to be optional #2042
Comments
tm:optional
support more fields
As a simpler alternative to the proposals made above, you could probably also just use the keys of the object that contains the {
"@context": [
"https://www.w3.org/2022/wot/td/v1.1",
{
"cov": "http://www.example.org/coap-binding#"
}
],
"title": "ExampleThing",
"securityDefinitions": {
"nosec_sc": {"scheme": "nosec"}
},
"security": "nosec_sc",
"properties": {
"example": {
"forms": [
{
"href": "coap://example.com/example",
"cov:usesEcho": true, // Note: Only a placeholder
"tm:optional": [
"cov:usesEcho"
]
}
]
}
}
} Edit: Another alternative would be putting everything into the top-level {
"@context": [
"https://www.w3.org/2022/wot/td/v1.1",
{
"cov": "http://www.example.org/coap-binding#"
}
],
"title": "ExampleThing",
"securityDefinitions": {
"nosec_sc": {"scheme": "nosec"}
},
"security": "nosec_sc",
"properties": {
"example": {
"forms": [
{
"href": "coap://example.com/example",
"cov:usesEcho": true, // Note: Only a placeholder
}
]
}
},
"tm:optional": [
"/properties/status/forms/0/cov:usesEcho"
]
} |
This is definitely something that needs a use case, at least in my opinion. I do not use many TM-based workflows but I would like to get feedback from those who use In this case, I feel that this is another use case. You are trying to provide implementation guidance. Shouldn't it be even a |
I'm not 100% sure that I have understood the use case, especially the usesEcho example. So far, the I would be ok to have |
Thank you, @egekorkan and @sebastiankb, for your feedback on this :) I think you are right, @egekorkan, that this is actually a different use case than the one covered by A better one could be something like
That also sounds good to me :) I guess the alternative could be creating separate Thing Models from a common parent here where only one is adding a certain field which can then be considered optional as well. But I think there might also be cases where you might want to optionally take over some information that is originally only intended for the TM and not important for the TD, like the |
Actually, Ditto also uses Another thing Ditto "uses" a referenced TM for is to create a Thing-JSON-Skeleton when creating a new "Thing" instance. {
"definition": "https://some.model.host/some-thing-model.tm.jsonld"
} , Ditto will generate a JSON skeleton (maybe even hundreds of lines) with "default" values for the thing properties (either by defined In that case, Ditto will treat I am aware that this is not really intended, but it fits our use-case quite well without the need for another context extension. |
In the context of w3c/wot-binding-templates#258, one result of the discussion was that there might be cases where information within a Thing Model is primarily aimed at implementors of Things, indicating that they should support certain features or extensions of a protocol, like CoAP's Echo option. In this particular case, a consumer does not benefit that much from receiving this information in a TD, while implementors could use this information as a set of constraints for the Thing's behavior. However, at the moment it is required to take over all definitions (expect affordances labelled optional via
tm:optional
) into the resulting TD, which is why having vocabulary that is only used by Thing implementors is not really possible at the moment.I was therefore wondering if we could either expand the scope of
tm:optional
to other levels of a TM or whether it could be possible to label vocabulary terms as optional during instantiation in general (e.g., in a Binding Template document where a vocabulary term is introduced). I guess the former approach would be a bit more flexible and would also cause less burden for specification authors, although it could make TMs a bit more verbose in certain scenarios.When it comes to the example use case mentioned above, this could lead to the definition of a form like the following, where we use a JSON pointer to indicate that the
cov:usesEcho
member is optional via atm:optional
at the form level:Alternatively, we could also consider supporting JSON Path expressions, using the respective JSON object of the form as the root node.
This would make the
tm:optional
array entry a bit more concise:Looking forward to your feedback on this – if this would make sense as a potential addition to the specification, then I would transform the content of this issue into a use case submission via the new template :)
The text was updated successfully, but these errors were encountered: