【发布时间】:2023-02-11 08:44:14
【问题描述】:
我正在尝试使用 OpenAPI 在 micronaut 应用程序中从 Java 对象和控制器构建 REST API。我注意到 DTO 的最终成员被排除在生成的描述符之外(在运行的应用程序中为 swagger-ui.html),但我不明白为什么。
使用此代码,所有成员都会出现在 API 中。
public class Overview {
public String status;
public Table table1;
public Table table2;
}
components:
schemas:
Overview:
type: object
properties:
status:
type: string
table1:
$ref: '#/components/schemas/Table'
table2:
$ref: '#/components/schemas/Table'
对于这个,只有第一个成员是可见的。
public class Overview {
public String status;
public final Table table1;
public final Table table2;
}
components:
schemas:
Overview:
type: object
properties:
status:
type: string
【问题讨论】: