Azure / Azure/azure-functions-openapi-extension
Endpoints displayed in random order
- Dominant language
- C#
- Stars
- 388
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
Using Microsoft.Azure.Functions.Worker.Extensions.OpenApi Version="0.8.1-preview"
The [swagger ui](http://../api/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](http://../api/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 postFunctionA([HttpTrigger(AuthorizationLevel.Function, "post"] HttpRequestData req, FunctionContext executionContext)
{
...
}
[OpenApiOperation(operationId: "FunctionC", tags: new[] { "Function Group B" }]
public async Task postFunctionC([HttpTrigger(AuthorizationLevel.Function, "post"] HttpRequestData req, FunctionContext executionContext)
{
///
}
[OpenApiOperation(operationId: "FunctionB", tags: new[] { "Function Group B" }]
public async Task 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
Contributor guide
Research direction
Reproduce the issue with the generated swagger.json and Swagger UI using the three functions and OpenApiOperation attributes shown in the report. Trace how tags and operation IDs are ordered during OpenAPI generation; done means both outputs consistently sort tags and then functions by name or operationId, while remaining compatible with version 0.8.1-preview.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, openapi
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100