Skip to content

Commit 1499e2d

Browse files
authored
Merge pull request #39 from aoudiamoncef/feature/migrate-to-grapgqljava16
feat: upgrade to GraphQL Java 16.1
2 parents 8bf2565 + c3508e1 commit 1499e2d

File tree

10 files changed

+39
-33
lines changed

10 files changed

+39
-33
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ This library provides extended validation of fields and field arguments for [gra
1616
<dependency>
1717
<groupId>com.graphql-java</groupId>
1818
<artifactId>graphql-java-extended-validation</artifactId>
19-
<version>15.0.1</version>
19+
<version>16.0.0</version>
2020
<type>pom</type>
2121
</dependency>
2222
```
2323

2424
```groovy
25-
compile 'com.graphql-java:graphql-java-extended-validation:15.0.1'
25+
compile 'com.graphql-java:graphql-java-extended-validation:16.0.0'
2626
```
2727

2828
> Note:
@@ -32,6 +32,8 @@ compile 'com.graphql-java:graphql-java-extended-validation:15.0.1'
3232
> use 14.0.1 or above for graphql-java 14.x and above
3333
>
3434
> use 15.0.1 or above for graphql-java 15.x and above
35+
>
36+
> use 16.0.0 or above for graphql-java 16.x and above
3537
3638
Its currently available from JCenter repo and Maven central.
3739

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ repositories {
3939

4040

4141
dependencies {
42-
compile "com.graphql-java:graphql-java:15.0"
42+
compile "com.graphql-java:graphql-java:16.1"
4343
compile 'org.slf4j:slf4j-api:1.7.30'
4444
compile "jakarta.validation:jakarta.validation-api:2.0.2"
45-
compile "org.hibernate.validator:hibernate-validator:6.1.5.Final"
45+
compile "org.hibernate.validator:hibernate-validator:6.1.6.Final"
4646
compile "jakarta.el:jakarta.el-api:3.0.3"
4747
compile "org.glassfish:jakarta.el:3.0.3"
4848

src/main/java/graphql/validation/interpolation/ResourceBundleMessageInterpolator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import graphql.ErrorClassification;
44
import graphql.GraphQLError;
55
import graphql.GraphqlErrorBuilder;
6-
import graphql.execution.ExecutionPath;
6+
import graphql.execution.ResultPath;
77
import graphql.schema.GraphQLDirective;
88
import graphql.validation.el.StandardELVariables;
99
import graphql.validation.rules.ValidationEnvironment;
@@ -70,7 +70,7 @@ public class ResourceBundleMessageInterpolator implements MessageInterpolator {
7070
*/
7171
@SuppressWarnings("unused")
7272
protected ErrorClassification buildErrorClassification(String messageTemplate, Map<String, Object> messageParams, ValidationEnvironment validationEnvironment) {
73-
ExecutionPath fieldOrArgumentPath = validationEnvironment.getValidatedPath();
73+
ResultPath fieldOrArgumentPath = validationEnvironment.getValidatedPath();
7474
GraphQLDirective directive = validationEnvironment.getContextObject(GraphQLDirective.class);
7575
return new ValidationErrorType(fieldOrArgumentPath, directive);
7676
}
@@ -183,10 +183,10 @@ private org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterp
183183
}
184184

185185
private static class ValidationErrorType implements ErrorClassification {
186-
private final ExecutionPath fieldOrArgumentPath;
186+
private final ResultPath fieldOrArgumentPath;
187187
private final GraphQLDirective directive;
188188

189-
ValidationErrorType(ExecutionPath fieldOrArgumentPath, GraphQLDirective directive) {
189+
ValidationErrorType(ResultPath fieldOrArgumentPath, GraphQLDirective directive) {
190190
this.fieldOrArgumentPath = fieldOrArgumentPath;
191191
this.directive = directive;
192192
}

src/main/java/graphql/validation/rules/TargetedValidationRules.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import graphql.Assert;
44
import graphql.GraphQLError;
55
import graphql.PublicApi;
6-
import graphql.execution.ExecutionPath;
6+
import graphql.execution.ResultPath;
77
import graphql.schema.DataFetchingEnvironment;
88
import graphql.schema.GraphQLArgument;
99
import graphql.schema.GraphQLDirective;
@@ -71,7 +71,7 @@ public List<GraphQLError> runValidationRules(DataFetchingEnvironment env, Messag
7171

7272
GraphQLObjectType fieldContainer = env.getExecutionStepInfo().getFieldContainer();
7373
GraphQLFieldDefinition fieldDefinition = env.getFieldDefinition();
74-
ExecutionPath fieldPath = env.getExecutionStepInfo().getPath();
74+
ResultPath fieldPath = env.getExecutionStepInfo().getPath();
7575
//
7676
// run the field specific rules
7777
ValidationCoordinates fieldCoords = ValidationCoordinates.newCoordinates(fieldContainer, fieldDefinition);
@@ -168,7 +168,7 @@ private List<GraphQLError> walkObjectArg(ValidationRule rule, ValidationEnvironm
168168
continue;
169169
}
170170

171-
ExecutionPath newPath = validationEnvironment.getValidatedPath().segment(inputField.getName());
171+
ResultPath newPath = validationEnvironment.getValidatedPath().segment(inputField.getName());
172172

173173
ValidationEnvironment newValidationEnvironment = validationEnvironment.transform(builder -> builder
174174
.validatedPath(newPath)
@@ -197,7 +197,7 @@ private List<GraphQLError> walkListArg(ValidationRule rule, ValidationEnvironmen
197197
int ix = 0;
198198
for (Object value : objectList) {
199199

200-
ExecutionPath newPath = validationEnvironment.getValidatedPath().segment(ix);
200+
ResultPath newPath = validationEnvironment.getValidatedPath().segment(ix);
201201

202202
ValidationEnvironment newValidationEnvironment = validationEnvironment.transform(builder -> builder
203203
.validatedPath(newPath)

src/main/java/graphql/validation/rules/ValidationEnvironment.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package graphql.validation.rules;
22

33
import graphql.PublicApi;
4-
import graphql.execution.ExecutionPath;
4+
import graphql.execution.ResultPath;
55
import graphql.language.SourceLocation;
66
import graphql.schema.DataFetchingEnvironment;
77
import graphql.schema.GraphQLArgument;
@@ -45,8 +45,8 @@ public enum ValidatedElement {
4545
private final GraphQLFieldsContainer fieldsContainer;
4646
private final GraphQLFieldDefinition fieldDefinition;
4747
private final GraphQLArgument argument;
48-
private final ExecutionPath executionPath;
49-
private final ExecutionPath validatedPath;
48+
private final ResultPath executionPath;
49+
private final ResultPath validatedPath;
5050
private final SourceLocation location;
5151
private final MessageInterpolator interpolator;
5252
private final Map<Class, Object> contextMap;
@@ -99,11 +99,11 @@ public SourceLocation getLocation() {
9999
return location;
100100
}
101101

102-
public ExecutionPath getValidatedPath() {
102+
public ResultPath getValidatedPath() {
103103
return validatedPath;
104104
}
105105

106-
public ExecutionPath getExecutionPath() {
106+
public ResultPath getExecutionPath() {
107107
return executionPath;
108108
}
109109

@@ -146,8 +146,8 @@ public static class Builder {
146146
private GraphQLArgument argument;
147147
private Map<String, Object> argumentValues = new HashMap<>();
148148
private GraphQLFieldDefinition fieldDefinition;
149-
private ExecutionPath validatedPath = ExecutionPath.rootPath();
150-
private ExecutionPath executionPath;
149+
private ResultPath validatedPath = ResultPath.rootPath();
150+
private ResultPath executionPath;
151151
private GraphQLFieldsContainer fieldsContainer;
152152
private MessageInterpolator interpolator;
153153
private Locale locale;
@@ -202,7 +202,7 @@ public Builder fieldsContainer(GraphQLFieldsContainer fieldsContainer) {
202202
return this;
203203
}
204204

205-
public Builder executionPath(ExecutionPath executionPath) {
205+
public Builder executionPath(ResultPath executionPath) {
206206
this.executionPath = executionPath;
207207
return this;
208208
}
@@ -227,7 +227,7 @@ public Builder validatedValue(Object validatedValue) {
227227
return this;
228228
}
229229

230-
public Builder validatedPath(ExecutionPath validatedPath) {
230+
public Builder validatedPath(ResultPath validatedPath) {
231231
this.validatedPath = validatedPath;
232232
return this;
233233
}

src/main/java/graphql/validation/util/Util.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import graphql.GraphQLError;
55
import graphql.Internal;
66
import graphql.execution.DataFetcherResult;
7-
import graphql.execution.ExecutionPath;
7+
import graphql.execution.ResultPath;
88
import graphql.schema.GraphQLInputType;
99
import graphql.schema.GraphQLType;
1010
import graphql.schema.GraphQLTypeUtil;
@@ -79,7 +79,7 @@ public static <T, U extends Comparable<? super U>> List<T> sort(Collection<T> to
7979
}
8080

8181

82-
public static ExecutionPath concatPaths(ExecutionPath parent, ExecutionPath child) {
82+
public static ResultPath concatPaths(ResultPath parent, ResultPath child) {
8383
if (child == null) {
8484
return parent;
8585
}

src/test/groovy/graphql/validation/TestUtil.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import graphql.schema.idl.errors.SchemaProblem
3434
import java.util.function.Supplier
3535
import java.util.stream.Collectors
3636

37+
3738
class TestUtil {
3839

3940

@@ -47,8 +48,9 @@ class TestUtil {
4748

4849
static dummySchema = GraphQLSchema.newSchema()
4950
.query(GraphQLObjectType.newObject()
50-
.name("QueryType")
51-
.build())
51+
.name("QueryType")
52+
.field(GraphQLFieldDefinition.newFieldDefinition().name("field").type(Scalars.GraphQLString))
53+
.build())
5254
.build()
5355

5456
static GraphQLSchema schemaFile(String fileName) {

src/test/groovy/graphql/validation/constraints/BaseConstraintTestSupport.groovy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package graphql.validation.constraints
22

33
import graphql.GraphQLError
44
import graphql.GraphqlErrorBuilder
5-
import graphql.execution.ExecutionPath
5+
import graphql.execution.ResultPath
66
import graphql.execution.ExecutionStepInfo
77
import graphql.execution.MergedField
88
import graphql.language.Field
@@ -50,7 +50,7 @@ class BaseConstraintTestSupport extends Specification {
5050

5151
def validationRules = TargetedValidationRules.newValidationRules().addRule(coordinates, ruleUnderTest).build()
5252

53-
def path = ExecutionPath.rootPath()
53+
def path = ResultPath.rootPath()
5454

5555
def astField = Field.newField()
5656
.name(fieldDefinition.name)
@@ -100,8 +100,8 @@ class BaseConstraintTestSupport extends Specification {
100100
.validatedType(argUnderTest.getType())
101101
.fieldDefinition(fieldDefinition)
102102
.fieldsContainer(fieldsContainer)
103-
.executionPath(ExecutionPath.rootPath().segment(fieldDefinition.getName()))
104-
.validatedPath(ExecutionPath.rootPath().segment(argName))
103+
.executionPath(ResultPath.rootPath().segment(fieldDefinition.getName()))
104+
.validatedPath(ResultPath.rootPath().segment(argName))
105105
.context(GraphQLDirective.class, argUnderTest.getDirective(targetDirective))
106106
.messageInterpolator(interpolator)
107107
.build()
@@ -112,7 +112,7 @@ class BaseConstraintTestSupport extends Specification {
112112
GraphQLFieldsContainer fieldsContainer = schema.getObjectType("Query") as GraphQLFieldsContainer
113113
GraphQLFieldDefinition fieldDefinition = fieldsContainer.getFieldDefinition("field")
114114

115-
def path = ExecutionPath.rootPath().segment(fieldDefinition.getName())
115+
def path = ResultPath.rootPath().segment(fieldDefinition.getName())
116116
def ruleEnvironment = ValidationEnvironment.newValidationEnvironment()
117117
.argumentValues(arguments)
118118
.fieldsContainer(fieldsContainer)

src/test/groovy/graphql/validation/interpolation/ResourceBundleMessageInterpolatorTest.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package graphql.validation.interpolation
22

3-
import graphql.execution.ExecutionPath
3+
import graphql.execution.ResultPath
44
import graphql.schema.GraphQLArgument
55
import graphql.schema.GraphQLFieldDefinition
66
import graphql.schema.GraphQLFieldsContainer
@@ -24,8 +24,8 @@ class ResourceBundleMessageInterpolatorTest extends Specification {
2424
.fieldDefinition(fieldDefinition)
2525
.fieldsContainer(fieldsContainer)
2626
.messageInterpolator(interpolator)
27-
.executionPath(ExecutionPath.rootPath().segment(fieldDefinition.getName()))
28-
.validatedPath(ExecutionPath.rootPath().segment(argName))
27+
.executionPath(ResultPath.rootPath().segment(fieldDefinition.getName()))
28+
.validatedPath(ResultPath.rootPath().segment(argName))
2929
.locale(locale)
3030
.build()
3131
ruleEnvironment

src/test/groovy/graphql/validation/util/DirectivesAndTypeWalkerTest.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ class DirectivesAndTypeWalkerTest extends Specification {
99

1010
def "can walk self referencing types"() {
1111
def sdl = """
12+
directive @deprecated on INPUT_OBJECT
13+
1214
input TestInput @deprecated {
1315
name : String
1416
list : [TestInput]

0 commit comments

Comments
 (0)