azure-functions-openapi-extension icon indicating copy to clipboard operation
azure-functions-openapi-extension copied to clipboard

Endpoints displayed in random order

Open jassent opened this issue 3 years ago • 4 comments

Using Microsoft.Azure.Functions.Worker.Extensions.OpenApi Version="0.8.1-preview"

The swagger ui lists the functions/endpoints in a random order. It is not sorting by tag name or by function name.

The corresponding swagger.json is also unsorted.

Functions are grouping properly by tags but not sorting within the tag groups either.

Cannot upgrade to 1.0.0 due to issue #296

The expected behavior is that functions are sorted by Tag then by Function Name/OperationId.

The current behavior seems to be a random order by Tag then ordered by order of method within source code.

For example:

[OpenApiOperation(operationId: "FunctionA", tags: new[] { "Function Group A" }] public async Task<HttpResponseData> postFunctionA([HttpTrigger(AuthorizationLevel.Function, "post"] HttpRequestData req, FunctionContext executionContext) { ...
}

[OpenApiOperation(operationId: "FunctionC", tags: new[] { "Function Group B" }] public async Task<HttpResponseData> postFunctionC([HttpTrigger(AuthorizationLevel.Function, "post"] HttpRequestData req, FunctionContext executionContext) { ///
}

[OpenApiOperation(operationId: "FunctionB", tags: new[] { "Function Group B" }] public async Task<HttpResponseData> postFunctionB([HttpTrigger(AuthorizationLevel.Function, "post"] HttpRequestData req, FunctionContext executionContext) { ///
}

The above should render as:

Function Group A -postFunctionA

Function Group B -postFunctionB -postFunctionC

Instead it will render as:

Function Group B -postFunctionC -postFunctionB

Function Group A -postFunctionA

jassent avatar Dec 24 '21 14:12 jassent

Was there ever a resolution to this issue? Looking to figure out how to order the endpoints displayed in swagger UI

Kaymo1990 avatar May 17 '22 13:05 Kaymo1990

I would also like to order the endpoints by tags. I know you can modify the stylesheet or add custom javascript to the ui generation, but it seems I little hacky. I think there should be a more straight forward way to order the endpoints by tag, or at least by default order tags alphabetically.

niklashaetty avatar Dec 19 '22 13:12 niklashaetty

Nothing here? I have the same problem.

nhuurnink avatar Apr 13 '23 14:04 nhuurnink

Same here. Please can someone investigate and fix please!

I'm using 1.5.1 of the NuGet Package.

chrisusher-instanda avatar Apr 28 '23 16:04 chrisusher-instanda