如何使用jaxrs-spec的OpenAPI Generator生成异步式式方法?
我需要生成使用 jaxrs-spec 生成器。我看到生成器支持 JAX-RS 2.1 CompletionStage 风格的开箱即用异步生成(请参阅 supportAsync ),但它似乎不支持 JAX-RS 2.0 < code>AsyncResponse 风格。不幸的是,我需要使用 AsyncResponse
样式,因为我使用的 Web 框架不支持 CompletionStage
方法。
如何说服 OpenAPI 生成器以这种方式生成方法?我正在使用 Maven 插件,以防有所作为。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终使用模板自定义解决了这个问题。我在 GitHub 上写下了整个过程,以防万一它对其他人都有帮助。如果您想使用 OpenAPI Generator 生成具有
AsyncResponse
式异步处理的服务接口,那么该项目应该开箱即用。如果您需要进行任何其他类型的 OpenAPI Generator 模板自定义,那么这应该是一个有用的入门示例。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.