-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Inconsistent Order of Errors? #260
Comments
Hey @jonmchan That is very strange, the errors returned in v9 are in an array and validator is synchronous, so they should always return in the same order. I will investigate, if you could provide your full test code that would be helpful, just to rule out the reuse of a variable or something. P.S. it looks like your using validator through gin, could you please confirm that it is actually using v9 and not v8; the default vendored version in gin is v8 and v8 returns a map, so order cannot be guaranteed. |
@jonmchan update, found the issue, I was storing the field cache in a map (for some reason) converting to an array now; should be fixed within a few hours at most :) thanks for reporting |
Hey @jonmchan I've made the appropriate changes in release 9.2.2, please confirm this solves this for you :) |
@joeybloggs - you work fast! Yes, I updated my gin validator to v9. I'll test release 9.2.2 tomorrow and close this bug if I can confirm that the order of errors remain static. Thanks! |
The test assertions pass everytime! That did the trick! Thanks! |
Package version eg. v8, v9:
v9
Issue, Question or Enhancement:
Is there any way to make validator return errors in a consistent order or sort the validation errors? I'm trying to write a test against 3 errors, but the test fails randomly when the order of the errors are returned in different orders each time the test is run.
Code sample, to showcase or reproduce:
Return Value Run 1:
Return Value Run 2:
The text was updated successfully, but these errors were encountered: