OrderActionsBy doesn't work correctly
See original GitHub issueCannot get OrderActionsBy working correctly. I need to order actions based on HTTP methods used so that GET methods come first (then POST, PUT, DELETE etc.). I have a few API controllers with some actions (using different HTTP methods). So I tried something very simple as shown below.
This is not working (order doesn’t change at all):
config.OrderActionsBy(apiDesc =>
{
return apiDesc.HttpMethod == "GET" ? "1" : "2";
});
This is working (but obviously it doesn’t order actions as I want):
config.OrderActionsBy(apiDesc =>
{
return apiDesc.HttpMethod;
});
Am I doing something wrong or misunderstood something or is this a bug in Swashbuckle?
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
c# - How can I change order the operations are listed in a ...
I've found how to implement document filters and I can get and order ApiDescriptions by HttpMethod , but changing the order in ApiDescriptions ......
Read more >Swashbuckle.AspNetCore
This won't work if your app is hosted on an IIS virtual directory or behind a proxy that trims the request path before...
Read more >Swashbuckle Custom Ordering of Controllers - Terence Golla
With OrderActionsBy you use a lambda expression to alter the sort key string used to order (group) API calls. By default, the sort...
Read more >肖红军/Swashbuckle.AspNetCore
Open the Properties dialog for your project, click the "Build" tab and ensure that "XML documentation file" is checked. · Configure Swashbuckle to...
Read more >Swashbuckle.AspNetCore
When you have multiple Swagger pages open, it can be difficult to tell them apart. You can alter this when enabling the SwaggerUi...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If there is some requirement that paths be sorted within a group and the OrderActionsBy sorting override can’t change that, I wish that fact was more discoverable in the intellisense for the method in Visual Studio. It would have saved me many hours trying to figure out why sorting was broken.
Frankly, a sorting override like this should truly override the sorting. Setting a sort override only to have it changed by internal sorting is confusing and unexpected.
I do not think its working
Trying to set in the following order within the same Controller
GET - POST - PUT - DELETE
*I wish I can disable Ordering in the first place and just load the way its in the controller