From 0faae407a9ee74244734d97e757a284972f95ad2 Mon Sep 17 00:00:00 2001 From: Abhimanyu Singh Gaur <12651351+abhimanyusinghgaur@users.noreply.github.com> Date: Fri, 21 Aug 2020 16:54:14 +0530 Subject: [PATCH] docs: add info about __typename in custom DQL (#6248) Reference: [Discuss Post](https://discuss.dgraph.io/t/custom-dql-typename-bug-strange-behaviour/9341) --- wiki/content/graphql/custom/graphqlpm.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wiki/content/graphql/custom/graphqlpm.md b/wiki/content/graphql/custom/graphqlpm.md index 8a5fbf0a67b..a488508ac64 100644 --- a/wiki/content/graphql/custom/graphqlpm.md +++ b/wiki/content/graphql/custom/graphqlpm.md @@ -93,10 +93,12 @@ query { ``` There are following points to note while specifying the DQL query for such custom resolvers: + * The name of the DQL query that you want to map to the GraphQL response, should be same as the name of the GraphQL query. * You must use proper aliases inside DQL queries to map them to the GraphQL response. * If you are using variables in DQL queries, their names should be same as the name of the arguments for the GrapqhQL query. * For variables, only scalar GraphQL arguments like Boolean, Int, Float etc are allowed. Lists and Object types are not allowed to be used as variables with DQL queries. * You would be able to query only those many levels with GraphQL which you have mapped with the DQL query. For instance, in the first custom query above, we haven't mapped an author's tweets to GraphQL alias, so, we won't be able to fetch author's tweets using that query. +* If the custom GraphQL query returns an interface, and you want to use `__typename` in GraphQL query, then you should add `dgraph.type` as a field in DQL query without any alias. This is not required for types, only for interfaces. --- \ No newline at end of file