Expose swagger UI again
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Vegasco.Server.Api.Endpoints;
|
using Asp.Versioning.ApiExplorer;
|
||||||
|
using Vegasco.Server.Api.Endpoints;
|
||||||
using Vegasco.Server.ServiceDefaults;
|
using Vegasco.Server.ServiceDefaults;
|
||||||
|
|
||||||
namespace Vegasco.Server.Api.Common;
|
namespace Vegasco.Server.Api.Common;
|
||||||
@@ -36,6 +37,17 @@ internal static class StartupExtensions
|
|||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.MapOpenApi("/swagger/{documentName}/swagger.json");
|
app.MapOpenApi("/swagger/{documentName}/swagger.json");
|
||||||
|
app.UseSwaggerUI(o =>
|
||||||
|
{
|
||||||
|
// Create a Swagger endpoint for each API version
|
||||||
|
IReadOnlyList<ApiVersionDescription> apiVersions = app.DescribeApiVersions();
|
||||||
|
foreach (ApiVersionDescription apiVersionDescription in apiVersions)
|
||||||
|
{
|
||||||
|
string url = $"/swagger/{apiVersionDescription.GroupName}/swagger.json";
|
||||||
|
string name = apiVersionDescription.GroupName.ToUpperInvariant();
|
||||||
|
o.SwaggerEndpoint(url, name);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.12.0" />
|
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.12.0" />
|
||||||
<PackageReference Include="StronglyTypedId" Version="1.0.0-beta08" PrivateAssets="all" ExcludeAssets="runtime" />
|
<PackageReference Include="StronglyTypedId" Version="1.0.0-beta08" PrivateAssets="all" ExcludeAssets="runtime" />
|
||||||
<PackageReference Include="StronglyTypedId.Templates" Version="1.0.0-beta08" />
|
<PackageReference Include="StronglyTypedId.Templates" Version="1.0.0-beta08" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user