auth endpoints added

This commit is contained in:
2025-04-03 14:19:34 +03:00
parent 3583d178e9
commit ee405133be
37 changed files with 976 additions and 570 deletions

View File

@@ -3,8 +3,8 @@ from fastapi import FastAPI
from fastapi.routing import APIRoute
from fastapi.openapi.utils import get_openapi
from ApiServices.TemplateService.config import template_api_config
from ApiServices.TemplateService.endpoints.routes import get_safe_endpoint_urls
from ApiServices.AuthService.config import api_config
from ApiServices.AuthService.endpoints.routes import get_safe_endpoint_urls
class OpenAPISchemaCreator:
@@ -36,7 +36,7 @@ class OpenAPISchemaCreator:
"BearerAuth": {
"type": "apiKey",
"in": "header",
"name": template_api_config.ACCESS_TOKEN_TAG,
"name": api_config.ACCESS_TOKEN_TAG,
"description": "Enter: **'Bearer <JWT>'**, where JWT is the access token",
}
}
@@ -73,9 +73,9 @@ class OpenAPISchemaCreator:
Dict[str, Any]: Complete OpenAPI schema
"""
openapi_schema = get_openapi(
title=template_api_config.TITLE,
description=template_api_config.DESCRIPTION,
version=template_api_config.VERSION,
title=api_config.TITLE,
description=api_config.DESCRIPTION,
version=api_config.VERSION,
routes=self.app.routes,
)
@@ -83,9 +83,7 @@ class OpenAPISchemaCreator:
if "components" not in openapi_schema:
openapi_schema["components"] = {}
openapi_schema["components"][
"securitySchemes"
] = self.create_security_schemes()
openapi_schema["components"]["securitySchemes"] = self.create_security_schemes()
# Configure route security and responses
for route in self.app.routes:
@@ -115,4 +113,4 @@ def create_openapi_schema(app: FastAPI) -> Dict[str, Any]:
Dict[str, Any]: Complete OpenAPI schema
"""
creator = OpenAPISchemaCreator(app)
return creator.create_schema()
return creator.create_schema()