Wot-thing-description: how to find the Form pair for an operation, e.g. the unsubscribe Form for a given subscribe Form

Created on 21 Sep 2020  路  5Comments  路  Source: w3c/wot-thing-description

Coming from https://github.com/w3c/wot-thing-description/issues/957 and the need for an algorithm in Scripting PR 264, please identify the mechanism to obtain the Form pair for a given operation.

Most helpful comment

I have a _feeling_ that if we want to really solve this properly, we need to explicitly tell the form associated with a form's operation. Something like:

{
//...
"forms": [{
    "op": "subscribeevent",
    "href" : "http://mytemp.example.com:5683/temp",
    "contentType": "application/json",
    "htv:methodName": "POST",
    "unsubscribeevent":{ //this should be probably something else
        "op": "unsubscribeevent", //somewhat duplicate
        "href" : "http://mytemp.example.com:5683/temp",
        "contentType": "application/json",
        "htv:methodName": "DELETE",
}]
//...
}

All 5 comments

To make it even clearer. How do you know:

  • which unsubscribe matches a given subscribe form
  • is there even an unsubscribe?
  • is it possible to use unsubscribe on a different protocol (unlikely but e.g., subscribe on HTTP, unsubscribe on CoAP)
  • ...

I have a _feeling_ that if we want to really solve this properly, we need to explicitly tell the form associated with a form's operation. Something like:

{
//...
"forms": [{
    "op": "subscribeevent",
    "href" : "http://mytemp.example.com:5683/temp",
    "contentType": "application/json",
    "htv:methodName": "POST",
    "unsubscribeevent":{ //this should be probably something else
        "op": "unsubscribeevent", //somewhat duplicate
        "href" : "http://mytemp.example.com:5683/temp",
        "contentType": "application/json",
        "htv:methodName": "DELETE",
}]
//...
}

I have a feeling that if we want to really solve this properly, we need to explicitly tell the form associated with a form's operation.

I said the same in the Scripting call, i.e. either link/reference/index the unsubscribe Form, or specify them as a tuple.
The former would be an extension of the current model, the second would be a breaking change.

I like @egekorkan proposal. Maybe this can be also a direction that can be used for the topic with hypermedia #899

Perhaps instead of unsubscribeevent field in the parent Form we could use a generic cancel field for operations, which in this case would be a Form with op: unsubscribeevent.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

takuki picture takuki  路  5Comments

JKRhb picture JKRhb  路  5Comments

msporny picture msporny  路  8Comments

mkovatsc picture mkovatsc  路  9Comments

mlagally picture mlagally  路  5Comments