After building (program.cs) the application var app = builder.Build(); When defining the use of swagger, do: app.UseSwagger(c => { c.OpenApiVersion = Microsoft.OpenApi.OpenApiSpecVersion.OpenApi2_0; }); With this, you will specify the version of OpenApi to be used. Change if necessary.