Skip to content

Commit 2be79c2

Browse files
committed
Remove configuration key for GraphQL schema path
Currently, the GraphQL schema is exposed under /graphql/schema (so relative to the main graphql endpoint) and is configurable with the `spring.graphql.schema.printer.path` configuration property. We think we should make the schema location more consistent to help tools and various Gateway products. Also, we don't see right now a strong use case for such a configuration property. This commit removes the configuration property and sets the schema location under `/graphql/schema`(`/graphql` being the main graphql path configured by the application). Closes gh-79
1 parent 9a23e5f commit 2be79c2

File tree

4 files changed

+4
-19
lines changed

4 files changed

+4
-19
lines changed

graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQlProperties.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,6 @@ public static class Printer {
9898
*/
9999
private boolean enabled = false;
100100

101-
/**
102-
* Path under the main GraphQL path where the schema is exposed.
103-
*/
104-
private String path = "/schema";
105-
106101
public boolean isEnabled() {
107102
return this.enabled;
108103
}
@@ -111,14 +106,6 @@ public void setEnabled(boolean enabled) {
111106
this.enabled = enabled;
112107
}
113108

114-
public String getPath() {
115-
return this.path;
116-
}
117-
118-
public void setPath(String path) {
119-
this.path = path;
120-
}
121-
122109
}
123110

124111
}

graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQlWebFluxAutoConfiguration.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.util.stream.Collectors;
2121

2222
import graphql.GraphQL;
23-
import graphql.schema.idl.SchemaPrinter;
2423
import org.apache.commons.logging.Log;
2524
import org.apache.commons.logging.LogFactory;
2625

@@ -115,8 +114,7 @@ public RouterFunction<ServerResponse> graphQlEndpoint(GraphQlHttpHandler handler
115114

116115
if (properties.getSchema().getPrinter().isEnabled()) {
117116
SchemaHandler schemaHandler = new SchemaHandler(graphQlSource);
118-
String schemaPath = properties.getSchema().getPrinter().getPath();
119-
builder = builder.GET(graphQLPath + schemaPath, schemaHandler::handleRequest);
117+
builder = builder.GET(graphQLPath + "/schema", schemaHandler::handleRequest);
120118
}
121119

122120
return builder.build();

graphql-spring-boot-starter/src/main/java/org/springframework/graphql/boot/GraphQlWebMvcAutoConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ public RouterFunction<ServerResponse> graphQlRouterFunction(GraphQlHttpHandler h
124124

125125
if (properties.getSchema().getPrinter().isEnabled()) {
126126
SchemaHandler schemaHandler = new SchemaHandler(graphQlSource);
127-
String schemaPath = properties.getSchema().getPrinter().getPath();
128-
builder = builder.GET(graphQLPath + schemaPath, schemaHandler::handleRequest);
127+
builder = builder.GET(graphQLPath + "/schema", schemaHandler::handleRequest);
129128
}
130129

131130
return builder.build();

spring-graphql-docs/src/docs/asciidoc/index.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ schema locations to check as follows:
183183
spring.graphql.schema.locations=classpath:graphql/
184184
----
185185

186-
The GraphQL schema can be viewed over HTTP at "/graphql/schema", if enabled:
186+
The GraphQL schema can be viewed over HTTP at "/graphql/schema", relative to the main graphql endpoint path.
187+
It is disabled by default:
187188

188189
[source,properties,indent=0,subs="verbatim,quotes"]
189190
----

0 commit comments

Comments
 (0)