[BUG] ApiVersioning is not working
I created a new brand controller and put it under the v2 folder. I wrote the following code and when swagger runs I get an error Am I making a mistake?
[ApiVersion("2.0")] public class BrandsController : VersionedApiController { [MapToApiVersion("2.0")] [HttpPost("search")] [MustHavePermission(FSHAction.Search, FSHResource.Brands)] [OpenApiOperation("Search brands using available filters.", "")] public Task<PaginationResponse<BrandDto>> SearchAsync(SearchBrandsRequest request) { return Mediator.Send(request); } }
result error : The method 'get' on path '/api/tenants' is registered multiple times.
I guess your code and your error are not linked. Your code is about a post request and your error about a get request. I think :
- you have to make a search in your code with "api/tenants" and you will find almost two get resquests with that route.
- you need to have just one route registred with "api/tenants"
I opened a new project and added a new brandcontroller under the Host/Catalog/v2.
this code namespace FSH.Starter.Host.Controllers.V2; [ApiVersion("2.0")] public class BrandsController : VersionedApiController { [MapToApiVersion("2.0")] [HttpPost("search")] [MustHavePermission(FSHAction.Search, FSHResource.Brands)] [OpenApiOperation("Search brands using available filters.", "")] public Task<PaginationResponse<BrandDto>> SearchAsync(SearchBrandsRequest request) { return Mediator.Send(request); } }
API Versioning will change with V2 Release.