I am receiving this error because of a edge that did not pass auth rules.
For this use case, I want to make sure that Notes get added with authors. But I want to restrict Authors and Notes based upon a different rule set. So a user may be able to see the Note but not the author of the note. In my UI I can add in the missing author as Restricted Author. However the query fails because the Note is not returned with any authors. Basically I need a way to make the edge required for input but optional for query.
type Note @auth(
query: { rule: "query { queryNote(filter: {isPublic: true}){ id } }" }
# ...
) {
id:ID!
note: String
isPublic: boolean
by: Author!
forLocation: Location
}
type Author @auth(
query: { rule: "query { queryAuthor(filter: {isPublic: true}){ id } }" }
# ...
) {
id: ID!
name: String!
isPublic: boolean
authoredNotes: [Note] @hasInverse(field: by)
}
type Location {
id: ID!
name: String!
city: String
state: String
hasNotes: [Note] @hasInverse(field: forLocation)
}
This requires an author to be present when adding a note, but does not allow me to see notes where I do not have access to view the Author on the Note.by edge.
Not sure how to best handle this.
This produces a strange result when viewing the Note from a parent edge. If I query Locations and hasNotes and there are some notes that I do not have access to view the Note.by, that entire Note node will be an empty object instead of giving me the data that I do have access to see such as Note.note for example. This may be graphql normal way of handling missing required children though.
I know that when I made my own API I could make some fields required on input but not required on query. That is what I am needing here.