How to generate AsyncResponse-style methods using OpenAPI Generator for jaxrs-spec?

624 Views Asked by At

I need to generate server-side service interfaces that perform asynchronous processing using the jaxrs-spec generator. I see that the generator supports JAX-RS 2.1 CompletionStage-style asynchronous generation out of the box (see supportAsync), but it does not seem to support JAX-RS 2.0 AsyncResponse-style. Unfortunately, I need to use the AsyncResponse style because the web framework I'm using doesn't support the CompletionStage approach.

How can I convince the OpenAPI Generator to generate methods this way? I'm using the maven plugin, in case that makes a difference.

1

There are 1 best solutions below

0
On

I ended up solving the problem using template customization. I wrote up the whole process on GitHub in case it can be helpful to anyone else. If you want to use the OpenAPI Generator to generate service interfaces with AsyncResponse-style asynchronous processing, then that project should work out of the box. If you need to do any other kind of OpenAPI Generator template customization, then that should be a useful example to get started.