22 lines
		
	
	
		
			759 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			759 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using Asp.Versioning;
 | |
| using Microsoft.Extensions.DependencyInjection;
 | |
| 
 | |
| namespace Mirea.Api.Endpoint.Configuration.Core.Startup;
 | |
| 
 | |
| public static class ApiVersioningConfiguration
 | |
| {
 | |
|     public static IApiVersioningBuilder AddCustomApiVersioning(this IServiceCollection services)
 | |
|     {
 | |
|         return services.AddApiVersioning(options =>
 | |
|         {
 | |
|             options.DefaultApiVersion = new ApiVersion(1, 0);
 | |
|             options.AssumeDefaultVersionWhenUnspecified = true;
 | |
|             options.ReportApiVersions = true;
 | |
|             options.ApiVersionReader = new UrlSegmentApiVersionReader();
 | |
|         }).AddApiExplorer(options =>
 | |
|         {
 | |
|             options.GroupNameFormat = "'v'VVV";
 | |
|             options.SubstituteApiVersionInUrl = true;
 | |
|         });
 | |
|     }
 | |
| } |