2024-09-18 06:00:07 +03:00
|
|
|
|
using Asp.Versioning;
|
2024-06-01 10:57:52 +03:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
2024-09-07 04:28:07 +03:00
|
|
|
|
namespace Mirea.Api.Endpoint.Configuration.ApplicationConfiguration;
|
2024-06-01 10:57:52 +03:00
|
|
|
|
|
|
|
|
|
public static class ApiVersioningConfiguration
|
|
|
|
|
{
|
|
|
|
|
public static void AddCustomApiVersioning(this IServiceCollection services)
|
|
|
|
|
{
|
|
|
|
|
services.AddApiVersioning(options =>
|
|
|
|
|
{
|
|
|
|
|
options.DefaultApiVersion = new ApiVersion(1, 0);
|
|
|
|
|
options.AssumeDefaultVersionWhenUnspecified = true;
|
|
|
|
|
options.ReportApiVersions = true;
|
|
|
|
|
options.ApiVersionReader = new UrlSegmentApiVersionReader();
|
2024-09-18 06:00:07 +03:00
|
|
|
|
}).AddApiExplorer(options =>
|
2024-06-01 10:57:52 +03:00
|
|
|
|
{
|
|
|
|
|
options.GroupNameFormat = "'v'VVV";
|
|
|
|
|
options.SubstituteApiVersionInUrl = true;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|