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.x.y (for example, openapi: 3.1.0).


Sangeetha SPosted Jul 24, 2025, 1:25 PM
It looks like you're working with a Swagger or OpenAPI specification file, and you're encountering an error related to the version field.
To fix this, ensure your specification includes one of the following valid version fields at the top of the file:
For Swagger 2.0
swagger: "2.0"
For OpenAPI 3.x.y (e.g., 3.0.0, 3.1.0):
Cynthia SathuragiriPosted Jul 25, 2025, 4:56 AM
Your API spec must include one of these fields at the root level:
swagger: "2.0" or openapi: "3.0.0" or "3.1.0"
If you’re using Swashbuckle in .NET, check your
Startup.csorProgram.csconfiguration:services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" });
});
confirm the top line has
openapi: "3.0.1"orswagger: "2.0".Ajay BansodePosted Jul 24, 2025, 4:54 PM
Check that the Package is installed in your project
Swashbuckle.AspNetCoreis use to dependent for Swagger and openApi.Make sure your project refer this package.
After starting your application and swagger
Ctrl + Shift + R is used to refresh the swagger.