OneGraph / graphiql-explorer

Explorer plugin for GraphiQL
MIT License
907 stars 97 forks source link

Can we have a template for this amazing tool? #70

Open dliusc opened 3 years ago

dliusc commented 3 years ago

First of all, thanks for making this amazing tool. I wonder if we could have some way that can be easily used to integrate this into an endpoint. E.g.

https://github.com/graphql-go/handler/blob/master/graphiql.go#L72

https://github.sc-corp.net/Snapchat/miniprogram/blob/d164b721bff78e461912c0a66d6ac3183ed724eb/vendor/github.com/99designs/gqlgen/graphql/playground/playground.go#L8-L8

sgrove commented 3 years ago

Sure, that's a fair request! We actually have https://github.com/OneGraph/graphiql-with-extensions so that you can just include one <script ... tag to e.g. unpkg and get GraphiQL with the explorer plugin, if that's a bit easier.

sgrove commented 3 years ago

Also, if you'd like help integrating the explorer more naturally, also up to pair - it usually takes < 20 minutes, depending on how deeply nested the graphiql dependency is.

dliusc commented 3 years ago

Thanks! I tried https://github.com/OneGraph/graphiql-with-extensions/blob/master/examples/static.html it works well. One more thing, is there any config option that allow me to edit the header from the UI? Like this below image

rhengles commented 3 years ago

Sure, that's a fair request! We actually have https://github.com/OneGraph/graphiql-with-extensions so that you can just include one <script ... tag to e.g. unpkg and get GraphiQL with the explorer plugin, if that's a bit easier.

@sgrove That's a great find! I suffered a week with webpack trying to reacreate this, a static script that I could just call and use it directly.

However I do have one problem - with my integration, it is generating a call for IntrospectionQuery that fills the GraphiQL Explorer. With the static script above the explorer panel is just empty. How can I have it load the schema from the fetcher?

Edit: Nvm, I got it working, my fetchURL was broken and I didn't see the error in the console...