Value Resolution
While nearly all of GraphQL execution can be described generically, ultimately the internal system exposing the GraphQL interface must provide values. This is exposed viaResolveFieldValue, which produces a value for a given field on a type for a real value.
As an example, this might accept theobjectTypePerson
, thefield"soulMate", and theobjectValuerepresenting John Lennon. It would be expected to yield the value representing Yoko Ono.
(
objectType
,
objectValue
,
fieldName
,
argumentValues
)
- Let resolver be the internal function provided by objectType for determining the resolved value of a field named fieldName .
- Return the result of calling resolver , providing objectValue and argumentValues .
It is common for
resolver
to be asynchronous due to relying on reading an underlying database or networked service to produce a value. This necessitates the rest of a GraphQL executor to handle an asynchronous execution flow.