@@ -55,6 +55,8 @@ public class GraphQLFieldRetriever {
5555
5656 private DataFetcherConstructor dataFetcherConstructor ;
5757
58+ private boolean alwaysPrettify = false ;
59+
5860 public GraphQLFieldRetriever (DataFetcherConstructor dataFetcherConstructor ) {
5961 this .dataFetcherConstructor = dataFetcherConstructor ;
6062 }
@@ -66,7 +68,7 @@ public GraphQLFieldRetriever() {
6668 public GraphQLFieldDefinition getField (Method method , ProcessingElementsContainer container ) throws GraphQLAnnotationsException {
6769 GraphQLFieldDefinition .Builder builder = newFieldDefinition ();
6870 TypeFunction typeFunction = getTypeFunction (method , container );
69- builder .name (new MethodNameBuilder (method ).build ());
71+ builder .name (new MethodNameBuilder (method ).alwaysPrettify ( alwaysPrettify ). build ());
7072 GraphQLOutputType outputType = (GraphQLOutputType ) new MethodTypeBuilder (method , typeFunction , container , false ).build ();
7173
7274 boolean isConnection = ConnectionUtil .isConnection (method , outputType );
@@ -85,7 +87,7 @@ public GraphQLFieldDefinition getField(Method method, ProcessingElementsContaine
8587
8688 public GraphQLFieldDefinition getField (Field field , ProcessingElementsContainer container ) throws GraphQLAnnotationsException {
8789 GraphQLFieldDefinition .Builder builder = newFieldDefinition ();
88- builder .name (new FieldNameBuilder (field ).build ());
90+ builder .name (new FieldNameBuilder (field ).alwaysPrettify ( alwaysPrettify ). build ());
8991 TypeFunction typeFunction = getTypeFunction (field , container );
9092
9193 GraphQLType outputType = typeFunction .buildType (field .getType (), field .getAnnotatedType (), container );
@@ -104,15 +106,15 @@ public GraphQLFieldDefinition getField(Field field, ProcessingElementsContainer
104106
105107 public GraphQLInputObjectField getInputField (Method method , ProcessingElementsContainer container ) throws GraphQLAnnotationsException {
106108 GraphQLInputObjectField .Builder builder = newInputObjectField ();
107- builder .name (new MethodNameBuilder (method ).build ());
109+ builder .name (new MethodNameBuilder (method ).alwaysPrettify ( alwaysPrettify ). build ());
108110 TypeFunction typeFunction = getTypeFunction (method , container );
109111 GraphQLInputType inputType = (GraphQLInputType ) new MethodTypeBuilder (method , typeFunction , container , true ).build ();
110112 return builder .type (inputType ).description (new DescriptionBuilder (method ).build ()).build ();
111113 }
112114
113115 public GraphQLInputObjectField getInputField (Field field , ProcessingElementsContainer container ) throws GraphQLAnnotationsException {
114116 GraphQLInputObjectField .Builder builder = newInputObjectField ();
115- builder .name (new FieldNameBuilder (field ).build ());
117+ builder .name (new FieldNameBuilder (field ).alwaysPrettify ( alwaysPrettify ). build ());
116118 TypeFunction typeFunction = getTypeFunction (field , container );
117119 GraphQLType graphQLType = typeFunction .buildType (true , field .getType (), field .getAnnotatedType (), container );
118120 return builder .type ((GraphQLInputType ) graphQLType ).description (new DescriptionBuilder (field ).build ()).build ();
@@ -195,6 +197,10 @@ private GraphQLObjectType getActualType(GraphQLObjectType type, Map<String, grap
195197 return type ;
196198 }
197199
200+ public void setAlwaysPrettify (boolean alwaysPrettify ) {
201+ this .alwaysPrettify = alwaysPrettify ;
202+ }
203+
198204 @ Reference (policy = ReferencePolicy .DYNAMIC , policyOption = ReferencePolicyOption .GREEDY )
199205 public void setDataFetcherConstructor (DataFetcherConstructor dataFetcherConstructor ) {
200206 this .dataFetcherConstructor = dataFetcherConstructor ;
0 commit comments