-
Notifications
You must be signed in to change notification settings - Fork 923
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
Add GraphQL setter to GraphqlServiceBuilder #5269
Conversation
Motivation: A user might want to set `GraphQL` directly to the `GraphqlServiceBuilder`. Modification: - Add the setter method for `GraphQL`. Result: - You can now set `GraphQL` to the `GraphqlServiceBuilder`.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5269 +/- ##
============================================
- Coverage 74.05% 73.91% -0.14%
+ Complexity 21253 20082 -1171
============================================
Files 1850 1728 -122
Lines 78600 74113 -4487
Branches 10032 9457 -575
============================================
- Hits 58209 54784 -3425
+ Misses 15686 14837 -849
+ Partials 4705 4492 -213 ☔ View full report in Codecov by Sentry. |
// Others | ||
private boolean useBlockingTaskExecutor; | ||
@Nullable | ||
private GraphqlErrorHandler errorHandler; |
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.
The two properties are only provided by Armeria and the majority are necessary to build GraphQL
. Too many checkState()
looks messy. How about moving properties used to build GraphQL
to GraphqlBuilder
?
GraphqlService
.builder()
.graphql() // Return GraphqlBuilder
.schema(...)
.dataLoaderRegistry(...)
.and() // Return GraphqlServiceBuilder
.useBlockingTaskExecutor(true);
.bulid();
GraphqlService
.builder()
.graphql(graphql) // Directly inject GraphQL
.useBlockingTaskExecutor(true);
.bulid()
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 was actually thinking about it but GraphQL
provides its own builder via new GraphQL.Builder()
.
Also, I found out that our builder, which is GraphqlServiceBuilder
, does not provide all setters that the GraphQL
provides. I think there's always a mismatch unless we keep up with the upstream change.
So I was rather thinking deprecating the setters:
https://github.com/line/armeria/pull/5269/files#diff-6b64ad742ab0aa687e003b83510d32495d933e5b3fd2a2236184d6f01bbfcc50R109-R110
Too many checkState() looks messy.
Yes, but we need it anyway because we can't just remove the setters after deprecating them. 😉
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.
So I was rather deprecating the setters:
I agree with this idea.
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've deprecated all the setters. PTAL. 🙇
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.
Thanks @minwoox ! 🙇 👍 🙇
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.
Thanks for cleaning up! 🙇♂️🙇♂️
Motivation: A user might want to set `GraphQL` directly to the `GraphqlServiceBuilder` which could be shared between Expedia `GraphQLRequestHandler` and Armeria's `GraphqlService`. Modification: - Add the setter method for `GraphQL`. Result: - You can now set `GraphQL` to the `GraphqlServiceBuilder`.
Motivation:
A user might want to set
GraphQL
directly to theGraphqlServiceBuilder
which could be sharedbetween Expedia
GraphQLRequestHandler
and Armeria'sGraphqlService
.Modification:
GraphQL
.Result:
GraphQL
to theGraphqlServiceBuilder
.