Making it not unique resulted in a bug in the documentation where all endpoints with the jwt-auth expanded at once, when clicked on.
We fixed it by expanding the for loop below and using an exclude list instead of the operation_id
for route in app.routes[4:]:if route.path in ["/excluded", "/endpoint"]:continue
Adding a unique bit to the operation_id and using in also works
In https://indominusbyte.github.io/fastapi-jwt-auth/advanced-usage/generate-docs/ it is recommended to use
@app.get('/protected', operation_id="authorize")
and later identify the route/endpoint withrouter_authorize = [route for route in app.routes[4:] if route.operation_id == "authorize"]
. This means theoperation_id
is not unique, which is warned against by https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/.Making it not unique resulted in a bug in the documentation where all endpoints with the jwt-auth expanded at once, when clicked on.
We fixed it by expanding the for loop below and using an exclude list instead of the operation_id
for route in app.routes[4:]:
if route.path in ["/excluded", "/endpoint"]:
continue
Adding a unique bit to theoperation_id
and usingin
also works