-
-
Notifications
You must be signed in to change notification settings - Fork 592
Ensure proper sorting of list in error message #940
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
Conversation
+1, but a similar change has been rejected before. See PR #774 |
Ouch... I hope it was due to some misunderstanding because the ability to provide consistent error message instead of random ones should not even need to be explained. |
Sorin - please be a bit more humble about your requests, your last message isn't worded nicely. Read the linked issue. My first inclination is indeed to wontfix this again for the same reason, but I'm happy to consider a change, or even reconsider the closed issue as long as it has justification and addresses what's in #774, not simply "it's obvious". |
If we can do something here I think it would be a real win. I won't pretend to know the solution, but our use of json schemas continues to increase and we love the library. I can think of quite a few places where the errors are being presented right back to the user, so if consistent ordering is possible IMHO, it would be great. |
Is certainly a good reason. Probably indeed plenty to merge, thanks. It's just a bit unfortunate as a maintainer, because:
which it seems is the key driver, is on slightly tenuous grounds:
where if you're going to present to a human the message fine, but the rest of the fields are what equality should be based on, and if that's blocked on #119, then there's an open PR (#856) that seems to just need CI to pass to be merged. But OK, fine. Merging. Thanks for the PR and comments. |
The 3.11 failure in CI is spurious (and I probably should just disable testing on 3.11), but the other one is not -- can you address that one? |
Fixes problem where error message was con consistent between runs.
@Julian thanks! I also updated the tests. You might want to configure github to require GHA approval only for new-github users, that proved to be more enough for us to prevent CI abuse. That involves editing https://github.com/python-jsonschema/jsonschema/settings/actions and selecting "Require approval for first-time contributors who are new to GitHub". |
Codecov Report
@@ Coverage Diff @@
## main #940 +/- ##
=======================================
Coverage 97.02% 97.02%
=======================================
Files 20 20
Lines 3295 3295
Branches 458 458
=======================================
Hits 3197 3197
Misses 77 77
Partials 21 21
Continue to review full report at Codecov.
|
Thanks (I made that GH setting change in the background just as you said it hah.) Will merge in a few. Appreciated. |
Fixes problem where error message was not consistent between runs, even when the inputs were the same (file to be validated and the schema to use).
This should make the outcomes predictable and eliminate the random factor from it. In fact the sorting already happens in 3 other places inside the library but that specific location was missed.
This was found while working on ansible/ansible-lint#2035 and where we observed that the output did very randomly between two runs:
Not listing the allowed properties alphabetically is also not human-friendly as it make quite hard to spot specific entries, especially as the size of these list can grow considerably.