Skip to content

Commit 2931540

Browse files
committed
Adjulst description of validation error to be nonnull
1 parent 0bf48d3 commit 2931540

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/main/java/graphql/validation/ValidationError.java

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

3-
43
import com.google.common.collect.ImmutableMap;
54
import graphql.ErrorType;
65
import graphql.GraphQLError;
@@ -17,6 +16,8 @@
1716
import java.util.Map;
1817
import java.util.stream.Collectors;
1918

19+
import static graphql.Assert.assertNotNull;
20+
2021
@PublicApi
2122
@NullMarked
2223
public class ValidationError implements GraphQLError {
@@ -29,7 +30,7 @@ public class ValidationError implements GraphQLError {
2930

3031
private ValidationError(Builder builder) {
3132
this.validationErrorType = builder.validationErrorType;
32-
this.description = builder.description;
33+
this.description = assertNotNull(builder.description, "description is required");
3334
if (builder.sourceLocations != null) {
3435
this.locations.addAll(builder.sourceLocations);
3536
}
@@ -106,7 +107,6 @@ public int hashCode() {
106107
return GraphqlErrorHelper.hashCode(this);
107108
}
108109

109-
110110
public static Builder newValidationError() {
111111
return new Builder();
112112
}
@@ -119,7 +119,6 @@ public static class Builder {
119119
private ValidationErrorClassification validationErrorType;
120120
private List<String> queryPath;
121121

122-
123122
public Builder validationErrorType(ValidationErrorClassification validationErrorType) {
124123
this.validationErrorType = validationErrorType;
125124
return this;

0 commit comments

Comments
 (0)