-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Graphql batch resolver #293
Graphql batch resolver #293
Conversation
I've added batch resolvers that contact a service contract via RESTful API to demonstrate batch resolving for distributed setup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to promote this approach as advanced functionality. After some time we will be able to evaluate acceptance rate and make further strategy adjustments.
Please do not make Batch resolver a requirement and do not enforce its usage via static tests.
/** | ||
* @return array|null | ||
*/ | ||
public function getValue(): ?array; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comprehensive description to the getters.
/** | ||
* Resolve multiple brunches/leaves by executing a batch service contract. | ||
*/ | ||
interface BatchContractResolverInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the following change makes sense
interface BatchContractResolverInterface | |
interface BatchServiceContractResolverInterface |
* @return object | ||
* @throws GraphQlInputException | ||
*/ | ||
public function convertToArgument(ResolveRequestInterface $request); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
public function convertToArgument(ResolveRequestInterface $request); | |
public function prepareRequest(ResolveRequestInterface $request); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't usually use request
with regard to class/service contract arguments. prepareArgument
perhaps?
Co-Authored-By: Alex Paliarush <paliarus@adobe.com>
… graphql-batch-resolver
…rkun/architecture into graphql-batch-resolver
* @return ResolveInfo | ||
*/ | ||
public function getInfo(): ResolveInfo; | ||
|
||
/** | ||
* Data passed from upper resolvers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the parent resolver
Problem
Current ResolverInterface does provide tools nor steer developers into creation of fast batch resolvers. By introducing new BatchResolverInterface developers will receive an array of values and arguments to resolve data for in optimal never without requiring them to mess with callbacks
and duplicated values and arguments gathering and promises management logic.
Solution
Introduce BatchResolverInterface, manage promises and create batches of values and arguments on
framework level. Deprecate existing interface
Requested Reviewers
@paliarush