w3c / wot-thing-description

Web of Things (WoT) Thing Description
http://w3c.github.io/wot-thing-description/
Other
131 stars 63 forks source link

JSON Schema VersionInfo #2045

Open mahdanoura opened 2 weeks ago

mahdanoura commented 2 weeks ago

According to the specification, the version must have an instance and can have an optional model keyword. This is not fully reflected in the current JSON schema.

egekorkan commented 1 week ago

Even though the table says that, the model keyword is restricted to TMs only. That is why, the TM JSON Schema contains it at https://github.com/w3c/wot-thing-description/blob/main/validation/tm-json-schema-validation.json#L1914 . It would also not make sense to have the TM version in a TD since linking to a TM should be enough.

As a separate point, assuming that this is a real mistake, we would mark this as errata since this fix would need to be applied to TD 1.1 schemas. Furthermore, this gives a nice example on how we would need to version our JSON Schemas. There was a discussion before whether this would be a breaking change or not since this adds a new restriction. We agreed that it is not a breaking change.

JKRhb commented 1 week ago

Even though the table says that, the model keyword is restricted to TMs only. That is why, the TM JSON Schema contains it at https://github.com/w3c/wot-thing-description/blob/main/validation/tm-json-schema-validation.json#L1914 . It would also not make sense to have the TM version in a TD since linking to a TM should be enough.

If I am not mistaken, this is partly related to the fact that you need to take over all the fields of a TM (except for affordances including in tm:optional) into the resulting TD – so if there is a model version present in the TM, it will also end up in the TD. So for that case, it might make sense to include it in the JSON Schema until TD 2.0 (also see #2042 for a potential fix).

relu91 commented 1 week ago

I found the description a little bit confusing too, but then I realized @JKRhb's point so that's why I think that in the end adding to TD 1.1 JSON schema would be correct even if not perfect.

mahdanoura commented 1 week ago

The TD generated in Example 65 from TM composition process provides both model and instance.

egekorkan commented 1 week ago

Ok, you are all correct. Given that the example shows that and the spec does not say it must be removed, it should be fixed in the schema.

I am adding erratum raised label (its temporary version, a PR for errata management is coming soon).

egekorkan commented 1 week ago

TD Call: The model keyword is defined twice in the ontologies. @mahdanoura will check that as well.