Skip to content

Consider graphiQL integration #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bclozel opened this issue Nov 13, 2020 · 3 comments
Closed

Consider graphiQL integration #20

bclozel opened this issue Nov 13, 2020 · 3 comments
Assignees
Labels
status: declined A suggestion or change that we don't feel we should currently apply type: task A general task

Comments

@bclozel
Copy link
Member

bclozel commented Nov 13, 2020

As of #12, we're shipping a very simple graphiQL integration with spring-graphql. The current version ships a single HTML page that depends on static resources on 3rd party CDNs, with well-known front-end libraries.

There are several issues with it that we should discuss:

  • this is the simplest version of a graphiQL integration, we could use a JS package manager to build a more efficient, self-contained version
  • the versions of the front-end libraries are hard-coded in the HTML page
  • there is currently no way to customize or override this page
  • the need/opportunities for customizations on that page
  • whether this should ship with spring-graphql or some separate module
@marceloverdijk
Copy link
Contributor

Nice to add this, but it - at least for prod - it should be opt-in.

@rstoyanchev rstoyanchev added this to the 1.0 Backlog milestone May 20, 2021
@bclozel
Copy link
Member Author

bclozel commented Jun 29, 2021

In the meantime, we're considering a specific security configuration for GraphiQL (see #38) and we've made it more configurable (see #70).

jvalkeal added a commit to jvalkeal/spring-graphql that referenced this issue Nov 27, 2021
- Drop existing single page cdn integration from boot project.
- Create new `spring-graphql-graphiql` module containing `graphiql` integration.
- Makes `graphiql` optional which user can pull in as a dependency.
- `spring-graphql-graphiql` is a basic npm module which packages itself as
  a jar where boot autoconfig can integrate to.
- In a npm module graphiql itself is handled as a plain react app which allows
  some customisation like setting logo name to demonstrate how things are passed
  from boot properties into a react app itself.
- GraphiQlHandler's are changed to handle all traffic into `/graphiql` order to:
  - Handling main html in `/graphiql/explorer`
  - Redirect to `/graphiql/explorer` to get context path under `/graphiql/`
  - Handle `main.js` from classpath to get html to load it under `/graphiql/`
  - Handle `config.js` as a way to pass configuration options from server side
    and load those into react app. There are various long threads in GH and SO
    discussing this problem and I chose to load settings from a server side.
- Samples webmvc-http and webflux-websocket are changed to use this module.
  - `webmvc-http` is as it used to be.
  - `webflux-websocket` can now use subscription which gets first greeting instead
    of subscription request reply.
- Fixes spring-projects#20
- Fixes spring-projects#131
jvalkeal added a commit to jvalkeal/spring-graphql that referenced this issue Nov 28, 2021
- Drop existing single page cdn integration from boot project.
- Create new `spring-graphql-graphiql` module containing `graphiql` integration.
- Makes `graphiql` optional which user can pull in as a dependency.
- `spring-graphql-graphiql` is a basic npm module which packages itself as
  a jar where boot autoconfig can integrate to.
- In a npm module graphiql itself is handled as a plain react app which allows
  some customisation like setting logo name to demonstrate how things are passed
  from boot properties into a react app itself.
- GraphiQlHandler's are changed to handle all traffic into `/graphiql` order to:
  - Handling main html in `/graphiql/explorer`
  - Redirect to `/graphiql/explorer` to get context path under `/graphiql/`
  - Handle `main.js` from classpath to get html to load it under `/graphiql/`
  - Handle `config.js` as a way to pass configuration options from server side
    and load those into react app. There are various long threads in GH and SO
    discussing this problem and I chose to load settings from a server side.
- Samples webmvc-http and webflux-websocket are changed to use this module.
  - `webmvc-http` is as it used to be.
  - `webflux-websocket` can now use subscription which gets first greeting instead
    of subscription request reply.
- Fixes spring-projects#20
- Fixes spring-projects#131
@bclozel
Copy link
Member Author

bclozel commented Dec 2, 2021

The initial approach we took, embedding an HTML page that depends on static resources hosted on CDNs seems to work pretty well so far. We've evolved the configuration and features quite a bit since and I don't think this has shown strong limitations.

We'll keep this strategy and won't commit to a custom GraphiQL build with more advanced features for now.

@bclozel bclozel closed this as completed Dec 2, 2021
@bclozel bclozel added the status: declined A suggestion or change that we don't feel we should currently apply label Dec 2, 2021
@bclozel bclozel removed this from the 1.0 Backlog milestone Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply type: task A general task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants