mercurius-js / mercurius

Implement GraphQL servers and gateways with Fastify
https://mercurius.dev/
MIT License
2.35k stars 237 forks source link

Allow internal graphiql to add custom plugin #892

Closed codeflyer closed 2 years ago

codeflyer commented 2 years ago

The internal version of graphiql provided with mercurius loads the code from unpkg.com.

Allow to add graphiql plugin through the configuration of mercurius.

Eg.

{
      graphiql: {
        enabled: true,
        plugins: [
          {
            name: 'yourPlugin',
            props: {foo: 'bar'},
            umdUrl: 'https://unpkg.com/your-plugin@1.1.1/umd/yourplugin.production.min.js'
            fetcherWrapper: 'interceptResultFromFetch'
          }
        ]
      },
      schema,
      resolvers
    }
arkmech commented 2 years ago

Will type definitions be added for this? currently accepts boolean, "graphiql", and undefined

codeflyer commented 2 years ago

@arkmech

I've just opened an issue. I'll take care of it the next days. https://github.com/mercurius-js/mercurius/issues/903