Skip to content
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

Field resolvers should also be subject to async APIs configuration #63

Closed
joffrey-bion opened this issue Apr 10, 2020 · 4 comments · Fixed by #66
Closed

Field resolvers should also be subject to async APIs configuration #63

joffrey-bion opened this issue Apr 10, 2020 · 4 comments · Fixed by #66
Assignees
Labels
bug Something isn't working

Comments

@joffrey-bion
Copy link
Contributor

Issue Description

The generated field resolvers currently don't respect the generateAsyncApis configuration parameter, although they are part of the API just like top-level resolvers.

Expected Result

When generateAsyncApis is enabled, field resolvers should have a return type wrapped in CompletableFuture as well.

Actual Result

Field resolvers just have a plain java type as return type.

@joffrey-bion joffrey-bion added the bug Something isn't working label Apr 10, 2020
@joffrey-bion joffrey-bion self-assigned this Apr 10, 2020
kobylynskyi pushed a commit that referenced this issue Apr 10, 2020
Conceptually, GraphQL operations (queries/mutations/subscriptions) are a
special case of field resolvers that happen to be on well known root types.

Technically, this means that everything about field resolvers is the same
as these root types resolvers, apart from the fact that the former get an
instance of the resolved type as first param.

Therefore, all the configuration that applies to field resolvers also
applies to resolvers of the fields that are part of these root types, like
CompletableFuture return type, or DataFetcherEnvironment parameter.

Resolves: #64
Resolves: #61
Resolves: #63

Co-authored-by: Joffrey Bion <joffrey.bion@booking.com>
@vinaybedre
Copy link

@kobylynskyi I dont see any documentation on how to use generateAsyncApis
Can you please let me know if this option is supported?

@joffrey-bion
Copy link
Contributor Author

@vinaybedre I think for more flexibility, this configuration has since been changed to apiReturnType, so you can specify any kind of return type, such as CompletableFuture:

This is what I have in my current Maven config:

<apiReturnType>java.util.concurrent.CompletableFuture</apiReturnType>

@vinaybedre
Copy link

@joffrey-bion Thanks for the hint.
Do you know is it possible to change return type of a specific field resolver?

@joffrey-bion
Copy link
Contributor Author

@vinaybedre I don't believe this is possible at the moment. But I'll let @kobylynskyi confirm that, as I haven't contributed here in a while

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants