diff --git a/WebAPI/Program.cs b/WebAPI/Program.cs index f142f5c2e91a678fec75080a9fca0968f53a8981..843cd5ed6a1e4760f585ab933be2f08e84ef1622 100644 --- a/WebAPI/Program.cs +++ b/WebAPI/Program.cs @@ -9,11 +9,12 @@ string title = $"{applicationRunMode} {builder.Configuration.GetSection("Swagger builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); +string version = builder.Configuration.GetSection("SwaggerSettings:Version").Value; builder.Services.AddSwaggerGen(c => { - c.SwaggerDoc("v1", new OpenApiInfo + c.SwaggerDoc($"v{version}", new OpenApiInfo { - Version = "1.0", + Version = version, Title = title, Description = builder.Configuration.GetSection("SwaggerSettings:Description").Value, Contact = new OpenApiContact @@ -30,7 +31,7 @@ var app = builder.Build(); app.UseSwagger(); app.UseSwaggerUI(c => { - c.SwaggerEndpoint($"/swagger/v1/swagger.json", title); + c.SwaggerEndpoint($"/swagger/v{version}/swagger.json", title); c.RoutePrefix = string.Empty; c.DocumentTitle = title; }); diff --git a/WebAPI/appsettings.json b/WebAPI/appsettings.json index 20229691e2c3490098facdb257764828f9e1992c..81583665e34fa5a7d5bfa7b01b97d9121156791a 100644 --- a/WebAPI/appsettings.json +++ b/WebAPI/appsettings.json @@ -16,6 +16,7 @@ "Name": "Jakub Konvicka", "Email": "jakub.konvicka@vsb.cz", "Url": "https://www.vsb.cz/personCards/personCard.jsp?lang=cs&person=KON0379" - } + }, + "Version": "1.1.0" } }