swagger - OpenAPI 3.0:字段的可编辑性 - 动态
问题描述
是否可以在 openapi 3.0 中动态设置字段的可编辑性?
以下是解决方法的示例:
FooBar:
description: |
This type defines a type FooBar.
type: object
properties:
myNumber:
type: EditableNumber
description: The number that should be editable dynamically.
EditableNumber:
description: |
This type defines an editable number.
type: object
properties:
value:
type: number
description: The actual value
editable:
type: boolean
description: whether the field is editable.
required:
- value
但是做这样的事情会更好:
FooBar:
description: |
This type defines a type FooBar.
type: object
properties:
myNumber:
type: number
description: The number that should be editable dynamically.
readonly: true/false
但是真/假不能动态设置,对吧?
或者在没有解决方法的情况下还有其他可能吗?
谢谢
解决方案
推荐阅读
- sql - Presto SQL - 基于 unix 时间戳的每个用户每个通道的每日最新用户事务
- raspberry-pi3 - 如何在树莓派 3 上启用自动登录
- python - 优化模型,索引组件导致的跳过错误
- c# - 在 ABP.IO 中继承或实现 AuditedAggregateRoot 或实体时,是否有任何方法可以指定 Id 属性名称?
- c++ - 如何在 sfml 中使用鼠标指针旋转方形对象?
- javascript - 如何在nodejs中将函数结果打印到浏览器中?
- javascript - 无法通过 querySelectorAll("class") 获取元素,工厂函数中分配的类
- django-rest-framework - wagtail get_api_representation() 未调用
- java - 使用 GSON 时将 json NaN 序列化为 null
- javascript - 无法使用 vis js 中的配置面板更改颜色