Я создаю API в OpenAPI и хочу создать что-то, что эквивалентно этому XSD:
<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>
самое близкое, что я могу найти, это:
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'
Но, он не позволяет именам input3A
или input3B
указывать, какой ввод я предоставляю.
Любая помощь?