We are trying to override Swashbuckle/Swagger IO CodeGen naming conventions, when its creating Angular API Service Proxies, for existing 500+ controllers and the corresponding methods.
Currently linking Net Core 3 APIs with Angular Typescript.
https://stackoverflow.com/a/58567622/13889515
The following answer works:
[HttpGet("{id:int}", Name = nameof(GetProductById))]
public IActionResult GetProductById(int id) // operationId = "GetProductById"'
[HttpGet("{id:int}", Name = "GetProductById")]
public IActionResult GetProductById(int id) // operationId = "GetProductById"'
Is there a way to loop through all controllers and methods in startup? Name should equal name of Action Method within Controller.
This maybe possible solution, However, I need the action value.
return services.AddSwaggerGen(c =>
{
c.CustomOperationIds(e => $"{e.ActionDescriptor.RouteValues["controller"]}_{e.HttpMethod}");
https://stackoverflow.com/a/54294810/13889515
Utilize this piece of code:
return services.AddSwaggerGen(c =>
{
c.CustomOperationIds(e => $"{e.ActionDescriptor.RouteValues["action"]}");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With