Skip to content

Helpers (fastapi_responseschema.helpers)

wrap_error_responses

def wrap_error_responses(
        app: FastAPI,
        error_response_schema: Type[AbstractResponseSchema]) -> FastAPI

[view_source]

Wraps all exception handlers with the provided response schema.

Arguments:

  • app FastAPI - A FastAPI application instance.
  • error_response_schema Type[AbstractResponseSchema] - Response schema wrapper model.

Returns:

  • FastAPI - The application instance

wrap_app_responses

def wrap_app_responses(app: FastAPI,
                       route_class: Type[SchemaAPIRoute]) -> FastAPI

[view_source]

Wraps all app defaults responses

Arguments:

  • app FastAPI - A FastAPI application instance.
  • route_class Type[SchemaAPIRoute] - The SchemaAPIRoute with your response schemas.

Returns:

  • FastAPI - The application instance.