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
This commit is contained in:
@@ -98,11 +98,6 @@ public class GraphQlProperties {
|
||||
*/
|
||||
private boolean enabled = false;
|
||||
|
||||
/**
|
||||
* Path under the main GraphQL path where the schema is exposed.
|
||||
*/
|
||||
private String path = "/schema";
|
||||
|
||||
public boolean isEnabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
@@ -111,14 +106,6 @@ public class GraphQlProperties {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.util.Collections;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import graphql.GraphQL;
|
||||
import graphql.schema.idl.SchemaPrinter;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -115,8 +114,7 @@ public class GraphQlWebFluxAutoConfiguration {
|
||||
|
||||
if (properties.getSchema().getPrinter().isEnabled()) {
|
||||
SchemaHandler schemaHandler = new SchemaHandler(graphQlSource);
|
||||
String schemaPath = properties.getSchema().getPrinter().getPath();
|
||||
builder = builder.GET(graphQLPath + schemaPath, schemaHandler::handleRequest);
|
||||
builder = builder.GET(graphQLPath + "/schema", schemaHandler::handleRequest);
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
|
||||
@@ -124,8 +124,7 @@ public class GraphQlWebMvcAutoConfiguration {
|
||||
|
||||
if (properties.getSchema().getPrinter().isEnabled()) {
|
||||
SchemaHandler schemaHandler = new SchemaHandler(graphQlSource);
|
||||
String schemaPath = properties.getSchema().getPrinter().getPath();
|
||||
builder = builder.GET(graphQLPath + schemaPath, schemaHandler::handleRequest);
|
||||
builder = builder.GET(graphQLPath + "/schema", schemaHandler::handleRequest);
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
|
||||
@@ -183,7 +183,8 @@ schema locations to check as follows:
|
||||
spring.graphql.schema.locations=classpath:graphql/
|
||||
----
|
||||
|
||||
The GraphQL schema can be viewed over HTTP at "/graphql/schema", if enabled:
|
||||
The GraphQL schema can be viewed over HTTP at "/graphql/schema", relative to the main graphql endpoint path.
|
||||
It is disabled by default:
|
||||
|
||||
[source,properties,indent=0,subs="verbatim,quotes"]
|
||||
----
|
||||
|
||||
Reference in New Issue
Block a user