Add more options to control exposed Swagger endpoints
TamayiM opened this issue · comments
Describe the issue
I have a business requirement to customize the Swagger endpoints:
- Hide the Swagger UI endpoint and expose only the swagger.json endpoint
- Update the swagger.json endpoint to align with other endpoints used in my applications i.e. /api-docs/swagger.json
I am using .NET 8 and the out-of-processes worker model.
To Reproduce
This is a new feature request with no steps on how to reproduce.
Expected behavior
By default, the library creates three endpoints. I only need the RenderSwaggerDocument endpoint and the others should be hidden.
RenderOpenApiDocument: [GET] https://localhost:7001/openapi/{version}.{extension}
RenderSwaggerDocument: [GET] https://localhost:7001/swagger.{extension}
RenderSwaggerUI: [GET] https://localhost:7001/swagger/ui
Screenshots
Environment (please complete the following information, if applicable):
- OS: Windows
- Azure Functions Core Tools Version: 4.0.5455 Commit hash: N/A (64-bit)
- Function Runtime Version: 4.27.5.21554
Additional context
Configure Swagger UI Visibility suggests setting the OpenApi__HideSwaggerUI
value to true
in local.settings.json
or application environment variables in production, the Swagger UI page won't be showing up, and you will see the 404 error. However, note that we are using the out-of-process worker model and...
NOTE: Currently, the out-of-process worker model doesn't support hiding Swagger UI. The following configurations are only applicable to the in-process worker extension.
Configure Custom Base URLs doesn't seem to work. Even after setting OpenApi__HostNames
to /api-docs
in local.settings.json
.
I tried to use proxies.json (as described in Shortening Swagger UI Page URL and swagger.json URL with proxies.json) to implement the customisation of the end-points, but I get the error below: