【发布时间】:2021-02-09 12:26:55
【问题描述】:
我有以下带有两个参数的 Swagger 文档(简化版)。 TypeCode(字符串)和 Status(枚举)。当我尝试验证/导入 Azure Api Management 时,出现以下错误
Parsing error(s): JSON is valid against no schemas from 'oneOf'. Path 'paths['/Bids'].get.parameters[1]', line 1, position 188.
招摇文档
{
"swagger": "2.0",
"info": {
"title": "/my-api",
"description": "My API",
"version": "1.0"
},
"paths": {
"/Bids": {
"get": {
"tags": [
"Bids"
],
"parameters": [
{
"in": "query",
"name": "typeCode",
"type": "string"
},
{
"in": "query",
"name": "status"
}
],
"responses": {
"200": {
"description": "Success"
}
}
}
}
},
"definitions": {
"MyApi.ApplicationCore.Filter.Status": {
"enum": [
"Submitted",
"Created",
"Cancelled",
"Accepted"
],
"type": "string"
}
}
}
我不确定是什么导致了这个错误。我怀疑与枚举有关
【问题讨论】:
标签: api swagger azure-api-management swashbuckle json-schema-validator