Skip to content
Snippets Groups Projects
Commit f27b9784 authored by Jakub Konvička's avatar Jakub Konvička
Browse files

feat: Add API version

parent 38584297
1 merge request!15merge: develop into main
Pipeline #960 passed with stages
in 6 minutes and 26 seconds
......@@ -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;
});
......
......@@ -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"
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment