GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — deterministic SourceLocation serialization by jbellenger · Pull Request #3987 · graphql-java/graphql-java

Conversation

@jbellenger

@jbellenger jbellenger commented May 24, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
jbellenger added 2 commits May 24, 2025 05:26
@jbellenger
deterministically serialize SourceLocation
71444d8
@jbellenger
tidy
baf1125
@jbellenger
jbellenger marked this pull request as ready for review May 24, 2025 12:43
@andimarek

andimarek commented May 24, 2025

Copy link
Copy Markdown
Member

Agree ... this was an oversight and we will change it back

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

andimarek
andimarek approved these changes May 24, 2025
View reviewed changes
Comment thread src/main/java/graphql/GraphqlErrorHelper.java
return null;
}
return Map.of("line", line, "column", column);
LinkedHashMap<String, Object> map = new LinkedHashMap<>(2);

@andimarek andimarek May 24, 2025

Copy link
Copy Markdown
Member

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 ...

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
andimarek
andimarek reviewed May 24, 2025
View reviewed changes
Comment thread src/test/groovy/graphql/GraphqlErrorHelperTest.groovy
}
}

@RepeatUntilFailure(maxAttempts = 1_000)

@andimarek andimarek May 24, 2025

Copy link
Copy Markdown
Member

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dondonz

dondonz commented May 25, 2025

Copy link
Copy Markdown
Member

Thanks for the PR!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

dondonz
dondonz approved these changes May 25, 2025
View reviewed changes
@dondonz dondonz added this to the 25.x breaking changes milestone May 25, 2025
@dondonz
dondonz merged commit 4b1f231 into graphql-java:master May 25, 2025
@dondonz dondonz mentioned this pull request May 26, 2025
Ban Map.of #3989
Closed
@andimarek andimarek mentioned this pull request May 30, 2025
Deterministic source location backport 24 #3995
Merged
@andimarek

andimarek commented May 30, 2025

Copy link
Copy Markdown
Member

Hey @jbellenger ... We backported this to 24.1 which is available now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jbellenger

jbellenger commented May 30, 2025

Copy link
Copy Markdown
Contributor Author

Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@andimarek andimarek andimarek approved these changes
@dondonz dondonz dondonz approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

25.x breaking changes

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@jbellenger @andimarek @dondonz
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.