swagger - 为什么 Swagger Schema 中忽略了过滤器属性?
问题描述
我正在尝试构建一个简单的 Swagger 模型:
resources:
- kind: PlayersDB
api_version: players/v2
path: players
attributes:
...
status:
- name: status
type: string
x-extensible-enum: [HEALTHY, INJURED]
...
example: HEALTHY
required: true
filters:
- type: SearchFilter
strategy: exact
include_on:
- list
由于某种原因,生成的 HTML 不会在查询参数下呈现状态过滤器。这让我觉得我没有正确地做到这一点。
也就是说,当我将架构编辑为:
resources:
- kind: PlayersDB
api_version: players/v2
path: players
attributes:
...
status:
- name: status
type: string
x-extensible-enum: [HEALTHY, INJURED]
...
example: HEALTHY
required: true
filters:
- property: status
type: SearchFilter
field: status
strategy: exact
example: HEALTHY
include_on:
- list
过滤器被渲染。
一些上下文:对于我正在使用的 spec.yaml -> html redoc-cli
(这是 OpenAPI 的 CLI 工具 -> html 包)。
问题是是否可以渲染 #1 或者 OpenAPI 格式不支持它?
我确实阅读了https://swagger.io/docs/specification/adding-examples/Object and Property Examples
上的部分,但没有找到很多与过滤器相关的信息。
解决方案
推荐阅读
- swift - 在 MGLAnnotationImage 中添加手势识别器?
- r - 在管道 purrr 匿名函数调用中迭代列出的数据帧
- android - 为什么文本元素居中以及如何在 Dart 中将其与右侧对齐
- javascript - 给定注入的开始和结束索引,如何将 HTML 标记注入字符串?
- wordpress - Wordpress:从我的主题中的插件导入 scss
- python - 如何在 SQLAlchemy 数据库中正确定义图像并在数据库之间创建关系?
- nginx - nginx 和代理通道中的多个位置块
- c++ - 如何打印n之后的第b个素数?
- mysql - 联合所有字段,只给我一列
- javascript - 试图用 Intersection Observer 绘制谷歌图表