Skip to content

Conversation

yaacovCR
Copy link
Contributor

@yaacovCR yaacovCR commented Jun 22, 2021

  1. pass named arguments to buildExecutionContext so that ExecutionArgs or SubscriptionArgs can be simply passed through
  2. move assertValidExecutionArguments into buildExecutionContext, as only used there.
  3. streamline returnType by throwing a GraphQLAggregateError with any processing errors rthar than returning either ExecutionContext or an array of GraphQLErrors.

Motivation: these changes significantly slim down execute/subscribe, paving the way for refactoring the execution methods into a class where the constructor uses to buildExecutionContext to set up the executionContext (or its constituent properties) as class member(s).

Depends on #3195

@yaacovCR yaacovCR force-pushed the throw-on-build-error branch from fa39d24 to cf57d46 Compare June 22, 2021 14:30
@yaacovCR yaacovCR changed the title refactor: throw GraphQLAggregateErrors from buildExecutionContext refactor: streamline buildExecutionContext Jun 22, 2021
@yaacovCR yaacovCR requested a review from IvanGoncharov June 22, 2021 14:58
@yaacovCR yaacovCR force-pushed the consolidate-subscription branch 3 times, most recently from ec4518e to dc88bcf Compare October 4, 2021 14:02
@yaacovCR yaacovCR force-pushed the throw-on-build-error branch from a3c2256 to 92912b4 Compare October 4, 2021 15:26
All operations, including subscription operations, are covered by the execution section of the GraphQL spec
...and executeQueryOrMutationRootFields

to prepare for integration of executeSubscription
this function currently does not throw GraphQLErrors -- it is not within the parallel try block within execute
@yaacovCR yaacovCR force-pushed the consolidate-subscription branch from dc88bcf to 112feed Compare October 5, 2021 18:05
to executeSubscriptionRootField
to operate only on ExecutionContext
-- In at least a few cases, destructuring assignment from exeContext can improve code readability.
-- Overrides to exeContext can be set using object spread syntax.
@yaacovCR yaacovCR force-pushed the consolidate-subscription branch from 112feed to 83a7f41 Compare October 5, 2021 18:10
@yaacovCR yaacovCR force-pushed the throw-on-build-error branch 5 times, most recently from 9b99e35 to 9cab1b5 Compare October 6, 2021 21:38
@yaacovCR
Copy link
Contributor Author

yaacovCR commented Oct 6, 2021

@IvanGoncharov , this is ready for review. based on the feedback to #3192, I have abandoned the throw on build error approach (despite the retained name of the branch) and am now basically going at least initially with @glasser suggestion #3169 (comment) to separate out the document normalization and variable coercion steps from the main execute flow.

Execution arguments object can be passes as-is to the function.
assertValidExecutionArguments can be called within the function rather
than prior
...capable of processing requests of all operation types.

ExecutionArgs now augmented with all relevant arguments for
subscriptions as well.
existing flow hid the execution request spec portion within the
execution context object setup -- the algorithm steps belong within the
function itself.
@yaacovCR yaacovCR force-pushed the throw-on-build-error branch from 9cab1b5 to ec09843 Compare October 6, 2021 21:49
@yaacovCR yaacovCR force-pushed the consolidate-subscription branch from 535e210 to 758d31e Compare October 7, 2021 14:51
@yaacovCR
Copy link
Contributor Author

yaacovCR commented Oct 7, 2021

Closed this in favor of PR stack 3293 => 3302.

@yaacovCR yaacovCR closed this Oct 7, 2021
@yaacovCR yaacovCR deleted the throw-on-build-error branch October 7, 2021 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant