pub struct Response {
pub summary: Option<String>,
pub description: Option<String>,
pub headers: Map<RefOr<Header>>,
pub content: Map<MediaType>,
pub links: Map<RefOr<Link>>,
pub extensions: Extensions,
}Expand description
A single response.
Fields§
§summary: Option<String>A short summary of the response.
Introduced in OpenAPI 3.2. Under 3.1 the first line of the description serves this purpose.
description: Option<String>A description of the response. CommonMark syntax may be used.
Required by 3.1, optional in 3.2. 3.1 marks it REQUIRED; 3.2
drops the marker, so a response stating only a
summary is a legal 3.2 document. Modelling it as
a String enforced 3.1’s rule on both versions and made such a
document unparseable, so the requirement lives in
validate instead, where it is checked against the
version the document claims.
new sets it, which is the common case and the only
one 3.1 admits.
headers: Map<RefOr<Header>>Headers sent with the response.
A Content-Type entry is ignored, since content
states it.
content: Map<MediaType>The response body’s representations, keyed by media type.
links: Map<RefOr<Link>>Design-time links to other operations.
extensions: ExtensionsSpecification extensions.
Implementations§
Source§impl Response
impl Response
Sourcepub fn with_content(
description: impl Into<String>,
media_type: impl Into<String>,
content: MediaType,
) -> Self
pub fn with_content( description: impl Into<String>, media_type: impl Into<String>, content: MediaType, ) -> Self
Creates a response with one body representation.
Sourcepub fn with_header(self, name: impl Into<String>, header: Header) -> Self
pub fn with_header(self, name: impl Into<String>, header: Header) -> Self
Declares a response header.