-
Notifications
You must be signed in to change notification settings - Fork 3
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
Upgrade JSON schema validator + fixes #491
Conversation
This didn't seem to fail due to missing evaluation in the currently used version of `com.networknt:json-schema-validator`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before this bug is fixed, those schemas allows additional properties. (I tried to apply "additionalProperties": false
resulting the same error message)
7048b4e
to
a229b93
Compare
@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. |
This seems to have introduced better evaluation of `allOf` and `oneOf` references. However, it does seem to introduce a bug which causes it not to consider properties in nested schemas more than 1 level deep when evaluating `unevaluatedProperties`: networknt/json-schema-validator#1123 Therefore, a hack was introduced to make sure validation succeeds.. Note that not all concrete types are currently evaluated (#404), so there are many other schemas which would also fail if they were to be evaluated, and they would need to apply a similar fix.
With the upgrade to the latest JSON schema validator, internal anchor references (within a schema) now work. Types which should only be used internally still use the longer paths to `$defs`. This has the added benefit that these anchors are also evaluated. It turned out that some anchors in `ParticipantGroupStatus` were wrong, and in `DataStreamServiceRequest` one was missing. Closes #353
a229b93
to
f48e063
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there conventions for when to use an anchor and when not?
Are we using anchor for all subschemas? 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). |
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
(networknt/json-schema-validator#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 (#353). I'll add this as a separate commit later.