Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 794 Bytes

field-resolver-protocol.rst

File metadata and controls

18 lines (13 loc) · 794 Bytes

FieldResolver Protocol

In the majority of cases, a field resolver is simply a function that accepts the three parameters: context, args, and value.

However, when structuring large systems using Component (or any similar approach), this can be inconvienient, as it does not make it possible to structure field resolvers as components.

The resolve/FieldResolver protocol addresses this: it defines a single method, resolve-value. This method is the analog of an ordinary field resolver function.

The support for this protocol is baked directly into schema/compile.

Just like field resolver functions, FieldResolver instances can resolve a value directly by returning it, or can return a ResolverResult.