node-wot icon indicating copy to clipboard operation
node-wot copied to clipboard

action and event affordance do not raise error when data schema does not match

Open VigneshVSV opened this issue 9 months ago • 3 comments

I have an action with the following schema:

"sample_get_method": {
      "title": "sample_get_method",
      "forms": [
        {
          "href": "https://LAPTOP-F60CU35D:8083/spectrometer/ocean-optics/USB2000-plus/get-example",
          "op": "invokeaction",
          "htv:methodName": "GET",
          "contentType": "application/json"
        }
      ],
      "safe": true,
      "idempotent": true,
      "synchronous": true
    },

When i invoke this action in node-wot


console.log("action with return value", await spectrometer.invokeAction("sample_get_method"));
console.log("action with return value awaited", await (await await spectrometer.invokeAction("sample_get_method").value())

here the spectrometer object refers to the node-wot client which I create after consuming the TD.

I get the output

action with value InteractionOutput {form: {…}, schema: undefined, dataUsed: false}
action with value undefined

I was told it would be better if it throws an error similar to how readProperties work - to complain that the schema didnt match.

the td-playground validator does not also complain the absence of input/output schema i.e. td is accepted, but action (also event) reply dont produce error because schema is not matching due to its absence?

VigneshVSV avatar May 02 '24 17:05 VigneshVSV