переход на скаляр
Tests / test (pull_request) Successful in 3m8s

This commit is contained in:
gorbenko.pavel
2026-07-24 12:33:09 +05:00
parent fa13e93190
commit 97ca6c284e
3 changed files with 11 additions and 7 deletions
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi;
using Scalar.AspNetCore;
using Tnsu.ApprovalRoute.Api.Auth;
using Tnsu.ApprovalRoute.Api.Filters;
using Tnsu.ApprovalRoute.Application;
@@ -53,12 +54,15 @@ var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
app.UseSwaggerUI(c =>
// Scalar API reference UI — нативно понимает документ MapOpenApi (включая securitySchemes/security)
// и корректно прикрепляет Bearer-токен к запросам.
app.MapScalarApiReference(options =>
{
c.SwaggerEndpoint("/openapi/v1.json", "Tnsu Approval Route v1");
c.RoutePrefix = string.Empty;
c.ConfigObject.AdditionalItems["persistAuthorization"] = true;
c.EnableTryItOutByDefault();
options
.WithTitle("Tnsu Approval Route")
.AddPreferredSecuritySchemes("Bearer")
.AddHttpAuthentication("Bearer", _ => { });
});
}
@@ -11,6 +11,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" />
<PackageReference Include="Scalar.AspNetCore" />
</ItemGroup>
</Project>