Polishing

This commit is contained in:
Rossen Stoyanchev
2021-05-21 15:34:02 +01:00
parent cd8f4b672f
commit eb88697b83
2 changed files with 8 additions and 4 deletions

View File

@@ -87,9 +87,11 @@ public class WebFluxGraphQlAutoConfiguration {
.GET(path, req -> ServerResponse.ok().bodyValue(resource))
.POST(path, accept(MediaType.APPLICATION_JSON).and(contentType(MediaType.APPLICATION_JSON)), handler::handleRequest);
if (properties.getSchema().getPrinter().isEnabled()) {
SchemaPrinter schemaPrinter = new SchemaPrinter();
SchemaPrinter printer = new SchemaPrinter();
builder = builder.GET(path + properties.getSchema().getPrinter().getPath(),
req -> ServerResponse.ok().contentType(MediaType.TEXT_PLAIN).bodyValue(schemaPrinter.print(graphQlSource.schema())));
req -> ServerResponse.ok()
.contentType(MediaType.TEXT_PLAIN)
.bodyValue(printer.print(graphQlSource.schema())));
}
return builder.build();
}

View File

@@ -93,9 +93,11 @@ public class WebMvcGraphQlAutoConfiguration {
.GET(path, req -> ServerResponse.ok().body(resource))
.POST(path, contentType(MediaType.APPLICATION_JSON).and(accept(MediaType.APPLICATION_JSON)), handler::handleRequest);
if (properties.getSchema().getPrinter().isEnabled()) {
SchemaPrinter schemaPrinter = new SchemaPrinter();
SchemaPrinter printer = new SchemaPrinter();
builder = builder.GET(path + properties.getSchema().getPrinter().getPath(),
req -> ServerResponse.ok().contentType(MediaType.TEXT_PLAIN).body(schemaPrinter.print(graphQlSource.schema())));
req -> ServerResponse.ok()
.contentType(MediaType.TEXT_PLAIN)
.body(printer.print(graphQlSource.schema())));
}
return builder.build();
}