Closed carld closed 7 years ago
I've found the TODO in fields_on_correct_type.clj
...
Just for any passer by, to prevent Apollo from adding __typename
to queries, it can be disabled with an option passed to the ApolloClient constructor
const networkInterface = createNetworkInterface({ uri: 'http://localhost:3002/graphql' });
+const addTypename = false;
const client = new ApolloClient({
- networkInterface,
+ networkInterface,
+ addTypename
});
I'll leave the issue open for now in case anyone wants to add thoughts on how to implement __typename
in graphql-clj.
Thanks @carld for reporting this issue. We are working on the next version of graphql-clj, which you can find it from here https://github.com/tendant/graphql-clj/tree/new-ast. We plan to support this in the new version.
@tendant Awesome thanks, great work! 👍
The GraphQL spec (https://github.com/facebook/graphql/blob/af50a0a7e4fec972a6b7e1f8aaa518e41b459116/README.md) mentions that the special field
__typename
is defined on every object, and it appears this is not supported in graphql-clj 0.1.20.I would never have noticed except the Apollo client automatically adds the
__typename
field to queries, and my graphql-clj based app is returning:I'm a clojure noob so any suggestions much appreciated
Thanks