-
Notifications
You must be signed in to change notification settings - Fork 182
Open
Labels
featureNew addition or enhancement to existing solutionsNew addition or enhancement to existing solutionsgood first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.graphql.js
Description
Issue Labels
- has-reproduction
- feature
- [] docs
- blocking
- good first issue
/label graphql.js
graphql-tag claims to be a utility for graphql, but doesn't have any indication on how to use it with graphql package. Sure enough the result from graphql-tag might be valid AST, but the I don't think that the specifications really make any mention of queries being in AST format. Graphql doesn't support gql objects as query parameter.
const someQuery = gql`
query { something { else } }
`
console.log(someQuery.toString()); // "[object Object]"
graphql(schema, someQuery); // Fails.
someQuery.toString() = function() { return this.loc.source; };
console.log(someQuery.toString()); // Proper query string.
graphql(schema, someQuery); // Works.
This should be really easy to implement with the objects returned by the template stringy adding a custom toString() -function to them. Currently the default is always returns "[object Object]".
If above change is unacceptable, there should be documentation how to properly retrieve the query in string form.
kabo, mxmzb, bwilczek, darren128, marc-money and 11 moreGeoffreyHervet
Metadata
Metadata
Assignees
Labels
featureNew addition or enhancement to existing solutionsNew addition or enhancement to existing solutionsgood first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.graphql.js