-
Notifications
You must be signed in to change notification settings - Fork 1.1k
deterministic SourceLocation serialization #3987
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
deterministic SourceLocation serialization #3987
Conversation
Agree ... this was an oversight and we will change it back |
@@ -73,7 +73,10 @@ public static Object location(SourceLocation location) { | |||
if (line < 1 || column < 1) { | |||
return null; | |||
} | |||
return Map.of("line", line, "column", column); | |||
LinkedHashMap<String, Object> map = new LinkedHashMap<>(2); |
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.
Don't we have a Util method for that? Maybe not, but we should have that emulates the Map.of ...
@@ -154,4 +155,15 @@ class GraphqlErrorHelperTest extends Specification { | |||
assert gErr.getExtensions() == null | |||
} | |||
} | |||
|
|||
@RepeatUntilFailure(maxAttempts = 1_000) |
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.
Oh ... never knew that annotation ... learned that something new here
Thanks for the PR! |
Hey @jbellenger ... We backported this to 24.1 which is available now. |
Thanks! |
In upgrading from 22.3 to 24.0, some of our tests that make assertions on serialized responses started failing.
I think this was probably caused by #3753, which changed the serialized representation from a LinkedHashMap to a
Map.of
, which has randomized iteration order. This PR brings back the LinkedHashMap serialization format.I'd appreciate some feedback on this! While the spec doesn't describe how the fields of an error should be ordered, non-deterministic ordering can make it difficult to build reliable tests that interact with GraphQL errors.