@@ -31,6 +31,7 @@ public class GraphQLDirective implements GraphQLNamedSchemaElement {
3131
3232 private final String name ;
3333 private final String description ;
34+ private final boolean isRepeatable ;
3435 private final EnumSet <DirectiveLocation > locations ;
3536 private final List <GraphQLArgument > arguments = new ArrayList <>();
3637 private final DirectiveDefinition definition ;
@@ -44,20 +45,23 @@ public class GraphQLDirective implements GraphQLNamedSchemaElement {
4445 @ Deprecated
4546 public GraphQLDirective (String name ,
4647 String description ,
48+ boolean isRepeatable ,
4749 EnumSet <DirectiveLocation > locations ,
4850 List <GraphQLArgument > arguments ) {
49- this (name , description , locations , arguments , null );
51+ this (name , description , isRepeatable , locations , arguments , null );
5052 }
5153
5254 private GraphQLDirective (String name ,
5355 String description ,
56+ boolean isRepeatable ,
5457 EnumSet <DirectiveLocation > locations ,
5558 List <GraphQLArgument > arguments ,
5659 DirectiveDefinition definition ) {
5760 assertValidName (name );
5861 assertNotNull (arguments , () -> "arguments can't be null" );
5962 this .name = name ;
6063 this .description = description ;
64+ this .isRepeatable = isRepeatable ;
6165 this .locations = locations ;
6266 this .arguments .addAll (arguments );
6367 this .definition = definition ;
@@ -89,6 +93,10 @@ public String getDescription() {
8993 return description ;
9094 }
9195
96+ public boolean isRepeatable () {
97+ return isRepeatable ;
98+ }
99+
92100 public DirectiveDefinition getDefinition () {
93101 return definition ;
94102 }
@@ -97,6 +105,7 @@ public DirectiveDefinition getDefinition() {
97105 public String toString () {
98106 return "GraphQLDirective{" +
99107 "name='" + name + '\'' +
108+ ", isRepeatable=" + isRepeatable +
100109 ", arguments=" + arguments +
101110 ", locations=" + locations +
102111 '}' ;
@@ -150,6 +159,7 @@ public static Builder newDirective(GraphQLDirective existing) {
150159
151160 public static class Builder extends GraphqlTypeBuilder {
152161
162+ private boolean isRepeatable ;
153163 private EnumSet <DirectiveLocation > locations = EnumSet .noneOf (DirectiveLocation .class );
154164 private final Map <String , GraphQLArgument > arguments = new LinkedHashMap <>();
155165 private DirectiveDefinition definition ;
@@ -161,6 +171,7 @@ public Builder() {
161171 public Builder (GraphQLDirective existing ) {
162172 this .name = existing .getName ();
163173 this .description = existing .getDescription ();
174+ this .isRepeatable = existing .isRepeatable ();
164175 this .locations = existing .validLocations ();
165176 this .arguments .putAll (getByName (existing .getArguments (), GraphQLArgument ::getName ));
166177 }
@@ -183,6 +194,11 @@ public Builder comparatorRegistry(GraphqlTypeComparatorRegistry comparatorRegist
183194 return this ;
184195 }
185196
197+ public Builder isRepeatable (boolean isRepeatable ) {
198+ this .isRepeatable = isRepeatable ;
199+ return this ;
200+ }
201+
186202 public Builder validLocations (DirectiveLocation ... validLocations ) {
187203 Collections .addAll (locations , validLocations );
188204 return this ;
@@ -264,11 +280,12 @@ public GraphQLDirective build() {
264280 return new GraphQLDirective (
265281 name ,
266282 description ,
283+ isRepeatable ,
267284 locations ,
268285 sort (arguments , GraphQLDirective .class , GraphQLArgument .class ),
269286 definition );
270287 }
271288
272289
273290 }
274- }
291+ }
0 commit comments