Skip to content

Restricting Matrix Multiplication #2180

@egekorkan

Description

@egekorkan

In the current common definitions proposal, it is possible to have a TD like this:

    {
      "@context": "https://www.w3.org/ns/wot-next/td",
      "title": "valid-test-multi-protocol",
      "formDefinitions": {
        "http": {
          "base": "https://192.168.1.10:8080",
          "contentType": "application/json",
          "security": {
            "scheme": "nosec"
          }
        },
        "coap": {
          "base": "coap://[2001:DB8::1]/mything",
          "contentType": "application/cbor",
          "security": {
            "scheme": "nosec"
          }
        }
      },
      "formDefaults": ["http", "coap"],
      "properties": {
        "prop1": {
          "type": "string",
          "forms": [
            {
              "href": "props/prop1"
            },
            {
              "href": "properties/prop1"
            }
          ]
        }
  }
}

There would be 4 forms in total when expanded, where two single dimensional arrays get multiplied like in matrix multiplication:

          "forms": [
            {
              "href": "https://192.168.1.10:8080/props/prop1",
              "contentType": "application/json",
              "security": {
                "scheme": "nosec"
              },
              "op": ["readproperty", "writeproperty"]
            },
            {
              "href": "coap://[2001:DB8::1]/mything/props/prop1",
              "contentType": "application/cbor",
              "security": {
                "scheme": "nosec"
              },
              "op": ["readproperty", "writeproperty"]
            },
            {
              "href": "https://192.168.1.10:8080/properties/prop1",
              "contentType": "application/json",
              "security": {
                "scheme": "nosec"
              },
              "op": ["readproperty", "writeproperty"]
            },
            {
              "href": "coap://[2001:DB8::1]/mything/properties/prop1",
              "contentType": "application/cbor",
              "security": {
                "scheme": "nosec"
              },
              "op": ["readproperty", "writeproperty"]
            }
          ]

We can make a choice to restrict this, i.e. if formDefaults is present (and is an array), the forms in affordances MUST be a single item array. @benfrancis this should be also in the "surprising" category of behavior to you?

Metadata

Metadata

Assignees

Labels

common definitionsdiscussions on the mechanisms to group more definitions and their defaults

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions