Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

feature idea - Remove graphql-js dependency and pass text of GraphQL query instead of AST to execute #185

Open
robrichard opened this issue Oct 27, 2017 · 1 comment

Comments

@robrichard
Copy link
Contributor

The Apollo Link execute function currently requires a GraphQL query AST generated by the graphql-js library. Would it be better to accept a GraphQL query string? Links that need the AST could import graphql-js and parse it. Looking through the modules in this repo, most links are just calling print on the AST to get the query string.

For some of the use cases in the README (GraphiQL, Relay Modern) you have a query string and need to import graphql-js to parse it, only for Link to re-print it almost immediately. In the Relay Modern case, this means loading the rather large graphql-js module on the client just for that purpose. Maybe this dependency can be dropped from apollo-link?

@syrusakbary
Copy link

I really like the abstraction that apollo-link and it's relatives holds.

However there is no real need of requiring a full graphql parser + engine into the network link by itself.
At the end queries that are sent over the wire will be with either a text string or a query id.

Because of that I think it might be useful to move the dependency of the graphql-tag and graphql over to Apollo Client or it's cache mechanisms (in the one that, for example, injects a __typename into each of the selectionsets).

Could be possible to remove the graphql-tag and graphql dependency from this packages?

@stubailo @jbaxleyiii @martijnwalraven

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

No branches or pull requests

3 participants