Skip to content
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

Validation of TDs #16

Open
danielpeintner opened this issue Nov 28, 2024 · 6 comments
Open

Validation of TDs #16

danielpeintner opened this issue Nov 28, 2024 · 6 comments

Comments

@danielpeintner
Copy link
Member

During the F2F the aspect was discussed that uploading TDs should guarantee accuracy.

Question: How much validation is done at the moment? JSON-LD processing?

Does it make sense to do a validation check via JSON schema and/or playground libraries?
Doing so guarantees that we have accurate TDs only in the directory.

@wiresio
Copy link
Member

wiresio commented Nov 28, 2024

You can enable JSON-schema validation for the TD upload:
PUT TD to <WOT API URL>/things?check-schema=true

@danielpeintner
Copy link
Member Author

You can enable JSON-schema validation for the TD upload:
PUT TD to <WOT API URL>/things?check-schema=true

Great, thanks! I missed that.
What kind of validation is used? JSON schema?

FYI: playground has some even more sophisticated validation, @egekorkan knows more.
see https://github.com/eclipse-thingweb/playground?tab=readme-ov-file#packages

grafik

@wiresio
Copy link
Member

wiresio commented Nov 28, 2024

Great, thanks! I missed that. What kind of validation is used? JSON schema?

tdd/data/td-json-schema-validation.json

FYI: playground has some even more sophisticated validation, @egekorkan knows more. see https://github.com/eclipse-thingweb/playground?tab=readme-ov-file#packages

Happy to discuss which additional validations might make sense.

@egekorkan
Copy link
Member

With the new charter, there are some linting discussions happening but there are still mandatory validations. One example of each:

  • Linting: enum and const should not be present at the same time. JSON Schema rules take apply both so enum is not needed but will not throw a validation error during payload validation.
  • Required Validation: security must link to an existing key within securityDefinitions

@Murloc6
Copy link
Contributor

Murloc6 commented Nov 29, 2024

With the new charter, there are some linting discussions happening but there are still mandatory validations. One example of each:

* Linting: `enum` and `const` should not be present at the same time. JSON Schema rules take apply both so enum is not needed but will not throw a validation error during payload validation.

* Required Validation: `security` must link to an existing key within `securityDefinitions`

If I understand your comment, it means that the JSON Schema versioned here is not correct anymore and must be updated regarding the new JSON Schema specification from the W3C WG ?

@egekorkan
Copy link
Member

If I understand your comment, it means that the JSON Schema versioned here is not correct anymore and must be updated regarding the new JSON Schema specification from the W3C WG ?

No I did not mean that. However, the schema here is older than the 1.1 Schema at https://github.com/w3c/wot-thing-description/blob/main/validation/td-json-schema-validation.json. I am not sure if this is intentional though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants