GraphQL __typename response on mutations differs in some cases

Hey Dgraph-Team,

first thank you all for the great product you provide :).

For my question:
Based on a mutation I get different respectively missing results for the type information.
Mutation 1

mutation m {
  addStuff(input: [
    { title: "Hello World!", user: "birnsen"}
  ])
  {
    __typename
  }
}

Result 1

{
  "data": {
    "addStuff": {
      "__typename": "AddStuffPayload"
    }
  }
}

Mutation 2

mutation m {
  addStuff(input: [
    { title: "Hello World!", user: "birnsen"}
  ])
  {
    note {
      id
      __typename
    }
    __typename
  }
}

Result 2

{
  "data": {
    "addStuff": {
      "note": [{
        "id": "0x15",
        "__typename": "Stuff"
      }]
    }
  }
}

Basically what I am missing is the "__typename": "AddStuffPayload" part in the second mutation.

I use the Docker image with the v2.0.0-beta tag

Is this expected behavior? Can I do something to get the missing type info?

Thanks in advance

Hi, thanks for reporting this.

Looks like a bug. The expected behaviour is for typename to work everywhere that it’s valid in GraphQL.

Can you please add a github issue. Report in that issue enough schema and example to reproduce the problem, and I’ll schedule it to be fixed asap.

I added the Issue: GraphQL __typename response on mutations differs in some cases · Issue #4925 · dgraph-io/dgraph · GitHub

Thank you :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.