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

InteractionOutput.value() throws an error for Actions with no output DataSchema #1228

Closed
FadySalama opened this issue Feb 8, 2024 · 5 comments · Fixed by #1230
Closed

InteractionOutput.value() throws an error for Actions with no output DataSchema #1228

FadySalama opened this issue Feb 8, 2024 · 5 comments · Fixed by #1230

Comments

@FadySalama
Copy link
Contributor

I encountered this problem while interacting with the TestThing. When invoking the "void-void" action, the action results in an 505: Internal Server Error with the message No schema defined. This is thrown inside value() as seen below:

checkActionInvocation("void-void", "undefined", typeof (await parameters.value()));

As no data schema is needed for an action with no output, calling value() on the interaction output throws an error. However, this behavior seems a little counterintuitive. I would think, intuitively, that an action without an output DataSchema would either provide no InteractionOutput at all or would provide and InteractionOutput with a value() method that resolves with undefined and an arrayBuffer() method that resolves with an empty array (maybe also undefined but it makes more sense you would actually get an array, but it's empty because there is no output).

@danielpeintner
Copy link
Member

We could look whether a schema is available at all

if (this.schema == null || this.schema.type == null) {

Hence, we should not do anything if this.schema == null and return undefined in such a case?

@relu91 @JKRhb any opinion?

@danielpeintner
Copy link
Member

I created draft PR #1230 to show what I mean...

@FadySalama
Copy link
Contributor Author

FadySalama commented Feb 9, 2024

Throwing an error if schema.type == null will throw in cases in which the schema is correctly defined using "oneof"

@egekorkan
Copy link
Member

Throwing an error if schema.type == null will throw in cases in which the schema is correctly defined using "oneof"

Related to w3c/wot-scripting-api#534

@relu91
Copy link
Member

relu91 commented Feb 9, 2024

I think this is also related to satellite discussions: w3c/wot-thing-description#1234 and in particular w3c/wot-thing-description#1441. My opinion here is that the implementation is still correct, but we are lacking a way to clearly express the fact that we are expecting an empty payload.

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

Successfully merging a pull request may close this issue.

4 participants