-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Change the error message to be consumer targeted #2096
Change the error message to be consumer targeted #2096
Conversation
@RobinCPel Would you mind reviewing this websocket PR? |
Oh, I need to re-run generate after cherry-picking this from a v0.17.2. And it looks like array ordering for the error messages isn’t stable as the failing test passes on my infra. I’ll fix both of these on Monday. |
fc582da
to
d1aa136
Compare
Fix the test to not be sensitive to array ordering. Re-generate on master as there was a schema change.
d1aa136
to
9ee3cd6
Compare
Sorry for the noise with this I messed up my rebase and ended up with reparented commits I didn't intend to reparent. Also this isn't necessarily web-socket related, this error message applied outside of the web-socket context. To simplify review a little bit since this makes a bunch of noise in generated files the main file with explicit changes is: codegen/type.gotpl And then these test files: codegen/testserver/followschema/nulls_test.go |
Huh, so is the array order for the error message stable now and this is ok to merge as is? Or is there something else to be done to make the tests not flaky? |
In the tests I moved from exact string compare on the error to separate Contains checks for each element I expect to exist: So the tests no longer care about the error message ordering, it should be good to go. |
Thanks so much! I appreciate the wording improvement. |
@telemenar I really appreciated this change. Now that I updated my project's gqlgen version I noticed the diff in new generated files and found out 84 times the string: Can we use a Since I'm not familiar with the gqlgen code could you create a PR for this? What do you think? Maybe something smarter would be: "if there are at least two occurrences of this string create a const". |
The existing "must not be null" message if read by the caller of a gql api could be confusing because nothing they provided was null.
Changed the message from "must not be null" to "the requested element is null which the schema does not allow"
I have: