Report a GraphQL Bug
What edition and version of Dgraph are you using?
Edition:
- SlashGraphQL
- Dgraph (community edition/Dgraph Cloud)
BTW @MichelDiz these options ^ don’t make any sense for someone using Dgraph Cloud. What one are we really suppose to select? SlashGraphQL is no more and Dgraph Cloud is not the same thing as the community edition, right?
If you are using the community edition or enterprise edition of Dgraph, please list the version:
Dgraph Version
$ dgraph version
PASTE YOUR RESULTS HERE
Have you tried reproducing the issue with the latest release?
Yes, latest I have available on a brand new Cloud spinup.
Steps to reproduce the issue (paste the query/schema if possible)
type Contact {
id: ID!
name: String! @id
category: [Category] @hasInverse(field:"contacts")
}
type Category {
id: ID!
name: String! @id
contacts: [Contact]
}
mutation addData {
addContact(input: [
{
name:"foo",
category:[
{name:"a"}
{name:"b"}
]
},{
name:"bar",
category:[
{name:"a"},
{name:"c"}
]
}
]) {
contact {
name
category {
name
}
}
}
}
mutation deleteAllCatsFromFoo {
updateContact(input: {
filter: {name:{eq:"foo"}}
remove: {category:null}
}) {
contact {
name
category {
name
}
}
}
}
Expected behaviour and actual result.
I expect to delete all categories with results for data.updateContact.contact = []
but instead I still see the categories there.
I have tried:
remove: {category:null}
: mutation updateContact failed because Dgraph execution failed because Got unsupported type for list: Contact.category
remove: {category: []}
: no error, but not deleted.
remove: {category: [null]}
: mutation updateContact failed because Dgraph execution failed because Got unsupported type for list: Contact.category
Also please notice that none of these will throw a type error by any parsing client, but only throws errors on the server. If the S-P-*
method is no longer supported by any means on GraphQL then the generated types should be changed to:
input ContactPatch {
category: [CategoryRef!] # notice the ! inside the list
}
then the errors thrown on the server would also trigger warnings by clients parsing the schema