Skip to content

Adding array for common definitions referencing #2159

@egekorkan

Description

@egekorkan

As a result of the discussion at #2154 , we have decided that the new keywords like connection, form, etc. cannot be a string type anymore. The TDs will have either an object for an in-place definition of the definition or will have an array which lists all the possible definitions that are applied. Thus we can have examples like the following:

  {
    "@context": "https://www.w3.org/ns/wot-next/td",
    "connectionDefinitions": {
      "ipv4": {
        "base": "https://192.168.1.10:8080"
      },
      "ipv6": {
        "base": "https://[2001:db8:85a3::8a2e:370:7334]:8080"
      }
    },
    "connection": ["ipv4", "ipv6"],
    "form": {
      "contentType": "application/json"
    },
    "security": {
      "scheme": "nosec"
    },
    "properties": {
      "prop1": {
        "type": "string",
        "forms": [
          {
            "href": "/props/prop1"
          }
        ]
      },
      "prop2": {
        "type": "string",
        "forms": [
          {
            "href": "/props/prop2"
          }
        ]
      }
    }
  }

Internally, that prop1 would expand to something like the following:

      "prop1": {
        "type": "string",
        "forms": [
          {
            "href": "https://192.168.1.10:8080/props/prop1",
            "security": {
              "scheme": "nosec"
            },
            "contentType": "application/json"
          },
          {
            "href": "https://[2001:db8:85a3::8a2e:370:7334]:8080/props/prop1",
            "security": {
              "scheme": "nosec"
            },
            "contentType": "application/json"
          }
        ]
      }

As a result, the proposal and the examples in there should be updated in a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR neededcommon 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