From 8fe37ff9d71124a493903b3410ffb8b5153d1462 Mon Sep 17 00:00:00 2001 From: Sergey Karmanov Date: Sat, 6 Sep 2025 20:17:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB=20Sc?= =?UTF-8?q?alar=20=D0=BD=D0=B0=20Swagger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SfeduSchedule/Program.cs | 18 ++++++++++-------- SfeduSchedule/SfeduSchedule.csproj | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/SfeduSchedule/Program.cs b/SfeduSchedule/Program.cs index 0c6d6f6..552b504 100644 --- a/SfeduSchedule/Program.cs +++ b/SfeduSchedule/Program.cs @@ -1,6 +1,5 @@ using Microsoft.Identity.Web; using Quartz; -using Scalar.AspNetCore; using SfeduSchedule; using SfeduSchedule.Jobs; using SfeduSchedule.Services; @@ -43,10 +42,17 @@ if (string.IsNullOrEmpty(preinstsalledJwtToken)) builder.Services.AddQuartzHostedService(q => q.WaitForJobsToComplete = true); } +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(options => +{ + var xmlFile = $"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Name}.xml"; + var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); + options.IncludeXmlComments(xmlPath); +}); + var app = builder.Build(); app.UseForwardedHeaders(); -app.MapOpenApi(); var logger = app.Services.GetRequiredService>(); @@ -90,15 +96,11 @@ if (app.Environment.IsDevelopment()) { app.MapOpenApi(); } -app.MapScalarApiReference(options => -{ - options.WithTitle("Расписание занятий ЮФУ"); - options.Theme = ScalarTheme.Kepler; -}); +app.UseSwagger(); +app.UseSwaggerUI(); app.UseAuthorization(); - app.UseStaticFiles(); app.MapGet("/", async context => diff --git a/SfeduSchedule/SfeduSchedule.csproj b/SfeduSchedule/SfeduSchedule.csproj index 3cc7d44..636a263 100644 --- a/SfeduSchedule/SfeduSchedule.csproj +++ b/SfeduSchedule/SfeduSchedule.csproj @@ -14,7 +14,7 @@ - +