Suppose I have a Schema like:
type A {
Id: ID
propA: String
}
type B {
Id: ID
propB: String
Links : [Link]
}
type Link {
propLink : String
propLink2 : String
nestedA: A
}
So basically B can link to A’s but each link from B to A carries some extra properties.
I want to update one B and remove all of the links to As that it contains. I tried first setting its ‘Links’ property to an empty array, like so:
mutation MyMutation {
updateB(input: {filter: {propB: {allofterms: "propB content"}}, set: {Links:[ ] }}) {
B {
Id
Links {
propLink
propLink2
A {
Id
}
}
}
}
}
But all of the links are still there after this mutation. Then I tried passing the exact instance of an ‘A’ I’d like to remove:
mutation MyMutation {
updateB(input: {filter: {propB: {allofterms: "propB content"}}, remove: {Links:[
{
propLink : "prop1"
propLink2: "prop2"
A {
Id: "0x4e12"
}
}
] }}) {
B {
Id
Links {
propLink
propLink2
A {
Id
}
}
}
}
}
And this responds with a panic:
{
"errors": [
{
"message": "Internal Server Error - a panic was trapped. This indicates a bug in the GraphQL server. A stack trace was logged. Please let us know by filing an issue with the stack trace."
}
]
}
Whats the right way to do what I need? Is there a better schema def to achieve this? Does each Link property need to have its own ID?