diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 74651d8847..ffcf661974 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: gradle/wrapper-validation-action@v3 + - uses: gradle/actions/wrapper-validation@v4 - name: Set up JDK 11 uses: actions/setup-java@v4 with: diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 98a5a3e352..61f24f3d28 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: gradle/wrapper-validation-action@v3 + - uses: gradle/actions/wrapper-validation@v4 - name: Set up JDK 11 uses: actions/setup-java@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 21b31d32ee..2d630314c0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: gradle/wrapper-validation-action@v3 + - uses: gradle/actions/wrapper-validation@v4 - name: Set up JDK 11 uses: actions/setup-java@v4 with: diff --git a/src/main/java/graphql/GraphqlErrorHelper.java b/src/main/java/graphql/GraphqlErrorHelper.java index 391b223d92..901c25b5a9 100644 --- a/src/main/java/graphql/GraphqlErrorHelper.java +++ b/src/main/java/graphql/GraphqlErrorHelper.java @@ -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 map = new LinkedHashMap<>(2); + map.put("line", line); + map.put("column", column); + return map; } static List fromSpecification(List> specificationMaps) { diff --git a/src/test/groovy/graphql/GraphqlErrorHelperTest.groovy b/src/test/groovy/graphql/GraphqlErrorHelperTest.groovy index 018c9f1577..0736b1671a 100644 --- a/src/test/groovy/graphql/GraphqlErrorHelperTest.groovy +++ b/src/test/groovy/graphql/GraphqlErrorHelperTest.groovy @@ -3,6 +3,7 @@ package graphql import graphql.language.SourceLocation import graphql.validation.ValidationError import graphql.validation.ValidationErrorType +import spock.lang.RepeatUntilFailure import spock.lang.Specification class GraphqlErrorHelperTest extends Specification { @@ -154,4 +155,15 @@ class GraphqlErrorHelperTest extends Specification { assert gErr.getExtensions() == null } } + + @RepeatUntilFailure(maxAttempts = 1_000) + def "can deterministically serialize SourceLocation"() { + when: + def specMap = GraphqlErrorHelper.toSpecification(new TestError()) + + then: + def location = specMap["locations"][0] as Map + def keys = location.keySet().toList() + keys == ["line", "column"] + } }