Swagger..无法呈现此定义 提供的定义未指定有效的版本字段

2022-01-22 00:00:00 api swagger javascript

无法呈现此定义 提供的定义没有指定一个有效的版本字段.

Unable to render this definition The provided definition does not specify a valid version field.

请指明有效的 Swagger 或 OpenAPI 版本字段.支持的版本字段是 swagger: "2.0" 和那些匹配 openapi: 3.0.n(例如,openapi: 3.0.0).

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).

我需要在哪里插入正确的版本来停止下面的错误.Swagger 编辑器工作正常,但在启动特定项目时我收到此错误.第一次使用 Swagger.非常感谢

Where do I need to insert the correct version to the stop the error below. Swagger editor works ok, but when launching a particular project I receive this error.First time using Swagger. Many Thanks

推荐答案

你的API 定义 缺少 OpenAPI/Swagger 版本号,在本例中为 "swagger": "2.0".在开头添加它,如下所示:

Your API definition is missing the OpenAPI/Swagger version number, in this case "swagger": "2.0". Add it at the beginning, like so:

{
    "swagger": "2.0",

    "title" : "Music API Documentation",
    ...

相关文章