-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
area/graphqlIssues related to GraphQL support on Dgraph.Issues related to GraphQL support on Dgraph.
Description
latest:master
Have you tried reproducing the issue with the latest release?
Yes
What is the hardware spec (RAM, OS)?
doesn't matter
Case-1
Steps to reproduce the issue (command/config used to run Dgraph).
- Add following graphql schema:
interface People { id: ID! xid: String! @id name: String! } type Teacher implements People { teaches: [Student] } type Student implements People { taughtBy: [Teacher] }
- Perform following mutation:
mutation { addStudent(input: [{ xid: "S1" name: "George" taughtBy: [{ xid: "T1" name: "Seinfeld" teaches: [{xid: "S2", name: "Kramer"}] }] }]) { student { id xid name taughtBy { id xid name teaches { id xid name } } } } }
- And we get what we expect:
{ "data": { "addStudent": { "student": [ { "id": "0x3", "xid": "S1", "name": "George", "taughtBy": [ { "id": "0x4", "xid": "T1", "name": "Seinfeld", "teaches": [ { "id": "0x2", "xid": "S2", "name": "Kramer" } ] } ] } ] } } } - But, now perform following mutation:
mutation { addStudent(input: [{ xid: "S3" name: "Elaine" taughtBy: [{ xid: "T1" name: "Seinfeld" teaches: [{xid: "S4", name: "Newman"}] }] }]) { student { id xid name taughtBy { id xid name teaches { id xid name } } } } }
Expected behaviour and actual result.
Expected Behaviour
We should be getting both Kramer and Newman in the teaches list for Seinfeld.
{
"data": {
"addStudent": {
"student": [
{
"id": "0x6",
"xid": "S3",
"name": "Elaine",
"taughtBy": [
{
"id": "0x4",
"xid": "T1",
"name": "Seinfeld",
"teaches": [
{
"id": "0x2",
"xid": "S2",
"name": "Kramer"
},
{
"id": "0x5",
"xid": "S4",
"name": "Newman"
}
]
}
]
}
]
}
}
}Actual Result
We are getting only Kramer, which was added in the first mutation. Newman is not created at all.
{
"data": {
"addStudent": {
"student": [
{
"id": "0x5",
"xid": "S3",
"name": "Elaine",
"taughtBy": [
{
"id": "0x4",
"xid": "T1",
"name": "Seinfeld",
"teaches": [
{
"id": "0x2",
"xid": "S2",
"name": "Kramer"
}
]
}
]
}
]
}
}
}Case-2
Steps to reproduce the issue (command/config used to run Dgraph).
- Continue from Case-1, same schema, and the mutations performed.
- Now perform following update mutation:
mutation { updateStudent(input: { filter: { xid: {eq: "S1"} } set: { taughtBy: [{ xid: "T1" name: "Seinfeld" teaches: [{xid: "S5", name: "Peterman"}] }] } }) { student { id xid name taughtBy { id xid name teaches { id xid name } } } } }
Expected behaviour and actual result.
Expected Behaviour
It should have updated the teaches list for Seinfeld to have Peterman as well.
{
"data": {
"updateStudent": {
"student": [
{
"id": "0x3",
"xid": "S1",
"name": "George",
"taughtBy": [
{
"id": "0x4",
"xid": "T1",
"name": "Seinfeld",
"teaches": [
{
"id": "0x2",
"xid": "S2",
"name": "Kramer"
},
{
"id": "0x5",
"xid": "S5",
"name": "Peterman"
}
]
}
]
}
]
}
}
}Actual Result
We are getting only Kramer, which was added in the first mutation. Peterman is not created at all.
{
"data": {
"updateStudent": {
"student": [
{
"id": "0x3",
"xid": "S1",
"name": "George",
"taughtBy": [
{
"id": "0x4",
"xid": "T1",
"name": "Seinfeld",
"teaches": [
{
"id": "0x2",
"xid": "S2",
"name": "Kramer"
}
]
}
]
}
]
}
}
}Metadata
Metadata
Assignees
Labels
area/graphqlIssues related to GraphQL support on Dgraph.Issues related to GraphQL support on Dgraph.