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

Feat/graphiql plugins #892 #893

Merged
merged 13 commits into from Oct 20, 2022

Conversation

codeflyer
Copy link
Contributor

@codeflyer codeflyer commented Oct 14, 2022

Allow injection of graphiql plugins in the configuration of a mercurius server:

app.register(mercurius, {
  schema,
  resolvers,
  graphiql: {
    enabled: true,
    plugins: [
      {
        name: 'samplePlugin',
        props: {},
        umdUrl: 'http://localhost:3000/graphiql/sample.js',
        fetcherWrapper: 'parseFetchResponse'
      }
    ]
  }
})

Closes #892

Copy link
Contributor

@ilteoood ilteoood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

static/main.js Outdated Show resolved Hide resolved
static/main.js Outdated Show resolved Hide resolved
Copy link
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

docs/api/options.md Outdated Show resolved Hide resolved
docs/api/options.md Outdated Show resolved Hide resolved
docs/api/options.md Outdated Show resolved Hide resolved
docs/api/options.md Outdated Show resolved Hide resolved
docs/integrations/create-graphiql-plugin.md Outdated Show resolved Hide resolved
docs/api/options.md Show resolved Hide resolved
docs/integrations/create-graphiql-plugin.md Outdated Show resolved Hide resolved
examples/graphiql-plugin.js Outdated Show resolved Hide resolved
examples/graphiql-plugin.js Outdated Show resolved Hide resolved
lib/routes.js Outdated Show resolved Hide resolved
Copy link
Collaborator

@simoneb simoneb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


```javascript
// examples/graphiql-plugin
node ./index.js
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this isn't JS code (use sh for formatting properly) and you can omit "./"

examples/graphiql-plugin/README.md Outdated Show resolved Hide resolved

```javascript
app.get('/graphiql/samplePlugin.js', (req, reply) => {
reply.sendFile('samplePlugin.js')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method on the reply comes from fastify/static, doesn't it? I wouldn't make the assumption that people know. either use a different method or make it more explicit where it's coming from

examples/graphiql-plugin/README.md Show resolved Hide resolved
lib/routes.js Show resolved Hide resolved
Co-authored-by: Simone Busoli <simone.busoli@gmail.com>
@mcollina
Copy link
Collaborator

@simoneb can this land? I'd like to ship a release soon.

@mcollina mcollina merged commit 93b35d1 into mercurius-js:master Oct 20, 2022
@simoneb
Copy link
Collaborator

simoneb commented Oct 20, 2022

good to go 👌

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

Successfully merging this pull request may close these issues.

Allow internal graphiql to add custom plugin
5 participants