【发布时间】:2021-07-18 10:13:37
【问题描述】:
我需要修改 yaml 文件中一种特定模式的所有实例。具有任何枚举和字符串的架构,我需要删除字符串并只留下枚举。 所以从这里:
components:
schemas:
//a lot of different schemas
NotificationMethod:
anyOf:
- type: string
enum:
- PERIODIC
- ONE_TIME
- ON_EVENT_DETECTION
- type: string
description: >
This string provides forward-compatibility with future
extensions to the enumeration but is not used to encode
content defined in the present version of this API.
description: >
Possible values are
- PERIODIC
- ONE_TIME
- ON_EVENT_DETECTION
我需要收到这个:
components:
schemas:
//a lot of different schemas
NotificationMethod:
type: string
enum:
- PERIODIC
- ONE_TIME
- ON_EVENT_DETECTION
description: >
Possible values are
- PERIODIC
- ONE_TIME
- ON_EVENT_DETECTION
- 此类更正仅应在具有 anyOf 且具有 2 个选项的架构中进行:字符串和枚举。
- 带有 anyOf 的行被删除。
- “-”(破折号和空格)之前留下的“类型”被删除。
- 在有叶类型规范的每一行中,两个空格被删除。
- 键入“string”,它的描述就会被删除。
怎么做?
【问题讨论】: