为我的烧瓶 python 项目使用以下版本: connexion==2.3.0 swagger-ui-bundle==0.0.5 OAS 3.0
这是我的 swagger.json
{
"openapi": "3.0.0",
"servers": [
{
"url": "http://localhost:8080"
},
{
"url": "https://localhost:8081"
}
],
"tags": [
{
"name": "API",
}
],
"paths": {
"/api/hvp/v1/calls/{call-id}/js": {
"post": {
"tags": [
"Post request"
],
"operationId": "abcd",
"parameters": [
{
"name": "call-id",
"description": "call id",
"in": "path",
"schema": {
"type": "string"
},
"required": true
}
],
"requestBody": {
"$ref": "#/components/requestBodies/customEventBody"
},
"responses": {
"204": {
"description": "NO CONTENT"
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status":{
"type": "string"
},
"detail": {
"type":"string"
}
}
}
}
}
}
}
}
}
},
"components": {
"requestBodies": {
"customEventBody": {
"description": "url encoded form data ",
"content": {
"application/x-www-form-urlencoded":{
"schema": {
"type": "object",
"properties": {
"document": {
"type":"string"
},
"application":{
"type": "string"
}
}
},
"encoding": {
"document": {
"allowReserved": true
},
"application": {
"allowReserved": true
}
}
}
}
}
}
}
}
根据 OAS 3.0 规范,我已将编码属性设置为 allowReserved=true,
但我仍然看到在 swagger UI -> tryOut 选项中显示的 curl 命令输出,其中括号和双引号的 ascii 值如下:
实际结果是这样的: curl -X POST " http://v-jay-hvp-install:8080/api/hvp/v1/calls/fdfd/js " -H "accept: / " -H "Content-Type:应用程序/x-www-form-urlencoded" -d "应用程序=sss&document=%7B%22Property1%22%3A%22value1%22%7D"
预期结果是这样的: curl -X POST " http://v-jay-hvp-install:8080/api/hvp/v1/calls/fdfd/js " -H "accept: / " -H "Content-Type: application/x-www-form-urlencoded" -d "application=sss&document={"Property1":"value1"}
我在 swagger.json 中缺少什么