Skip to content

Commit

Permalink
Upgrade to GraphQL Java 19.0
Browse files Browse the repository at this point in the history
This new release makes the request `Locale` mandatory.

Closes gh-444
  • Loading branch information
bclozel committed Aug 1, 2022
1 parent ea14041 commit 40c354a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {

ext {
moduleProjects = [project(":spring-graphql"), project(":spring-graphql-test")]
graphQlJavaVersion = "18.2"
graphQlJavaVersion = "19.0"
bootVersion = "3.0.0-SNAPSHOT"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public class DefaultExecutionGraphQlRequest extends DefaultGraphQlRequest implem
@Nullable
private ExecutionId executionId;

@Nullable
private final Locale locale;

private final List<BiFunction<ExecutionInput, ExecutionInput.Builder, ExecutionInput>> executionInputConfigurers = new ArrayList<>();
Expand All @@ -73,7 +72,7 @@ public DefaultExecutionGraphQlRequest(
super(document, operationName, variables, extensions);
Assert.notNull(id, "'id' is required");
this.id = id;
this.locale = locale;
this.locale = (locale != null) ? locale : Locale.getDefault();
}


Expand All @@ -95,7 +94,6 @@ public ExecutionId getExecutionId() {
}

@Override
@Nullable
public Locale getLocale() {
return this.locale;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package org.springframework.graphql;

import java.util.Locale;

import graphql.execution.ExecutionId;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -46,4 +48,9 @@ void shouldUseExecutionId() {
assertThat(this.request.toExecutionInput().getExecutionId()).isEqualTo(customId);
}

@Test
void shouldHaveDefaultLocale() {
assertThat(this.request.getLocale()).isEqualTo(Locale.getDefault());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -294,7 +295,7 @@ private static GraphQlSetup initGraphQlSetup(

private WebGraphQlRequest request(String query) {
return new WebGraphQlRequest(
URI.create("/"), new HttpHeaders(), Collections.singletonMap("query", query), "1", null);
URI.create("/"), new HttpHeaders(), Collections.singletonMap("query", query), "1", Locale.ENGLISH);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.springframework.graphql;

import java.util.Locale;
import java.util.concurrent.atomic.AtomicLong;

import org.springframework.graphql.support.DefaultExecutionGraphQlRequest;
Expand All @@ -32,7 +33,7 @@ public class TestExecutionRequest extends DefaultExecutionGraphQlRequest {


private TestExecutionRequest(String document) {
super(document, null, null, null, String.valueOf(idIndex.incrementAndGet()), null);
super(document, null, null, null, String.valueOf(idIndex.incrementAndGet()), Locale.ENGLISH);
}


Expand Down

0 comments on commit 40c354a

Please sign in to comment.