Schema Snippet:
type Relationship {
id: ID!
name: String!
type: RelationshipCategory!
meta: [RelationshipMeta]
of: Contact
to: Contact
}
type RelationshipMeta implements SettingACL {
forRelationship: Relationship! @hasInverse(field: meta)
}
type RelationshipCategory implements Tag {
usedIn: [Relationship] @hasInverse(field: type)
}
interface SettingACL {
id: ID!
name: ControlledSetting! @hasInverse(field: usedIn)
isTrue: Boolean
}
interface Tag {
id: ID!
slug: String
name: String
}
type ControlledSetting {
id: ID!
name: String!
usedIn: [SettingACL]
}
type Contact {
id: ID!
name: String
relationshipTo: [Relationship] @hasInverse(field: of)
relationshipOf: [Relationship] @hasInverse(field: to)
}
I inserted some data using this mutation:
mutation {
addRelationship(input: [{
name: "Staff"
type: { id: "0x225f22" }
of: { id: "0x111" }
to: { id: "0x222" }
meta: [{
name: { id: "0x20d86b" }
isTrue: true
}]
}]) { numUids }
}
Now I want to find that relationship based upon the ControlledSetting "0x20d86b"
So I have tried this:
query {
getControlledSetting(id:"0x20d86b") {
id
name
usedIn {
forRelationship {
to {
id
}
}
}
}
}
But this gives the error:
Cannot query field âforRelationshipâ on type âSettingACLâ. Did you mean to use an inline fragment on âRelationshipMetaâ?
So I tried to use the inline fragment instead:
{
getControlledSetting(id:"0x20d86b") {
id
name
usedIn(first: 10) {
...on RelationshipMeta {
forRelationship {
id
}
}
}
}
}
And I get the following error:
Non-nullable field âforRelationshipâ (type Relationship!) was not present in result from Dgraph. GraphQL error propagation triggered.
This data should not be null because it should have been set in the mutation above.
Can someone point me in the direction of what I have done incorrectly here?