#[non_exhaustive]pub struct Response {
pub summary: Option<String>,
pub description: String,
pub headers: PropMap<String, Header>,
pub contents: IndexMap<String, Content>,
pub extensions: PropMap<String, Value>,
pub links: PropMap<String, RefOr<Link>>,
}Expand description
Implements OpenAPI Response Object.
Response is api operation response.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.summary: Option<String>Short summary of the meaning of the response. Added in OpenAPI 3.2.
See https://spec.openapis.org/oas/v3.2.0.html#response-object.
description: StringDescription of the response. Response support markdown syntax.
Required in OpenAPI 3.1 and optional as of OpenAPI 3.2, so documents that omit it
deserialize into an empty String. It is always serialized — an empty description is
valid under both versions, whereas omitting it would be invalid 3.1.
headers: PropMap<String, Header>Map of headers identified by their name. Content-Type header will be ignored.
contents: IndexMap<String, Content>Map of response Content objects identified by response body content type e.g
application/json.
Contents are stored within IndexMap to retain their insertion order. Swagger UI
will create and show default example according to the first entry in content map.
extensions: PropMap<String, Value>Optional extensions “x-something”
links: PropMap<String, RefOr<Link>>A map of operations links that can be followed from the response. The key of the map is a short name for the link.
Implementations§
Source§impl Response
impl Response
Sourcepub fn new<S: Into<String>>(description: S) -> Self
pub fn new<S: Into<String>>(description: S) -> Self
Construct a new Response.
Function takes description as argument.
Sourcepub fn description<I: Into<String>>(self, description: I) -> Self
pub fn description<I: Into<String>>(self, description: I) -> Self
Add description. Description supports markdown syntax.
Sourcepub fn summary<I: Into<String>>(self, summary: I) -> Self
pub fn summary<I: Into<String>>(self, summary: I) -> Self
Add a short summary of the meaning of the response. Requires OpenAPI 3.2.
Sourcepub fn add_header<S: Into<String>>(self, name: S, header: Header) -> Self
pub fn add_header<S: Into<String>>(self, name: S, header: Header) -> Self
Add response Header and returns Self.