【发布时间】:2020-08-29 15:15:18
【问题描述】:
我在 raml1.0 中有一个具有 4 个属性的类型,我需要实现这种情况: 四个属性中的两个仅独占存在,因此如果其中一个存在,则另一个不应该存在,并且如果它们都发生,则会向用户抛出适当的错误消息。
例如:
types:
TypeOne:
description: "Need the first two properties exist only mutually exclusively"
type: object
additionalProperties: false
properties:
Prop1:
description: "This is the first property"
type: string
required: true
Prop2:
description: "This should not exist if Prop1 exist"
type: String
required: true (only if Prop1 does not exist)
Prop3:
description: "This is optional if Prop1 exists"
type: string
required: false
Prop4:
description: "This is optional if Prop2 exists"
type: string
required: false
非常感谢任何帮助。顺便说一句,这些类型中的每一个都是一个复杂的对象。我这里只是为了演示而简化了。
【问题讨论】:
标签: raml-1.0