dgs-framework icon indicating copy to clipboard operation
dgs-framework copied to clipboard

fix: GraphiQL may render broken and cannot be fully disabled

Open foo4u opened this issue 2 years ago • 2 comments

Pull request checklist

  • [x] Please read our contributor guide
  • [x] Consider creating a discussion on the discussion forum first
  • [x] Make sure the PR doesn't introduce backward compatibility issues
  • [x] Make sure to have sufficient test cases: tests cases already exist to cover not enabling GraphiQL for both MVC and WebFlux. However, the auto configuration for automatic resource discovery is not enabled on such tests. If you'd like this PR to be updated with static resource loading enabled I can do that.

Pull Request type

  • [x] Bugfix

Changes in this PR

Fix a few issues with GraphiQL:

  • Issue #1135
  • Fix an issue where dgs.graphql.graphiql.enabled is not recognized as a valid configuration option with WebFlux
  • Allow GraphiQL to be fully disabled, even if spring.web.resources.add-mappings it set to true (the default)

Alternatives considered

DGS_GRAPHQL_PATH is sometimes unset because there's a race condition between Spring's built in static resource handler and DGS' GraphiQL handlers in both Spring MVC and WebFlux. The alternative option to changing the path for graphiql would be to force applications to configure spring.web.resources.add-mappings to false; it defaults to true.

PR #1167 from another contributor, also says it fixes #1135. However, it looks like a different potential issue related non-ASCII data in queries, rather than a fix for this bug.

foo4u avatar Aug 05 '22 23:08 foo4u

@srinivasankavitha any way to get 👀 on this?

foo4u avatar Sep 05 '22 00:09 foo4u

Hi @srinivasankavitha , I answered your questions and rebased this on master. It should be ready. 🙏 Thank you!

foo4u avatar Sep 30 '22 13:09 foo4u