0

试图在 swagger 文档上运行 dredd。Dredd 失败并出现下一个错误:

- error: API description parser error in /albums.json:266 (from line 266 column 10 to column 21): Data does not match any schemas from 'anyOf'    
- error: API description parser error in /albums.json:266 (from line 266 column 10 to column 21): No enum match for: s
- error: API description parser error in /albums.json:266 (from line 266 column 10 to column 21): Expected type array but found type string

错误指的是 JSON 的这一部分:

265  "photos": { "$ref": "#/definitions/PhotoEntity" },
266  "created_at": {
267    "type": "s",
268    "format": "g",
269    "description": "Дата создания"
270  }

gist提供完整的 JSON 。Swagger-ui 可以完美地使用这个 JSON,手动测试通过,正如预期的那样。

4

1 回答 1

1

代替

"type": "s",

"type": "string",


您的 API 定义中还有其他错误 - 使用https://editor.swagger.io检查语法错误。

于 2020-06-19T12:10:09.293 回答