【发布时间】:2020-08-07 04:28:37
【问题描述】:
到目前为止的旅程
我正在尝试使用 RESTEasy 和 JSON-B,按照 official guide 启动并运行反应式 REST 服务。 我还添加了对 OpenAPI 的支持,用于测试 this guide 之后的服务。
这两个部分独立工作,服务正确返回硬编码的演示数据。 Swagger UI 显示可用的路由并允许调用它们。
然而,它并不像我喜欢的那样流畅......
从简单的非反应式路由中,模式已被正确提取:
Fruit:
type: object
properties:
description:
type: string
name:
type: string
但是从响应式路由中提取了空模式。比如介绍
@GET
@Path("/{name}")
public Uni<Fruit> getOne(@PathParam(value = "name") String name) {
}
导致架构:
UniFruit:
type: object
有没有办法重用现有的Fruit 架构?
我尝试注释路线,但没有任何效果:
@GET
@Path("/{name}")
// @Schema(ref = "#/components/schemas/Fruit") // Nope...
// @Schema(ref = "Fruit") // Nope...
public Uni<Fruit> getOne(@PathParam(value = "name") String name) {
}
理想情况下,无论如何我都不想单独注释每个反应式方法。
问题
当路由返回Uni<T> 或Multi<T> 时,有没有办法配置项目范围 使用T 的架构?
【问题讨论】:
-
这是 Quarkus 应该解决的问题。感谢您的发现! github.com/quarkusio/quarkus/issues/8811