javascriptswagger

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


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

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.


Solution

  • 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",
        ...