From de763b836dfc601957ed74ff95130450a02bd575 Mon Sep 17 00:00:00 2001 From: Yaacov Rydzinski Date: Thu, 7 Dec 2023 06:08:08 +0200 Subject: [PATCH] enhance(ResolveFieldValue): add async collection language and some baseline collection language for comparison extracted from #742 Authored-by: Rob Richard --- spec/Section 6 -- Execution.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/spec/Section 6 -- Execution.md b/spec/Section 6 -- Execution.md index f357069f9..d5b79cd43 100644 --- a/spec/Section 6 -- Execution.md +++ b/spec/Section 6 -- Execution.md @@ -644,23 +644,27 @@ must only allow usage of variables of appropriate types. While nearly all of GraphQL execution can be described generically, ultimately the internal system exposing the GraphQL interface must provide values. This is exposed via {ResolveFieldValue}, which produces a value for a given field on a -type for a real value. +type for a real value. As an example, this might accept the {objectType} +`Person`, the {field} {"soulMate"}, and the {objectValue} representing John +Lennon. It would be expected to yield the value representing Yoko Ono. -As an example, this might accept the {objectType} `Person`, the {field} -{"soulMate"}, and the {objectValue} representing John Lennon. It would be -expected to yield the value representing Yoko Ono. +List values are resolved similarly. For example, {ResolveFieldValue} might also +accept the {objectType} `MusicBand`, the {field} {"members"}, and the +{objectValue} representing the Beatles. It would be expected to yield a +collection of values representing John Lennon, Paul McCartney, Ringo Starr and +George Harrison. ResolveFieldValue(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}. - -Note: 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. + {argumentValues}. Note: 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. In addition, an implementation for collections + may leverage asynchronous iterators or asynchronous generators provided by + many programming languages. ### Value Completion