Open egekorkan opened 10 months ago
The issue with not being able to mention optional features in a TM is something that I think needs to be fixed in the TM spec, if possible. If/when it is, we can resolve the second point by updating the TDD's TM appropriately. Otherwise we will probably have to go in the other direction and not constrain/mention optional features at all. I don't think that's a great solution, it means the TM description of the API would be incomplete (although particular TDDs could add stuff to their own TDs). Maybe optional mixin TMs? Ugh.
As to whether or not this should be an assertion, in some cases we took out assertions (or turned them into explanatory text) if they were duplicates e.g. of a table assertion. I'm not saying that's the case here but we will have to check.
There is an assertion for this, a few paragraphs above:
As an alternative to an array of TDs as the body of the response, the server MAY send a more verbose payload allowing server-side information, such as pagination information, to be included in addition to the actual data.
So, the collection format is optional.
As for the error message, the server should respond with a 400 or 501. See the following assertion:
When a directory is unable to answer a request because of unsupported recommended or optional features, it SHOULD inform the client about the absence of those features by returning appropriate HTTP errors.
And the examples that follow:
- If the missing feature is to customize functionality of an existing API use 400 (Bad Request) or 501 (Not Implemented).
- If an API endpoint is not provided (e.g. /search/sparql endpoint), use 404 (Not Found).
- If a method is not supported on an existing API endpoint (e.g. PATCH for /things endpoint), use 405 (Method Not Allowed).
https://www.w3.org/TR/wot-discovery/#exploration-directory-api
Coming from a discussion with @relu91.
The text at https://w3c.github.io/wot-discovery/#directory-api-spec says:
First of all, this is not marked as an assertion. Implementations can miss this.
Secondly, it is not clear how to mention you don't support collection or array within format. According to the TM, all TDDs need to support both but if the Discoverer doesn't provide format, you can use a default term. This is an overall limitation on using TM to specify a flexible specification. If the TD of TDD does not provide one value, it is a wrong implementation since a TD cannot remove parts of a TM.