soap - openapi oneOf 的 WSDL 等效项是什么?
问题描述
目前我需要找出 openapi ( oneOf - openapi ) 中的 oneOf 在 WSDL 中的样子。oneOf 的定义是:
oneOf – 仅针对其中一个子模式验证值
如果 oneOf 文档说(JSON)对象应该仅对指定的模式之一有效。如果对象对多个模式有效,则它将无效/不正确。
不幸的是,我不是 WSDL 专家,所以我不确定您如何在 WSDL 中表示类似 oneOf 的内容。我以为我可以做这样的事情:
Openapi-示例
schemas:
fruit:
title: fruit
properties:
color:
type: string
oneOf:
- $ref: '#/components/schemas/apple' <- schema with property 'kind'
- $ref: '#/components/schemas/banana' <- schema with property 'count'
WSDL 等效
<xs:complexType name="Fruit">
<xs:sequence>
<xs:element minOccurs="0" name="color" type="xs:string" />
<xs:element minOccurs="0" name="apple" type="schemas:apple" />
<xs:element minOccurs="0" name="banana" type="schemas:banana" />
</xs:sequence>
</xs:complexType>
Or maybe this one
<xs:complexType name="Fruit">
<xs:sequence>
<xs:element minOccurs="0" name="color" type="xs:string" />
<xs:element minOccurs="0" name="kind" type="xs:string" />
<xs:element minOccurs="0" name="count" type="xs:double" />
</xs:sequence>
</xs:complexType>
也许这是一种变通方法,但即使两种 WSDL 构造都没有真正限制其中一种模式;如前所述,该对象应该仅对指定的模式之一有效。
有谁知道如何在 WSDL 中表示 oneOf?
解决方案
推荐阅读
- javascript - Angular - 在另一个数组中的数组中查找给定值
- libreoffice-basic - Libre office Basic 宏忽略了我添加到文件夹路径中的最后一个文件夹
- java - java.sql.SQLRecoverableException:IO 错误:网络适配器无法建立连接
- python - 无法在 gspread 中插入二维数组
- python - Pyomo:如何在 while 循环中创建具有不同名称的变量?
- python - 将字典中的字典中的字典中的浮点数转换为int in 字典中的列表
- python - 为什么我的函数使用局部变量而不是全局变量?
- python - 通过邮递员上传的二进制文件在我的烧瓶应用程序中已损坏
- git - 如何在结帐/克隆中包含被忽略的文件?
- batch-file - 如何删除每行文本的第一个“文本”