openapiv3/header.rs
1use crate::*;
2use indexmap::IndexMap;
3use serde::{Deserialize, Serialize};
4
5/// The Header Object follows the structure of the Parameter Object with the following changes:
6///
7/// 1) name MUST NOT be specified, it is given in the corresponding headers map.
8/// 2) in MUST NOT be specified, it is implicitly in header.
9/// 3) All traits that are affected by the location MUST be applicable to a location of header (for example, style).
10#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
11#[serde(rename_all = "camelCase")]
12pub struct Header {
13 /// A brief description of the parameter. This could
14 /// contain examples of use. CommonMark syntax MAY be
15 /// used for rich text representation.
16 #[serde(skip_serializing_if = "Option::is_none")]
17 pub description: Option<String>,
18 #[serde(default)]
19 pub style: HeaderStyle,
20 /// Determines whether this parameter is mandatory.
21 /// If the parameter location is "path", this property
22 /// is REQUIRED and its value MUST be true. Otherwise,
23 /// the property MAY be included and its default value
24 /// is false.
25 #[serde(default, skip_serializing_if = "is_false")]
26 pub required: bool,
27 /// Specifies that a parameter is deprecated and SHOULD
28 /// be transitioned out of usage.
29 #[serde(skip_serializing_if = "Option::is_none")]
30 pub deprecated: Option<bool>,
31 #[serde(flatten)]
32 pub format: ParameterSchemaOrContent,
33 #[serde(skip_serializing_if = "Option::is_none")]
34 pub example: Option<serde_json::Value>,
35 #[serde(default, skip_serializing_if = "IndexMap::is_empty")]
36 pub examples: IndexMap<String, RefOr<Example>>,
37 /// Inline extensions to this object.
38 #[serde(flatten, deserialize_with = "crate::util::deserialize_extensions")]
39 pub extensions: IndexMap<String, serde_json::Value>,
40}