Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b731ebdcea | |||
| 3deffab351 |
@@ -1,4 +1,5 @@
|
|||||||
using Asp.Versioning.Builder;
|
using Asp.Versioning.Builder;
|
||||||
|
using k8s.Models;
|
||||||
using LiteCharms.Features.Extensions;
|
using LiteCharms.Features.Extensions;
|
||||||
using LiteCharms.Features.Mediator;
|
using LiteCharms.Features.Mediator;
|
||||||
using LiteCharms.Features.MidrandBooks.Extensions;
|
using LiteCharms.Features.MidrandBooks.Extensions;
|
||||||
@@ -74,6 +75,10 @@ app.UseHealthChecks("/ready");
|
|||||||
|
|
||||||
app.MapOpenApi();
|
app.MapOpenApi();
|
||||||
|
|
||||||
|
var apiVersions = app.DescribeApiVersions()
|
||||||
|
.OrderByDescending(o => o.ApiVersion.MajorVersion)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
foreach (var description in app.DescribeApiVersions().OrderByDescending(o => o.ApiVersion.MajorVersion))
|
foreach (var description in app.DescribeApiVersions().OrderByDescending(o => o.ApiVersion.MajorVersion))
|
||||||
app.MapScalarApiReference($"/openapi/{description.GroupName}", (options, context) =>
|
app.MapScalarApiReference($"/openapi/{description.GroupName}", (options, context) =>
|
||||||
{
|
{
|
||||||
@@ -84,6 +89,10 @@ foreach (var description in app.DescribeApiVersions().OrderByDescending(o => o.A
|
|||||||
options.Authentication = new ScalarAuthenticationOptions { PreferredSecuritySchemes = ["Bearer"] };
|
options.Authentication = new ScalarAuthenticationOptions { PreferredSecuritySchemes = ["Bearer"] };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var latestVersionGroup = apiVersions.FirstOrDefault()?.GroupName ?? "v1";
|
||||||
|
|
||||||
|
app.MapGet("/", () => Results.Redirect($"/openapi/{latestVersionGroup}"))
|
||||||
|
.ExcludeFromDescription();
|
||||||
|
|
||||||
if (!app.Environment.IsDevelopment())
|
if (!app.Environment.IsDevelopment())
|
||||||
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
||||||
|
|||||||
Reference in New Issue
Block a user