I have created a custom controller Which inherits from BaseJsonApiController<> and i have overridden methods like GetAsync, GetById, PatchResource, PostResource. So while running the application getting error from swagger that says :
An unhandled exception has occurred while executing the request. Swashbuckle.AspNetCore.SwaggerGen.SwaggerGeneratorException: Ambiguous HTTP method for action - Controllers.RaceController.GetSecondaryAsync. Actions require an explicit HttpMethod binding for Swagger/OpenAPI 3.0
Also, even if I use specific service then also it generates all the controller endpoints Example :
public class RaceController<TResource, TIdentifier> : BaseJsonApiController<TResource, TIdentifier>
where TResource : class, IIdentifiable<TIdentifier>
where TIdentifier : struct
{
public RaceController(IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, IGetAllService<TResource, TIdentifier> getAllService) : base(options, resourceGraph, loggerFactory, getAllService)
{
}
[HttpGet]
public override async Task<IActionResult> GetAsync(CancellationToken cancellationToken)
{
var response = base.GetAsync(cancellationToken);
return Ok(response);
}
[HttpGet("{id}", Name = "GetById")]
public override async Task<IActionResult> GetAsync(long id, CancellationToken cancellationToken)
{
var response = await base.GetAsync(id, cancellationToken);
return Ok(response);
}
}
Now in the above example it will create endpoints for PostAsync as well which it should not as per the documentation.
I wanted to get only the routes endpoint generated for those the methods has been overridden from the BaseJsonApiController but currently it is generating all the endpoints. I am using version 5.3.0 of JsonApiDotNetCore