Yaml OpenAPI 3中的XSD选择等价物
我正在OpenAPI中构建一个API,并希望构建与此XSD等效的东西:Yaml OpenAPI 3中的XSD选择等价物,yaml,swagger,openapi,Yaml,Swagger,Openapi,我正在OpenAPI中构建一个API,并希望构建与此XSD等效的东西: <xs:complexType name="InputData"> <xs:complexContent> <xs:sequence> <xs:element name="input1" type="string" minOccurs="1" maxOcc
<xs:complexType name="InputData">
<xs:complexContent>
<xs:sequence>
<xs:element name="input1" type="string" minOccurs="1" maxOccurs="1"/>
<xs:element name="input2" type="double" minOccurs="1" maxOccurs="1"/>
<xs:choice>
<xs:element name="input3A" type="my:dataType" minOccurs="1" maxOccurs="1"/>
<xs:element name="input3B" type="my:dataType" minOccurs="1" maxOccurs="1"/>
</xs:choice>
</xs:sequence>
</xs:complexContent>
</xs:complexType>
但是,它不允许名称input3A
或input3B
指定我提供的输入
有什么帮助吗?这里相当于您的XSD:
组件:
模式:
MyDataType:
类型:对象
特性:
第1段:
类型:字符串
第2段:
类型:编号
输入数据:
所有:
-类型:对象
特性:
输入1:
类型:字符串
输入2:
类型:字符串
必需:[输入1,输入2]
-类型:对象
其中一项:
-特性:
输入3a:
$ref:“#/components/schemas/MyDataType”
必需:[输入3a]
-特性:
输入3b:
$ref:“#/components/schemas/MyDataType”
必需:[input3B]
这里相当于您的XSD:
组件:
模式:
MyDataType:
类型:对象
特性:
第1段:
类型:字符串
第2段:
类型:编号
输入数据:
所有:
-类型:对象
特性:
输入1:
类型:字符串
输入2:
类型:字符串
必需:[输入1,输入2]
-类型:对象
其中一项:
-特性:
输入3a:
$ref:“#/components/schemas/MyDataType”
必需:[输入3a]
-特性:
输入3b:
$ref:“#/components/schemas/MyDataType”
必需:[input3B]
components:
schemas:
MyDataType:
type: object
properties:
val1:
type: string
val2:
type: number
InputData:
type: object
properties:
input1:
type: string
input2:
type: string
input3:
oneOf:
- $ref: '#/components/schemas/MyDataType'
- $ref: '#/components/schemas/MyDataType'