type Query {
content (query: Query!): Content!
}
type Content {
minions: Mold!
bosses: [FormattedNote]!
}
type FormattedNote {
id: Int!
status: Int!
note: String!
content: String!
descendentsSums: [Int!]!
}
type Mold {
notes: [BossNoteMold]!
}
type BossNoteMold {
bossId: Int!
noteId: Int!
ordinal: Int!
owner: Int!
}
I am aware that parent nodes are resolved first. Therefore in the above mentioned schema. Content
field will be resolved first. Therefore my question is, will field id
be resolved before field notes
? From what I understand minions
and bosses
are resolved asynchronously and therefor whether id
or notes
is resolved first is dependent on which parent is resolved first. Right?
The resolver order will be:
content
(query)Content.minions
and Content.bosses
in parallel
…
minions
should return a single Mold
object. That object will then resolve its notes
field which will return an array of BossNoteMold
typesbosses
should return an array of FormattedNote
objects. Each one of those will then fire its field resolvers
There is little predictability in the order of operations after #1 as all these happen asynchronously and take various amounts of time depending on the complexity of each resolver.
The resolvers for the fields of a FormattedNote
should have no dependency on the resolvers for a Mold
type and vice-versa as neither are parents of the other.
Note: your model for the BossNoteMold
type refers to IDs of related objects. It is more customary to refer to the related objects directly. Ex:
type BossNoteMold {
boss: Boss!
note: Note!
ordinal: Int!
owner: User!
}
In other words link to related objects by value instead of by reference (id). Referring by ID is a SQL practice that doesn't need to carry over to your GraphQL model.