Azure / Azure/azure-functions-openapi-extension

Add support for customizing Swagger UI URL

Open
#530 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
388
Forks
202
PR merge metrics
No merged PRs in 30d

Description

**Describe the issue**
Currently, the URL of Swagger UI is hardcoded to `swagger/ui` (https://github.com/Azure/azure-functions-openapi-extension/blob/main/src/Microsoft.Azure.WebJobs.Extensions.OpenApi/OpenApiTriggerFunctionProvider.cs#L91).
Ideally, we should be able to customize the URL.

By default, after publishing the function, the swagger UI is available at: https://testaccount.azurewebsites.net/api/swagger/ui

we can remove the `api` prefix by adding the below lines to `host.json`:
```
"extensions": {
"http": {
"routePrefix": ""
}
},
```

but with the above lines, the URL will look like this: https://testaccount.azurewebsites.net/swagger/ui

Ideally, we should be able to serve Swagger UI from the root, that is: https://testaccount.azurewebsites.net

Contributor guide

Open the contributing guide

Research direction

Start with OpenApiTriggerFunctionProvider.cs at the hardcoded swagger/ui route mentioned in the issue. Trace how HTTP routes and host.json settings are applied, then determine where a configurable UI path belongs. Done means the Swagger UI can be served at a customized path, including the application root, without breaking the default route.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.