@@ -230,14 +230,18 @@ def create_fastapi_app(
230230 config : BaseConfig | None = None ,
231231 * ,
232232 configure_exception_handlers : bool = True ,
233+ configure_common_responses : bool = True ,
233234 lifespan : Callable [..., AbstractAsyncContextManager ] | None = None ,
234235 ) -> FastAPI :
235- """Creates and configures a FastAPI application.
236+ """Create and configure a FastAPI application.
236237
237238 Args:
238- config (BaseConfig | None): Optional custom configuration. If not provided, uses global config.
239- configure_exception_handlers (bool): Whether to configure exception handlers.
240- lifespan: Callable[..., AbstractAsyncContextManager] | None = None,
239+ config (BaseConfig | None, optional): Custom configuration. If not provided, uses global config.
240+ configure_exception_handlers (bool, optional): Whether to configure exception handlers. Defaults to True.
241+ configure_common_responses (bool, optional): Whether to configure common response definitions for all endpoints.
242+ Defaults to True.
243+ lifespan (Callable[..., AbstractAsyncContextManager] | None, optional): Custom lifespan context manager for the app.
244+ Defaults to None.
241245
242246 Returns:
243247 FastAPI: The configured FastAPI application instance.
@@ -255,7 +259,7 @@ def create_fastapi_app(
255259 swagger_ui_parameters = config .FASTAPI .SWAGGER_UI_PARAMS ,
256260 docs_url = config .FASTAPI .DOCS_URL ,
257261 redocs_url = config .FASTAPI .RE_DOCS_URL ,
258- responses = cast (dict [int | str , Any ], common_responses ) if configure_exception_handlers else None ,
262+ responses = cast (dict [int | str , Any ], common_responses ) if configure_common_responses else None ,
259263 lifespan = lifespan ,
260264 )
261265
0 commit comments