flasgger/flasgger

Duplicate API Versioning Prefix in Swagger UI Paths with Base URL Configuration

Opened this issue · 0 comments

Hello,

I am encountering an issue with API versioning in the Swagger UI generated by Flasger. I have structured my Flask application to use a Blueprint with a /v1 prefix for all routes to indicate the API version. Additionally, I have configured the Swagger servers URL to include this /v1 prefix as part of the base URL.

However, in the Swagger UI, this results in the /v1 prefix being displayed twice: once in the base URL and once in each of the individual endpoint paths. This redundancy in the version prefix could lead to confusion and does not reflect the intended API structure, especially as we consider adding more versions in the future (e.g., /v2).

Steps to Reproduce:
Create a Flask Blueprint with a /v1 prefix.
Define routes within this Blueprint.
Configure Flasger's Swagger UI with a servers URL that includes /v1.
Observe that in the Swagger UI, the /v1 prefix appears both in the base URL and in the individual endpoint paths.
Expected Behavior:
The Swagger UI should display the base URL with the /v1 prefix and then list the individual endpoint paths without this prefix, as they are already relative to the base URL specified. This would ensure clarity and prevent redundancy in the path display.

Actual Behavior:
The Swagger UI displays the /v1 prefix both in the base URL and in each of the individual endpoint paths, leading to redundancy.