java - 如何在 OAS 3.1.0 中定义要在构建中生成的具有不同名称和值的枚举?
问题描述
在 Java 中,很容易创建一个像
public enum EnumType {
TYPE_A ("Some text for type A"),
TYPE_B ("Some text for type B"),
TYPE_C ("Some text for type C")
}
我希望能够使用 OpenAPI 规范创建类似的结构。
如果名称和值与 相同,这将很容易:
openapi: 3.1.0
(...)
components:
schemas:
EnumType:
enum: [ TYPE_A,
TYPE_B,
TYPE_C
]
但是如何使用 OpenAPI 来做到这一点?IntelliJ 将不允许const
下面片段中的属性,说它是被禁止的。
openapi: 3.1.0
(...)
components:
schemas:
EnumType:
oneOf:
- title: TYPE_A
const: 'Some text for type A'
- title: TYPE_B
const: 'Some text for type B'
- title: TYPE_C
const: 'Some text for type C'
提前致谢,
解决方案
推荐阅读
- microsoft-graph-api - 对于具有 URL 编码文件名的项目,如何通过路径获取 Sharepoint/OneDrive 驱动器项目
- java - ORACLE WLS 基础设施安装错误
- python - 从具有开始和结束日期的数据框列生成日期范围
- angular - 使用角度 10 中的纬度和经度从当前位置获取用户地址
- r - R - 创建假人来评估星期几的效果
- reactjs - 当我尝试使用 AuthProvider 和 useAuth 时出现白色空白屏幕(react + firebase)
- reporting-services - 是否可以选择在第一页隐藏页眉并根据 ssrs 报告中的页码显示剩余页面
- gitlab - GITLAB:将脚本输出保存在变量 .gitlab-ci.yml 中
- r - 如何设置 4 位日期?
- r - xy.coords(x, y) 中的逻辑回归错误:“x”和“y”长度不同