Skip to content
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

Possibility to add "GraphiQL Explorer"? #451

Closed
varasinp opened this issue Nov 11, 2020 · 6 comments
Closed

Possibility to add "GraphiQL Explorer"? #451

varasinp opened this issue Nov 11, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@varasinp
Copy link

I would like to know if there is a plan to include GraphiQL Explorer (part of GraphiQL).
GraphiQL Explorer is very useful. It allows users to point and click on GraphQL node and it auto-generate the query.
Here's the example of GraphiQL Explorer https://api.spacex.land/graphql/

@varasinp varasinp changed the title Possibility to add "GraphiQL Explorer" Possibility to add "GraphiQL Explorer"? Nov 11, 2020
@sungam3r sungam3r added the enhancement New feature or request label Nov 11, 2020
@sungam3r
Copy link
Member

I've seen this UI somewhere. GraphiQL middleware just returns "simple" html - https://github.com/graphql-dotnet/server/blob/master/src/Ui.GraphiQL/Internal/graphiql.cshtml. I am not an expert in JS and frontend. Do you know how to change html? Are more serious server side changes required to support this functionality?

@varasinp
Copy link
Author

varasinp commented Nov 11, 2020

Sorry, I'm not an expert when it comes to front-end stuff like JavaScript or TypeScript. However, I don't believe there's a need to change a lot of code on the server-side. I believe only the GraphiQL version update is required.

I look into the "graphiql.cshtml" file that you mentioned and I noticed this (line 42 & 43)

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/graphiql/0.13.0/graphiql.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/graphiql/0.13.0/graphiql.min.js"></script>

As you can see, the graphiql version is "0.13.0" which is the older version. Maybe all that needs to be done is just to use the latest version which is "1.0.6"? https://cdnjs.com/libraries/graphiql

So line 42 & 43 in "graphiql.cshtml" should be modified to use version "1.0.6" instead probably. I hope that will do it but I didn't try that myself just yet.

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/graphiql/1.0.6/graphiql.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/graphiql/1.0.6/graphiql.min.js"></script>

I went to the https://github.com/graphql/graphiql and I saw this picture. They specify GraphiQL Explorer as an external key (not sure what that means).

Latest Stable Ecosystem

GraphiQL

If this work, maybe others UI (Altair, Playground, Voyager) need a version update also probably?

@varasinp
Copy link
Author

Just want to confirm that upgraded GraphiQL from version 0.13.0 to 1.0.6 did not add the GraphiQL Explorer to the GraphiQL UI.
The HTML body section of this file you mentioned https://github.com/graphql-dotnet/server/blob/master/src/Ui.GraphiQL/Internal/graphiql.cshtml needs to be updated to include the explorer.

@imolorhe
Copy link
Contributor

It should only require frontend changes, no change required on the server side. I could help to add it to GraphiQL.

Ps: It should be available in Altair GraphQL as a beta plugin.

Screenshot 2020-11-18 at 1 51 15 AM

imolorhe added a commit to imolorhe/server that referenced this issue Nov 21, 2020
This replaces the default GraphiQL
with one that includes GraphiQL explorer

Addresses graphql-dotnet#451
@imolorhe
Copy link
Contributor

Created the PR for GraphiQL

@sungam3r
Copy link
Member

Done in #455
https://github.com/graphql-dotnet/server/releases/tag/4.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants