'How to share ActionName between webapi and client?

is there any way to share webapi ActionNames between client and api? I tried something like this in:

public static class Orders
{
    public const string GetAllOrders = "GetOrders";
    public const string GetUserOrders = "GetUserOrders";
    public const string GetCustomerOrders = "GetCustomerOrders";
}

And then in api:

    [HttpGet]
    [ActionName(Orders.GetAllOrders)]
    public IActionResult GetAllOrders()
    {

        return BadRequest("No records found");
    }

    [HttpGet]
    [ActionName(Orders.GetUserOrders)]
    public IActionResult GetUserOrders(int id)
    {
        return BadRequest("No records found");
    }

    [HttpGet]
    [ActionName(Orders.GetCustomerOrders)]
    public IActionResult GetCustomerOrders(int id)
    {
        return BadRequest("No records found");
    }

But im getting this error:

Swashbuckle.AspNetCore.SwaggerGen.SwaggerGeneratorException: Conflicting method/path combination "GET api/Order" for actions - LPD_Api.Controllers.OrderController.GetAllOrders (LPD_Api),LPD_Api.Controllers.OrderController.GetUserOrders (LPD_Api),LPD_Api.Controllers.OrderController.GetCustomerOrders (LPD_Api). Actions require a unique method/path combination for Swagger/OpenAPI 3.0. Use ConflictingActionsResolver as a workaround

Any tips how to share names to avoid naming errors on the client side?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source