cph-cachet / carp.core-kotlin

Infrastructure-agnostic framework for distributed data collection.
https://carp.cachet.dk/core/
MIT License
21 stars 3 forks source link

Upgrade JSON schema validator + fixes #491

Closed Whathecode closed 1 month ago

Whathecode commented 1 month ago

There was an error in the DeviceDeploymentStatus JSON schema which wasn't spotted by the JSON schema validator.

Upgrading to the latest version definitely provides better validation, but in addition also seems to introduce a bug in the evaluation of unevaluatedProperties (https://github.com/networknt/json-schema-validator/issues/1123). For now, I have removed these where it caused validation to fail, thus resulting in less strict/correct schema definitions. If we decide to merge this PR, we need to create a new bug to fix this once the bug is fixed in the schema validator.

On the upside, with the new version of networknt /json-schema-validator it should be possible to use more concise anchor references (https://github.com/cph-cachet/carp.core-kotlin/issues/353). I'll add this as a separate commit later.

Whathecode commented 1 month ago

@yuanchen233 This should be a cleaner workaround, to be resolved in #492.

This has the benefit that extra unexpected properties on concrete types will still correctly fail. And existing properties are properly evaluated. Just a messy/redundant schema definition which shouldn't be necessary.

Whathecode commented 1 month ago

Could you also leave a note/answer to your own question in #353 for future referance? 😀

Of course! 👍🙂

Check the last commit description of this PR. I can't copy paste it now (I'm on phone).