docs(api): add comments for security schemas and openapi setup
This commit is contained in:
parent
72d1ac58d1
commit
0001dbe634
1 changed files with 2 additions and 0 deletions
2
api.py
2
api.py
|
|
@ -181,6 +181,7 @@ def custom_openapi():
|
||||||
|
|
||||||
openapi_schema = app.openapi()
|
openapi_schema = app.openapi()
|
||||||
|
|
||||||
|
# Définir deux schémas de sécurité
|
||||||
openapi_schema["components"]["securitySchemes"] = {
|
openapi_schema["components"]["securitySchemes"] = {
|
||||||
"HTTPBearer": {"type": "http", "scheme": "bearer", "bearerFormat": "JWT"},
|
"HTTPBearer": {"type": "http", "scheme": "bearer", "bearerFormat": "JWT"},
|
||||||
"ApiKeyAuth": {"type": "apiKey", "in": "header", "name": "X-API-Key"},
|
"ApiKeyAuth": {"type": "apiKey", "in": "header", "name": "X-API-Key"},
|
||||||
|
|
@ -192,6 +193,7 @@ def custom_openapi():
|
||||||
return app.openapi_schema
|
return app.openapi_schema
|
||||||
|
|
||||||
|
|
||||||
|
# Après app = FastAPI(...), ajouter:
|
||||||
app.openapi = custom_openapi
|
app.openapi = custom_openapi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue