Skip to main content

Response

This class represents a single response from an API operation, including its description and associated metadata. It provides structured fields for defining response headers, content media types, and links to other operations.

Attributes

AttributeTypeDescription
descriptionstrA short description of the response, which may contain CommonMark syntax for rich text formatting.
headers`dict[str, HeaderReference]
content`dict[str, MediaType]None` = None
links`dict[str, LinkReference]

Constructor

Signature

def Response(
description: str,
headers: dict[str, Header | Reference]| None = None,
content: dict[str, [MediaType](mediatype.md?sid=fastapi_openapi_models_mediatype)]| None = None,
links: dict[str, Link | Reference]| None = None
) - > null

Parameters

NameTypeDescription
descriptionstrA short description of the response.
headers`dict[str, HeaderReference]
content`dict[str, MediaType]None` = None
links`dict[str, LinkReference]

Signature

def Response(
description: string,
headers: dict[str, Header | Reference]| None = None,
content: dict[str, [MediaType](mediatype.md?sid=fastapi_openapi_models_mediatype)]| None = None,
links: dict[str, Link | Reference]| None = None
) - > null

Parameters

NameTypeDescription
descriptionstringA short description of the response, which may include CommonMark syntax for rich text representation.
headers`dict[str, HeaderReference]
content`dict[str, MediaType]None` = None
links`dict[str, LinkReference]