swagger报错Unable to render this definition

发布时间 2023-12-27 16:21:57作者: 0Behavior

问题描述:访问swagger时,报错end of the stream or a document separator is expected,

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有重复接口名称,什么json里面有空格啥的,什么版本问题啥的.....

本人情况是网址写错了也会报错,例如正确的是:http://localhost:6103/api-doc/index.html,

我写成了http://localhost:6103/api-doc/index-html或者http://localhost:6103/api-doc/index,html,就是index后面的符号写错了,也会报这个错误。