|
|
|
@ -0,0 +1,23 @@
|
|
|
|
|
using Asp.Versioning.ApiExplorer;
|
|
|
|
|
using Infrastructure.Seed;
|
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
|
|
|
|
|
|
namespace Infrastructure.Extensions;
|
|
|
|
|
|
|
|
|
|
public static class ApplicationBuilderExtension
|
|
|
|
|
{
|
|
|
|
|
public static void UseDefaultSwaggerUI(this IApplicationBuilder app)
|
|
|
|
|
{
|
|
|
|
|
ArgumentNullException.ThrowIfNull(app);
|
|
|
|
|
var apiVersionDescriptionProvider =
|
|
|
|
|
app.ApplicationServices.GetRequiredService<IApiVersionDescriptionProvider>();
|
|
|
|
|
app.UseSwaggerUI(options =>
|
|
|
|
|
{
|
|
|
|
|
foreach (var description in apiVersionDescriptionProvider.ApiVersionDescriptions)
|
|
|
|
|
{
|
|
|
|
|
options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json",
|
|
|
|
|
description.GroupName.ToUpperInvariant());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|