From 124f9d899ad9e823d15aa128f32c7e16305dcfb0 Mon Sep 17 00:00:00 2001 From: James Hardwick Date: Thu, 30 May 2024 12:01:03 -0500 Subject: [PATCH 1/2] Replace GraphQL Playground w/ GraphiQL Fixes leangen/graphql-spqr-spring-boot-starter#139 --- .../spring/autoconfigure/SpqrProperties.java | 2 +- .../spqr/spring/web/GuiController.java | 2 +- .../src/main/resources/graphiql.html | 83 +++++++++++++++++++ .../src/main/resources/playground.html | 60 -------------- 4 files changed, 85 insertions(+), 62 deletions(-) create mode 100644 graphql-spqr-spring-boot-autoconfigure/src/main/resources/graphiql.html delete mode 100644 graphql-spqr-spring-boot-autoconfigure/src/main/resources/playground.html diff --git a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/autoconfigure/SpqrProperties.java b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/autoconfigure/SpqrProperties.java index 2c940e4..32afc99 100644 --- a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/autoconfigure/SpqrProperties.java +++ b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/autoconfigure/SpqrProperties.java @@ -279,7 +279,7 @@ public static class Gui { private String endpoint = DEFAULT_GUI_ENDPOINT; private String targetEndpoint; private String targetWsEndpoint; - private String pageTitle = "GraphQL Playground"; + private String pageTitle = "GraphiQL"; public boolean isEnabled() { return enabled; diff --git a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/GuiController.java b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/GuiController.java index 9652e7f..ac272e5 100644 --- a/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/GuiController.java +++ b/graphql-spqr-spring-boot-autoconfigure/src/main/java/io/leangen/graphql/spqr/spring/web/GuiController.java @@ -22,7 +22,7 @@ public GuiController(SpqrProperties config) { @ResponseBody @RequestMapping(value = "${graphql.spqr.gui.endpoint:/gui}", produces = "text/html; charset=utf-8") public String gui() throws IOException { - return StreamUtils.copyToString(new ClassPathResource("playground.html").getInputStream(), StandardCharsets.UTF_8) + return StreamUtils.copyToString(new ClassPathResource("graphiql.html").getInputStream(), StandardCharsets.UTF_8) .replace("${pageTitle}", config.getGui().getPageTitle()) .replace("${graphQLEndpoint}", config.getGui().getTargetEndpoint()) .replace("${webSocketEndpoint}", config.getGui().getTargetWsEndpoint()); diff --git a/graphql-spqr-spring-boot-autoconfigure/src/main/resources/graphiql.html b/graphql-spqr-spring-boot-autoconfigure/src/main/resources/graphiql.html new file mode 100644 index 0000000..f410ec0 --- /dev/null +++ b/graphql-spqr-spring-boot-autoconfigure/src/main/resources/graphiql.html @@ -0,0 +1,83 @@ + + + + + ${pageTitle} + + + + + + + + + + + + + + +
Loading...
+ + + diff --git a/graphql-spqr-spring-boot-autoconfigure/src/main/resources/playground.html b/graphql-spqr-spring-boot-autoconfigure/src/main/resources/playground.html deleted file mode 100644 index cc5c2e2..0000000 --- a/graphql-spqr-spring-boot-autoconfigure/src/main/resources/playground.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - ${pageTitle} - - - - - - -
- - -
Loading - GraphQL Playground -
-
- - - - \ No newline at end of file From a8019795f150e913a4a9854cc12da0b2871ab3fd Mon Sep 17 00:00:00 2001 From: James Hardwick Date: Thu, 30 May 2024 12:04:58 -0500 Subject: [PATCH 2/2] Correct docs --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d6ca385..6a83f7f 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ GraphQL SPQR Spring Boot starter aims to make it dead simple to add a GraphQL API to any Spring Boot project. * Add `@GraphQLApi` to any Spring managed component, and you're good to go 🚀 * GraphQL endpoint available at `/graphql` by default - * GraphQL Playground IDE (if enabled, see the properties below) available at `/ide` + * GraphiQL (if enabled, see the properties below) available at `/gui` * Fully customizable in seconds by providing simple beans (any SPQR SPI can be exposed as a bean) ## Project setup / Dependencies @@ -230,7 +230,7 @@ To do this SPQR uses `TypeInfoGenerator` on a global level. When using this star | graphql.spqr.gui.endpoint | /gui | | graphql.spqr.gui.target-endpoint | n/a | | graphql.spqr.gui.target-ws-endpoint | n/a | -| graphql.spqr.gui.page-title | GraphQL Playground | +| graphql.spqr.gui.page-title | GraphiQL | ### Customize mapping of GraphQL values to Java values