Skip to content

parse_handler_params

faststream.asyncapi.message.parse_handler_params #

parse_handler_params(call, prefix='')

Parses the handler parameters.

Source code in faststream/asyncapi/message.py
def parse_handler_params(
    call: "CallModel[Any, Any]", prefix: str = ""
) -> Dict[str, Any]:
    """Parses the handler parameters."""
    model = call.model
    assert model  # nosec B101

    body = get_model_schema(
        create_model(  # type: ignore[call-overload]
            model.__name__,
            **call.flat_params,
        ),
        prefix=prefix,
        exclude=tuple(call.custom_fields.keys()),
    )

    if body is None:
        return {"title": "EmptyPayload", "type": "null"}

    return body