From 86642b5d2815cc6f05b242969b38cd9decc54621 Mon Sep 17 00:00:00 2001 From: glax Date: Mon, 26 May 2025 02:15:59 +0200 Subject: [PATCH] Swashbuckle use Newtonsoft and use XMl-Comments --- API/API.csproj | 3 +++ API/Api.cs | 7 ++++++- SteamGameTimeTrack.sln.DotSettings.user | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/API/API.csproj b/API/API.csproj index 6e6cc3b..25f6e7c 100644 --- a/API/API.csproj +++ b/API/API.csproj @@ -5,6 +5,8 @@ enable enable Linux + true + $(NoWarn);1591 @@ -16,6 +18,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/API/Api.cs b/API/Api.cs index 459f60f..ab5c1d8 100644 --- a/API/Api.cs +++ b/API/Api.cs @@ -22,7 +22,12 @@ public class Api }); builder.Services.AddCors(options => options.AddPolicy("AllowAll", p => p.AllowAnyOrigin().AllowAnyMethod())); - builder.Services.AddSwaggerGen(); + builder.Services.AddSwaggerGenNewtonsoftSupport(); + builder.Services.AddSwaggerGen(opt => + { + var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; + opt.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename)); + }); builder.Services.AddDbContext(options => options.UseSqlite(builder.Configuration.GetConnectionString("DefaultConnection"), optionsBuilder => optionsBuilder.MigrationsAssembly(Assembly.GetAssembly(GetType())!))); diff --git a/SteamGameTimeTrack.sln.DotSettings.user b/SteamGameTimeTrack.sln.DotSettings.user index 833d61c..469ce9a 100644 --- a/SteamGameTimeTrack.sln.DotSettings.user +++ b/SteamGameTimeTrack.sln.DotSettings.user @@ -5,4 +5,5 @@ ForceIncluded ForceIncluded ForceIncluded - ForceIncluded \ No newline at end of file + ForceIncluded + ForceIncluded \ No newline at end of file