-
-
Notifications
You must be signed in to change notification settings - Fork 589
Sort extra properties for additionalProperties errors #774
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
Sort extra properties for additionalProperties errors #774
Conversation
extras is a set which is unordered. Let's sort it so users get consistent error messages. Signed-off-by: Rob Herring <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #774 +/- ##
=======================================
Coverage 96.37% 96.37%
=======================================
Files 17 17
Lines 2703 2703
Branches 309 309
=======================================
Hits 2605 2605
Misses 79 79
Partials 19 19
Continue to review full report at Codecov.
|
Hi, can you elaborate on what problems the error messages not being in consistent sort order causes? |
Closing since I'm not sure I follow what the idea here would be, but happy to discuss further. |
Users (of dtschema) have reported to me that the order changes from run to run and diffing error logs shows differences. So it's problematic to have that noise. Also note that 'extras' is sorted in the case with 'patternProperties' just above, but not here. |
The exact contents of error messages aren't part of jsonschema's public API -- so It sounds like perhaps these users should instead be logging the fields off of ValidationErrors that they want to track in a structured way, rather than relying on the precise error message, which as mentioned isn't guaranteed to look any certain way or another. (Though #119 may be relevant here) |
I'm only asking for it to be stable within a given release, not across releases.
Exactly, the data in question isn't in a structured field to extract it. |
Got it -- then I think the solution is to implement #119 -- there's I believe a specced solution there in the comments if you were interested in giving it a shot (or if further discussion is needed obviously happy to do that). Even within one release, there's yeah just no guarantees provided here. |
extras is a set which is unordered. Let's sort it so users get
consistent error messages.
Signed-off-by: Rob Herring [email protected]