File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed
src/main/java/com/kobylynskyi/graphql/codegen Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 44import com .kobylynskyi .graphql .codegen .model .GraphqlDefinitionType ;
55import com .kobylynskyi .graphql .codegen .model .DefinitionTypeDeterminer ;
66import com .kobylynskyi .graphql .codegen .model .MappingConfig ;
7+ import com .kobylynskyi .graphql .codegen .model .UnsupportedGraphqlDefinitionException ;
78import freemarker .template .TemplateException ;
89import graphql .language .*;
910import lombok .Getter ;
@@ -52,7 +53,12 @@ public void generate() throws Exception {
5253
5354 private void processDocument (Document document ) throws IOException , TemplateException {
5455 for (Definition definition : document .getDefinitions ()) {
55- GraphqlDefinitionType definitionType = DefinitionTypeDeterminer .determine (definition );
56+ GraphqlDefinitionType definitionType ;
57+ try {
58+ definitionType = DefinitionTypeDeterminer .determine (definition );
59+ } catch (UnsupportedGraphqlDefinitionException ex ) {
60+ continue ;
61+ }
5662 switch (definitionType ) {
5763 case OPERATION :
5864 generateOperation ((ObjectTypeDefinition ) definition );
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ public static GraphqlDefinitionType determine(@NonNull Definition definition) {
2626 return GraphqlDefinitionType .SCALAR ;
2727 } else if (definition instanceof InterfaceTypeDefinition ) {
2828 return GraphqlDefinitionType .INTERFACE ;
29+ } else if (definition instanceof DirectiveDefinition ) {
30+ return GraphqlDefinitionType .DIRECTIVE ;
2931 } else {
3032 throw new UnsupportedGraphqlDefinitionException (definition );
3133 }
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ public enum GraphqlDefinitionType {
99 INPUT ,
1010 UNION ,
1111 ENUM ,
12- SCALAR ;
12+ SCALAR ,
13+ DIRECTIVE ;
1314
1415}
You can’t perform that action at this time.
0 commit comments