Skip to content

Commit 79a57f6

Browse files
authored
Merge pull request #2138 from dugenkui03/patch-32
Fix for IntrospectionResultToSchema
2 parents 040823c + 09e2480 commit 79a57f6

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/main/java/graphql/introspection/IntrospectionResultToSchema.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.util.Collections;
3535
import java.util.List;
3636
import java.util.Map;
37+
import java.util.Optional;
3738

3839
import static graphql.Assert.assertNotEmpty;
3940
import static graphql.Assert.assertNotNull;
@@ -144,6 +145,7 @@ private DirectiveDefinition createDirective(Map<String, Object> input) {
144145
List<Map<String, Object>> args = (List<Map<String, Object>>) input.get("args");
145146
List<InputValueDefinition> inputValueDefinitions = createInputValueDefinitions(args);
146147
directiveDefBuilder.inputValueDefinitions(inputValueDefinitions);
148+
Optional.ofNullable((Boolean) input.get("isRepeatable")).ifPresent(value -> directiveDefBuilder.repeatable(value));
147149

148150
return directiveDefBuilder.build();
149151
}

src/test/groovy/graphql/introspection/IntrospectionResultToSchemaTest.groovy

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,15 @@ directiveArg: String = "default Value") on FIELD | FRAGMENT_SPREAD | INLINE_FRAG
780780
"defaultValue": "\\"default Value\\""
781781
}
782782
]
783+
},
784+
{
785+
"name": "repeatableDirective",
786+
"description": "repeatable directive",
787+
"locations": [
788+
"FIELD_DEFINITION"
789+
],
790+
"args": [],
791+
"isRepeatable":true
783792
}
784793
]
785794
}"""
@@ -797,6 +806,9 @@ directiveArg: String = "default Value") on FIELD | FRAGMENT_SPREAD | INLINE_FRAG
797806
"customized directive"
798807
directive @customizedDirective("directive arg"
799808
directiveArg: String = "default Value") on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
809+
810+
"repeatable directive"
811+
directive @repeatableDirective repeatable on FIELD_DEFINITION
800812
"""
801813
}
802814
}

0 commit comments

Comments
 (0)