配置swagger报错的排查方向——
错误信息——
Unable to render this definition
The provided definition does not specify a valid version field.
Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0"
and those that match openapi: 3.0.n
(for example, openapi: 3.0.0
).
排查方向——
- 检查Controller/ Action 是否包含 [HttpGet] [HttpPost]等,如果不包含,需要添加;
- Controller中是否添加 [ApiController] / [Route("XX/[controller]")] 特性