From 9fdc12a38be1cf8064c8d213a2475a2fd097e563 Mon Sep 17 00:00:00 2001 From: Scott Rossillo Date: Fri, 5 Aug 2022 18:09:42 -0400 Subject: [PATCH 1/2] Fix issues with graphiql on reactive DGS --- .../autoconfiguration/DgsWebfluxConfigurationProperties.kt | 1 + .../graphql/dgs/webflux/autoconfiguration/GraphiQlConfigurer.kt | 2 +- .../src/main/resources/{static => }/graphiql/index.html | 0 3 files changed, 2 insertions(+), 1 deletion(-) rename graphql-dgs-spring-webflux-autoconfigure/src/main/resources/{static => }/graphiql/index.html (100%) diff --git a/graphql-dgs-spring-webflux-autoconfigure/src/main/kotlin/com/netflix/graphql/dgs/webflux/autoconfiguration/DgsWebfluxConfigurationProperties.kt b/graphql-dgs-spring-webflux-autoconfigure/src/main/kotlin/com/netflix/graphql/dgs/webflux/autoconfiguration/DgsWebfluxConfigurationProperties.kt index 7d107db5c..5015a6391 100644 --- a/graphql-dgs-spring-webflux-autoconfigure/src/main/kotlin/com/netflix/graphql/dgs/webflux/autoconfiguration/DgsWebfluxConfigurationProperties.kt +++ b/graphql-dgs-spring-webflux-autoconfigure/src/main/kotlin/com/netflix/graphql/dgs/webflux/autoconfiguration/DgsWebfluxConfigurationProperties.kt @@ -48,6 +48,7 @@ class DgsWebfluxConfigurationProperties( * Configuration properties for the GraphiQL endpoint. */ data class DgsGraphiQLConfigurationProperties( + @DefaultValue("true") var enabled: Boolean = true, /** Path to the GraphiQL endpoint without trailing slash. */ @DefaultValue("/graphiql") var path: String = "/graphiql", /** GraphiQL title */ diff --git a/graphql-dgs-spring-webflux-autoconfigure/src/main/kotlin/com/netflix/graphql/dgs/webflux/autoconfiguration/GraphiQlConfigurer.kt b/graphql-dgs-spring-webflux-autoconfigure/src/main/kotlin/com/netflix/graphql/dgs/webflux/autoconfiguration/GraphiQlConfigurer.kt index daf144eed..4725c2b86 100644 --- a/graphql-dgs-spring-webflux-autoconfigure/src/main/kotlin/com/netflix/graphql/dgs/webflux/autoconfiguration/GraphiQlConfigurer.kt +++ b/graphql-dgs-spring-webflux-autoconfigure/src/main/kotlin/com/netflix/graphql/dgs/webflux/autoconfiguration/GraphiQlConfigurer.kt @@ -35,7 +35,7 @@ class GraphiQlConfigurer(private val configProps: DgsWebfluxConfigurationPropert val graphiQLTitle = configProps.graphiql.title registry .addResourceHandler(configProps.graphiql.path + "/**") - .addResourceLocations("classpath:/static/graphiql/") + .addResourceLocations("classpath:/graphiql/") .resourceChain(true) .addResolver(PathResourceResolver()) .addTransformer(TokenReplacingTransformer(mapOf("" to graphqlPath, "" to graphiQLTitle), configProps)) diff --git a/graphql-dgs-spring-webflux-autoconfigure/src/main/resources/static/graphiql/index.html b/graphql-dgs-spring-webflux-autoconfigure/src/main/resources/graphiql/index.html similarity index 100% rename from graphql-dgs-spring-webflux-autoconfigure/src/main/resources/static/graphiql/index.html rename to graphql-dgs-spring-webflux-autoconfigure/src/main/resources/graphiql/index.html From 6741dc3319bf06f338aa1057707b8e87e6892fae Mon Sep 17 00:00:00 2001 From: Scott Rossillo Date: Fri, 5 Aug 2022 18:53:35 -0400 Subject: [PATCH 2/2] Fix graphiql on webmvc --- .../graphql/dgs/webmvc/autoconfigure/GraphiQLConfigurer.kt | 2 +- .../src/main/resources/{static => }/graphiql/index.html | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename graphql-dgs-spring-webmvc-autoconfigure/src/main/resources/{static => }/graphiql/index.html (100%) diff --git a/graphql-dgs-spring-webmvc-autoconfigure/src/main/kotlin/com/netflix/graphql/dgs/webmvc/autoconfigure/GraphiQLConfigurer.kt b/graphql-dgs-spring-webmvc-autoconfigure/src/main/kotlin/com/netflix/graphql/dgs/webmvc/autoconfigure/GraphiQLConfigurer.kt index ba6c66fd4..c86a77422 100644 --- a/graphql-dgs-spring-webmvc-autoconfigure/src/main/kotlin/com/netflix/graphql/dgs/webmvc/autoconfigure/GraphiQLConfigurer.kt +++ b/graphql-dgs-spring-webmvc-autoconfigure/src/main/kotlin/com/netflix/graphql/dgs/webmvc/autoconfigure/GraphiQLConfigurer.kt @@ -53,7 +53,7 @@ open class GraphiQLConfigurer( logger.info("Configuring GraphiQL to use GraphQL endpoint at '{}'", graphqlPath) registry .addResourceHandler("/graphiql/**") - .addResourceLocations("classpath:/static/graphiql/") + .addResourceLocations("classpath:/graphiql/") .setCachePeriod(3600) .resourceChain(true) .addResolver(PathResourceResolver()) diff --git a/graphql-dgs-spring-webmvc-autoconfigure/src/main/resources/static/graphiql/index.html b/graphql-dgs-spring-webmvc-autoconfigure/src/main/resources/graphiql/index.html similarity index 100% rename from graphql-dgs-spring-webmvc-autoconfigure/src/main/resources/static/graphiql/index.html rename to graphql-dgs-spring-webmvc-autoconfigure/src/main/resources/graphiql/index.html