Skip to content
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 Form's "rel" to be a string or an array #236

Closed
AndreMaz opened this issue Oct 1, 2018 · 10 comments
Closed

Allow Form's "rel" to be a string or an array #236

AndreMaz opened this issue Oct 1, 2018 · 10 comments
Assignees
Labels
Needs review Issue was fixed, but is still open for post-merge reviews

Comments

@AndreMaz
Copy link

AndreMaz commented Oct 1, 2018

Current (01 October 2018) WoT spec defines Form's "rel" as a string that can take one of possible values: "readproperty", "writeproperty" , "observeproperty", "invokeaction", "subscribeevent" or "unsubscribeevent".

TD JSON Schema also specifies "rel" as string

"rel": {
   "type": "string"
}

One the other hand, the latest (12 September 2018) Protocol Binding Templates spec defines "rel" as an array.

{
    "href": "/example/light/currentswitch",
    "rel": ["readproperty", "writeproperty", "observeproperty"],
    "mediaType": "application/json"
}

Can you please sync the docs?

Suggestion, let "rel" be both (array or string) as does the OCF in their spec

        "rel": {
          "oneOf":[
            {
              "type": "array",
              "items": {
                  "type": "string",
                  "maxLength": 64
                },
              "minItems": 1,
              "default": ["hosts"]
            },
            {
              "type": "string",
              "maxLength": 64,
              "default": "hosts"
            }
          ],
@handrews
Copy link

handrews commented Oct 1, 2018

If it helps, the next draft of JSON Hyper-Schema will also allow for either a string or array-of-strings value for rel (in the context of links rather than forms, though).

@mkovatsc
Copy link
Contributor

mkovatsc commented Oct 3, 2018

The overall TD format allows "string or array-of-strings", as it is based on the JSON-LD format. So, yes, string or array-of-strings is the intended feature, and yes, we need to fix the TD spec.

@sebastiankb
Copy link
Contributor

@AndreMaz Thanks for the hint.

@egekorkan This must also be fixed in the TD playground. Thanks

@egekorkan
Copy link
Contributor

The new validation schema and the playground now support both string and array of strings

@sebastiankb sebastiankb added the Editorial Issues with no technical impact on implementations label Oct 19, 2018
@sebastiankb
Copy link
Contributor

@vcharpenay how can this reflected in ttl?

@sebastiankb sebastiankb added Work In Progress Issue is being taken care of and removed Editorial Issues with no technical impact on implementations for next iteration labels Dec 11, 2018
sebastiankb added a commit that referenced this issue Dec 20, 2018
@sebastiankb
Copy link
Contributor

op can be also an array

@sebastiankb
Copy link
Contributor

please review

@sebastiankb sebastiankb added Needs review Issue was fixed, but is still open for post-merge reviews Work In Progress Issue is being taken care of and removed Work In Progress Issue is being taken care of Needs review Issue was fixed, but is still open for post-merge reviews labels Dec 20, 2018
@mlagally
Copy link
Contributor

In the discussion on Dec 21th we agreed that there should be a recommendation that the values of these fields "should be" consistent with the values of readonly, writeonly, ...

@vcharpenay
Copy link
Contributor

op cannot be an arbitrary array, though. It is only valid for the following combinations:

  • readproperty, writeproperty
  • readproperty, observeproperty
  • readproperty, writeproperty, observeproperty
  • subscribeevent, unsubscribeevent

What about defining one op value for each combination instead of defining it as a "string or array of string"?

@takuki
Copy link
Contributor

takuki commented Feb 28, 2019

It is implemented in td-json-schema-validation.json as one or more of values permitted depending on which interaction affordance (or a Thing) the form belongs to. For example, the form in Property interaction affordance is defined as follows.

    "oneOf": [
        {
            "type": "string",
            "enum": [
                "readproperty",
                "writeproperty",
                "observeproperty",
                "unobserveproperty"
            ]
        },
        {
            "type": "array",
            "items": {
                "type": "string",
                "enum": [
                    "readproperty",
                    "writeproperty",
                    "observeproperty",
                    "unobserveproperty"
                ]
            }
        }
    ]

takuki added a commit that referenced this issue Feb 28, 2019
op member in form has context-dependent enumerated values (issue #236)
@takuki takuki added Needs review Issue was fixed, but is still open for post-merge reviews and removed Work In Progress Issue is being taken care of labels Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs review Issue was fixed, but is still open for post-merge reviews
Projects
None yet
Development

No branches or pull requests

8 participants