Skip to content

Support custom type for Query and Mutation in async API generation #228

@sriio

Description

@sriio

Is your feature request related to a problem? Please describe.
As describe in the wiki, generateAsyncApi if is true return java.util.concurrent.CompletableFuture or subscriptionReturnType. That a bit equivocal cause you can understand it as it return subscriptionReturnType if is set (but that never the case for Query and Mutation as it always return CompletableFuture).

But in some project with Spring Webflux, it can be useful to have a Query interface that returns Mono or Flux rather than CompletableFuture but atm, we can't.

Describe the solution you'd like
To not break already implemented projects, add a new parameter in Codegen Options that define a custom return type for Query and Mutation interfaces.

If there is no value or empty value and generateAsyncApiis true, the plugin use CompletableFuture as default.

Describe alternatives you've considered
Wrap all CompletableFuture into Mono or Flux but it's kind of annoying

Additional context
Tested with :

  • Spring Webflux: 5.2.x
  • graphql-java-codegen: 2.2.0
  • Build tool: Maven

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions