[Bug] Deleting interfaces is breaking inverse relationships

When using the delete mutation for interfaces, inverse relationships of implementing types are not correctly handled.

Schema:

type Foo {
    id: String! @id
    bars: [Bar!]! @hasInverse(field: foo)
}

interface Cuid {
    id: String! @id
}

type Bar implements Cuid {
    foo: Foo!
}

Add Foo with Bar:

mutation {
  addFoo(input: { id: "foo", bars: [{ id: "bar" }] }) {
    numUids
  }
}

Delete Bar:

mutation {
  deleteCuid(filter: { id: { eq: "bar" } }) {
    msg
  }
}

Query Foo and Bars:

query {
  queryFoo {
    id
    bars {
      id
    }
  }
}

Error:

Non-nullable field 'id' (type String!) was not present in result from Dgraph.  GraphQL error propagation triggered.
"path": [
        "queryFoo",
        0,
        "bars",
        0,
        "id"
]

When using the deleteBar mutation instead, the inverse relationship is correctly deleted.

Iā€™d expect the deleteCuid mutation to do the same.

1 Like

Hi @maaft ,

Thanks for the bug report and for the simple reproducible example. I am able to reproduce this on master, 21.03 and 20.11.
I am accepting this as a bug. This will be fixed in coming days.

2 Likes

Hi @rajas ! Has this been fixed?