This repository was archived by the owner on Dec 19, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +18
-21
lines changed
example-graphql-tools/src/main/resources
graphql-kickstart-spring-boot-autoconfigure-tools/src/main/java/graphql/kickstart/tools/boot Expand file tree Collapse file tree 3 files changed +18
-21
lines changed Original file line number Diff line number Diff line change 66graphql :
77 servlet :
88 exception-handlers-enabled : true
9- tracing-enabled : metrics-only
10- graphiql :
11- headers :
12- Authorization : " Bearer 05bd9a5f3fe0408f89520946b0fe1b06"
13- props :
14- variables :
15- headerEditorEnabled : true
16- logging :
17- level :
18- com :
19- oembedler :
20- moon :
21- graphql :
22- boot :
23- error : debug
9+ tools :
10+ introspection-enabled : false
Original file line number Diff line number Diff line change 1919import graphql .schema .GraphQLSchema ;
2020import graphql .schema .idl .SchemaDirectiveWiring ;
2121import graphql .schema .visibility .GraphqlFieldVisibility ;
22+ import graphql .schema .visibility .NoIntrospectionGraphqlFieldVisibility ;
2223import java .io .IOException ;
2324import java .util .List ;
2425import java .util .Optional ;
@@ -167,4 +168,12 @@ public PerFieldObjectMapperProvider perFieldObjectMapperProvider(ObjectMapper ob
167168 public GraphQLSchema graphQLSchema (SchemaParser schemaParser ) {
168169 return schemaParser .makeExecutableSchema ();
169170 }
171+
172+ @ Bean
173+ @ ConditionalOnProperty (value = "graphql.tools.introspection-enabled" , havingValue = "false" )
174+ GraphqlFieldVisibility disableIntrospection () {
175+ log .warn ("GraphQL introspection query disabled! This puts your server in contravention of the "
176+ + "GraphQL specification and expectations of most clients, so use this option with caution" );
177+ return new NoIntrospectionGraphqlFieldVisibility ();
178+ }
170179}
Original file line number Diff line number Diff line change 22
33import lombok .Data ;
44import org .springframework .boot .context .properties .ConfigurationProperties ;
5- import org .springframework .context .annotation .Configuration ;
65
76@ Data
87@ ConfigurationProperties (prefix = "graphql.tools" )
98class GraphQLToolsProperties {
109
11- private String schemaLocationPattern = "**/*.graphqls" ;
12- /** @deprecated Set graphql.tools.schema-parser-options.introspection-enabled instead */
13- @ Deprecated
14- private boolean introspectionEnabled = true ;
15- private boolean useDefaultObjectmapper = true ;
10+ private String schemaLocationPattern = "**/*.graphqls" ;
11+ /**
12+ * Enable or disable the introspection query. Disabling it puts your server in contravention of
13+ * the GraphQL specification and expectations of most clients, so use this option with caution
14+ */
15+ private boolean introspectionEnabled = true ;
16+ private boolean useDefaultObjectmapper = true ;
1617
1718}
You can’t perform that action at this time.
0 commit comments