linksmart / thing-directory

Directory of Web of Things (WoT) Thing Descriptions. Maintained fork at https://github.com/TinyIoT/thing-directory
Apache License 2.0
21 stars 4 forks source link

Add HTTP endpoint for TD validation #11

Closed farshidtz closed 4 years ago

farshidtz commented 4 years ago

It would be nice to have an endpoint to validate TDs against the TD schema.

What should the operation/endpoint look like?

dschowta commented 4 years ago

Validation can be done in one of the following ways (motivated from this thread:

  1. Provide a separate endpoint POST /dry-run-td so that a client can validate its TD. Here the POST method becomes idempotent which is not RESTFul

  2. Use the same endpoint, but pass a flag to indicate it as a dry run. e.g.

    • POST /td?dry-run=true where the dry-run defaults to false when not given
    • POST /td?exec=false or POST /td?commit=false where the dry-run defaults to true when not given. This method complicates the existing endpoint
  3. Do not perform dry run at all and leave it to the client. This has the problem that the client can not sync up always with the server about the schema unless the server exposes it.

  4. Use GET /validation with body but some clients may not support a body in GET request.