-
Notifications
You must be signed in to change notification settings - Fork 63
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
Update schema to not allow empty op array #1844
Conversation
Call of 05.07:
@egekorkan we should have a look to see where we allow empty arrays in other places. The TF consensus is to not allow empty arrays and that defaults apply when a term is missing, not when its values are empty (empty objects or empty arrays or Adding this clarification can be done in 2.0. We should not close the issue and reflect the changes to the text in 2.0 |
|
All the arrays (32 occurrences) in the current schema are listed below. The ones without minItems are also linked:
Long story short, it is quite a mess. There are some that are obvious to me but JSON Schema itself does not mandate a string array to have at least one item. It even defaults to links in OpenAPI has no restrictions. See here. @lu-zero has raised the concern that these should be aligned but it may not be so simple to do so since the specs we follow are not aligned but they probably have a reason. |
None of the TD inputs for testing have an empty
|
Thank you for checking all the inputs, @egekorkan! That is actually taken over from the original SDF model which served as the input for the conversion. I think in the context of the model, the empty array does make sense (to indicate an empty list of options as the default). |
Thank you for tackling it, just few safety checks:
|
For op, we don't need to or want to. For other values, we need to understand why they are used like that.
I am not aware of it except for having an empty array as a value of an affordance input/output. E.g. one key of an object always returns |
I think the problem only arises when we allow |
Exactly, Ideally we could be extra explicit and use a notation like |
No, this is an information in the ThingModel. If the modeler chooses to put items in The by Ditto generated TD does not contain
|
No, see https://w3c.github.io/wot-thing-description/#changes-from-august-2022 |
@thjaeckle quick question:
Does it mean that you always start with an empty array and the modeler puts affordances as needed? Other option would be to start without the |
I recently created a TM and I started with empty Starting without |
My opinion for today's meeting is to merge this PR and document all the other cases in an issue since I do not think that we have time to analyse where we should allow empty array and where not. Making them all aligned at the moment is not possible anyways since making |
I think it is enough to document the diverging cases either by defining OneOrMany, NoneOrMany, EmptyOrMany and using them where needed or just noting what's the expectation in case the field is present but empty. |
Call of 27.09: Merging and creating follow-up issue to analyze it in the next charter work. |
fixes #1841
This is a bug fix in my opinion.
Note: I have mirrored the changes in Playground at eclipse-thingweb/playground#476 and verified that tests of valid and invalid TDs still pass.