Ligare.web.middleware.openapi

Connexion and OpenAPI-specific integrations for Ligare.web.

Functions

_get_correlation_id(request, response, log)

_get_correlation_id_from_headers(request, ...)

_get_correlation_id_from_json_logging(...)

_headers_as_dict(request_response)

_log_all_api_requests(request, response, ...)

_log_all_api_responses(request, response, ...)

_wrap_all_api_responses(request, response, ...)

address_to_str(address)

decode_headers(headers)

encode_headers(headers, append_headers[, ...])

get_remote_address()

get_server_address()

register_openapi_api_request_handlers(app)

register_openapi_api_response_handlers(app)

register_openapi_context_middleware(app)

Classes

CorrelationIDMiddleware(app)

FlaskContextMiddleware(app)

Connexion does not set Flask contexts in all cases they may be needed, like in middlewares that execute before ContextMiddleware.

MiddlewareRequestDict

MiddlewareResponseDict

RequestLoggerMiddleware(app)

ResponseLoggerMiddleware(app)

class Ligare.web.middleware.openapi.CorrelationIDMiddleware(app)[source]
__init__(app)[source]
class Ligare.web.middleware.openapi.FlaskContextMiddleware(app)[source]

Connexion does not set Flask contexts in all cases they may be needed, like in middlewares that execute before ContextMiddleware. This middleware creates the Flask application, request, and session contexts if they are not currently set.

__init__(app)[source]
class Ligare.web.middleware.openapi.MiddlewareRequestDict
app: ConnexionMiddleware
client: list[str | int]
extensions: dict[str, dict[str, str]]
headers: list[tuple[bytes, bytes]]
http_version: str
method: Literal['GET', 'POST', 'PATCH', 'PUT', 'DELETE', 'OPTIONS', 'HEAD', 'CONNECT', 'TRACE']
path: str
path_params: dict[Any, Any]
query_string: bytes
raw_path: bytes
root_path: str
scheme: str
server: list[str | int]
state: dict[Any, Union[Any, dict[Any, Union[Any, AnyDict]]]]
type: Literal['http']
class Ligare.web.middleware.openapi.MiddlewareResponseDict
headers: list[tuple[bytes, bytes]]
status: int
type: Literal['http.response.start']
class Ligare.web.middleware.openapi.RequestLoggerMiddleware(app)[source]
__init__(app)[source]
class Ligare.web.middleware.openapi.ResponseLoggerMiddleware(app)[source]
__init__(app)[source]
Ligare.web.middleware.openapi.address_to_str(address)[source]
Ligare.web.middleware.openapi.decode_headers(headers)[source]
Ligare.web.middleware.openapi.encode_headers(headers, append_headers, encoding='utf-8')[source]
Ligare.web.middleware.openapi.get_remote_address()[source]
Return type:

Address

Ligare.web.middleware.openapi.get_server_address()[source]
Return type:

Address

Ligare.web.middleware.openapi.register_openapi_api_request_handlers(app)[source]
Ligare.web.middleware.openapi.register_openapi_api_response_handlers(app)[source]
Ligare.web.middleware.openapi.register_openapi_context_middleware(app)[source]

Modules

cors

Extensions for CORS middleware.