-
Notifications
You must be signed in to change notification settings - Fork 28
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
fix(InteractionOutput): don't require schema.type in value function #534
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the discussion we had in eclipse-thingweb/node-wot#1221, and the arguments provided it makes sense to soften the restriction a bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I probably failed to express this correctly, but we need the data schema in the value function, and without it the value function does not make any sense... it is like mapping from A to B without B. Hence, as I said in this comment, the algorithm should say:
... or if |schema| is
null
or is not a valid schema then reject...
Problem is that we need to define what is a valid schema for us. We got around this because so far for scripting API the schema did not have complex root types (like oneOf, allOf etc.). See also this section of how to use the schema, it is very simplified but in reality (also in node-wot) schemas are much more complex than that.
Very good points, @relu91, thank you. You are right, this definitely requires more work, especially when it comes to the "check data schema" algorithm. Could we maybe refer to something already defined by JSON Schema here? |
|dataUsed| is `true`, or if |form| is not an {{object}} or if |schema| | ||
is `null` or `undefined`, then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, this is (more or less) the change proposed by @relu91 in #534 (review). The question here, also raised by him, is how we should ensure that the schema is valid – do we need to define a separate algorithm for that?
|dataUsed| is `true`, or if |form| is not an {{object}} or if |schema| | |
is `null` or `undefined`, then | |
|dataUsed| is `true`, or if |form| is not an {{object}} or if |schema| | |
is `null` or `undefined` or not a valid schema, then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: JSON schema is VERY loose when it comes to what is a valid schema.. almost anything is a valid JSON schema. Hence I am not sure if it makes sense to do anything on top...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yeah, I now remember that we also discussed this briefly on Friday during the Thingweb meeting... Then I suppose we should keep this step as is, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"not a valid schema" needs an algorithm
Call 05/02:
|
8bda034
to
0f00764
Compare
I've now tried to incorporate |
This comment was marked as resolved.
This comment was marked as resolved.
Call 19/02:
|
From 04/03:
|
At the moment, the
value
function of theInteractionOutput
interface requires thetype
field of itsschema
to be set. In a discussion over at eclipse-thingweb/node-wot#1221, we identified this as a problem for several different scenarios, including theexloreDirectory
method, as thethings
property of the Thing Description Directory API specification does not contain atype
field itself, as there are two different types that can be obtained from the property (namely, an array or an object of TDs).Therefore, this PR proposes changing the algorithm to not throw anymore when the field should be
null
orundefined
, making it usable in more scenarios.Preview | Diff