在 OAS 3.0 中,对于 url 编码表单数据的请求正文的 anyOf 不会在招摇的 UI 中呈现明显的输入



connexion==2.3.0 swagger-ui-bundle==0.0.5 OAS 3.0

开放 APi 规范中的"anyOf"不会向请求正文中的字段/元素呈现任何有用的输入。 生成的 curl 请求采用错误的键:值

"components": {
"requestBodies": {
"customEventBody": {[enter image description here][1]
"content": {
"application/x-www-form-urlencoded":{
"schema": {
"anyOf": [
{
"$ref": "#/components/schemas/Interrupt"
},
{
"$ref": "#/components/schemas/injected_val"
},
{
"$ref": "#/components/schemas/document"
}
]
}
}
},
}
},
"schemas": {
"Interrupt": {
"title": "Interrupt event",
"type": "object",
"properties": {
"Interrupt": {
"type": "boolean"
}
}
},
"injected_val": {
"title": "Injected value",
"type": "object",
"properties": {
"injected_val": {
"type": "string"
}
}
},
"document": {
"title": "document",
"type": "object",
"properties": {
"document": {
"type": "string"
}
}
}
}
}
}

当我想从 swagger UI 尝试 curl 命令时生成 Curl 请求:

curl -X POST "http://xx.yy.zz.ee:8080/api/v1/calls/54544/js" -H "accept:/" -H "Content-Type: application/x-www-form-urlencoded" -d "0

='&1=I&2=n&3=t&4=e&5=r&6=r&7=u&8=p&9=t&10='&11=%3D&12='&13=t&14=r&15=u&16=e&17='"招摇 UI 示例屏幕截图:

目前(截至 3.23.5 版)Swagger UI 不支持具有oneOfanyOf的表单数据。您可以在 Swagger UI 问题存储库中打开问题:

https://github.com/swagger-api/swagger-ui/issues

最新更新