Skip to content

get_response_schema

faststream.asyncapi.message.get_response_schema #

get_response_schema(
    call: Optional[CallModel[Any, Any]], prefix: str = ""
) -> Optional[Dict[str, Any]]

Get the response schema for a given call.

PARAMETER DESCRIPTION
call

The call model.

TYPE: Optional[CallModel[Any, Any]]

prefix

A prefix to add to the schema keys.

TYPE: str DEFAULT: ''

RETURNS DESCRIPTION
Optional[Dict[str, Any]]

The response schema as a dictionary.

Note

The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)

Source code in faststream/asyncapi/message.py
def get_response_schema(
    call: Optional[CallModel[Any, Any]],
    prefix: str = "",
) -> Optional[Dict[str, Any]]:
    """Get the response schema for a given call.

    Args:
        call: The call model.
        prefix: A prefix to add to the schema keys.

    Returns:
        The response schema as a dictionary.
    !!! note

        The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
    """
    return get_model_schema(
        getattr(
            call, "response_model", None
        ),  # NOTE: FastAPI Dependant object compatibility
        prefix=prefix,
    )

Last update: 2023-11-13