update swagger implementation

This commit is contained in:
voltsrage
2026-06-26 04:22:47 +08:00
parent 869006e5e7
commit 9777a335c5
8 changed files with 126 additions and 36 deletions
+9 -11
View File
@@ -1,6 +1,4 @@
using System.Reflection;
using System.Text;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using System.Text;using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using Minio;
@@ -54,28 +52,26 @@ try
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFile));
});
builder.Services.AddVigilCareRecordsSwagger();
var app = builder.Build();
app.UseMiddleware<CorrelationIdMiddleware>();
app.UseMiddleware<ExceptionHandlerMiddleware>();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "VigilCare Records API v1");
options.DocumentTitle = "VigilCare Records API";
});
}
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.Run();
using (var scope = app.Services.CreateScope())
{
@@ -83,6 +79,8 @@ try
await db.Database.MigrateAsync();
await DataSeeder.SeedAsync(db);
}
app.Run();
}
catch (System.Exception)
{