OneGraph / graphiql-explorer

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

Add a fetcher prop #22

Open alanpoulain opened 5 years ago

alanpoulain commented 5 years ago

Like GraphiQL, we should be able to give the fetcher instead of the schema.

sgrove commented 5 years ago

@alanpoulain This seems like a decent idea, but want to make sure I understand the use-case.

Is this for people using graphiql-explorer outside of GraphiQL?

alanpoulain commented 5 years ago

No, it's not. It allows to avoid to write this:

    fetcher({
      query: getIntrospectionQuery()
    }).then(result => {
      this.setState({ schema: buildClientSchema(result.data) });
    });
  }

This can be useful in some situations (for instance in this PR https://github.com/api-platform/core/pull/2951, we cannot use the graphql package).

alanpoulain commented 5 years ago

It has been rebased.