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

No mechanism to indicate the "desired" form entry #877

Closed
danielpeintner opened this issue Feb 3, 2020 · 6 comments
Closed

No mechanism to indicate the "desired" form entry #877

danielpeintner opened this issue Feb 3, 2020 · 6 comments
Assignees

Comments

@danielpeintner
Copy link
Contributor

We got the request in the Scripting API task force that scripts might want to choose which form is used. In the sample TD below a script would like to decide which form entry is used for a given interaction (e.g., form[0] for the interaction toggle because it uses HTTP).

{
	"@context": "https://www.w3.org/2019/wot/td/v1",
	"title": "MyLampThing",
	"securityDefinitions": {
		"basic_sc": {
			"scheme": "basic"
		}
	},
	"security": ["basic_sc"],
	"actions": {
		"toggle": {
			"forms": [{
					"href": "https://mylamp.example.com/toggle"
				},
				{
					"coap": "https://mylamp.example.com/toggle"
				}
			]
		}
	}
}

Besides the desired intent of a script e.g., preferring HTTP (which is not supported in scripting yet) there is also no way to indicate in a TD what form entry is preferred. WoT runtimes are free to pick any form while it seems that there is an unwritten assumption that the order in the array might be an indicator.

Does it make sense to have a more explicit mechanism in a TD that indicates the preferred form entry or to make the unwritten assumption more evident in the specification?

@mmccool
Copy link
Contributor

mmccool commented Feb 10, 2020

Previously we have discussed using the order of multiple forms to assign priority. However, the consensus of that discussion was that some consumers might do this, but we decided not to have a "MUST" assertion saying they do. If some consumers assigned a meaning to the other, then even if no meaning is assigned to the order by the specification, I think we should have an assertion that processors should not reorder forms arbitrarily, to avoid breaking such consumers (and maybe future-proofing against using order to assign priority later).

@zolkis
Copy link

zolkis commented Feb 10, 2020

processors should not reorder forms arbitrarily

I think that is the right formulation (SHOULD NOT) since clients MAY still choose whichever Form found in the TD.

However, as discussed in the Scripting call, it makes sense to be able to select the Form from an application, so the Scripting API will add that option to the interactions exposed by ConsumedThing.

Also, when specifying an ExposedThing with Forms, Scripting API implementations SHOULD NOT change the order clients specified for Forms. This is independent of the decision the TD TF has made and ensures compatibility with eventual later policies.

@takuki
Copy link
Contributor

takuki commented Feb 14, 2020

In TD call on 2/14, we discussed and suggest to say something like "Clients may choose the first form entry that works for them." in TD specification. This does not introduce any new constraint.

@sebastiankb sebastiankb added the Defer to next TD spec version This topic is not covered in this charter, maybe included for the next TD version. label Feb 19, 2020
@sebastiankb
Copy link
Contributor

@takuki can you provide a PR for this statement?

@sebastiankb sebastiankb added PR needed and removed Defer to next TD spec version This topic is not covered in this charter, maybe included for the next TD version. labels Dec 18, 2020
sebastiankb added a commit that referenced this issue Apr 23, 2021
@sebastiankb
Copy link
Contributor

please checkout PR #1108 if it is working for you

@sebastiankb
Copy link
Contributor

PR merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants