1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
use crate::*;
use indexmap::IndexMap;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ParameterData {
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(default, skip_serializing_if = "is_false")]
pub required: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub deprecated: Option<bool>,
#[serde(flatten)]
pub format: ParameterSchemaOrContent,
#[serde(skip_serializing_if = "Option::is_none")]
pub example: Option<serde_json::Value>,
#[serde(default, skip_serializing_if = "IndexMap::is_empty")]
pub examples: IndexMap<String, ReferenceOr<Example>>,
#[serde(flatten)]
pub extensions: IndexMap<String, serde_json::Value>,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum ParameterSchemaOrContent {
#[serde(rename = "schema")]
Schema(ReferenceOr<Schema>),
#[serde(rename = "content")]
Content(Content),
}
pub type Content = IndexMap<String, MediaType>;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[serde(tag = "in")]
pub enum Parameter {
#[serde(rename = "query")]
Query {
#[serde(flatten)]
parameter_data: ParameterData,
#[serde(default)]
#[serde(rename = "allowReserved", skip_serializing_if = "is_false")]
allow_reserved: bool,
#[serde(default)]
style: QueryStyle,
#[serde(rename = "allowEmptyValue", skip_serializing_if = "Option::is_none")]
allow_empty_value: Option<bool>,
},
#[serde(rename = "header")]
Header {
#[serde(flatten)]
parameter_data: ParameterData,
#[serde(default)]
style: HeaderStyle,
},
#[serde(rename = "path")]
Path {
#[serde(flatten)]
parameter_data: ParameterData,
#[serde(default)]
style: PathStyle,
},
#[serde(rename = "cookie")]
Cookie {
#[serde(flatten)]
parameter_data: ParameterData,
#[serde(default)]
style: CookieStyle,
},
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub enum PathStyle {
#[serde(rename = "matrix")]
Matrix,
#[serde(rename = "label")]
Label,
#[serde(rename = "simple")]
Simple,
}
impl Default for PathStyle {
fn default() -> Self {
PathStyle::Simple
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub enum QueryStyle {
#[serde(rename = "form")]
Form,
#[serde(rename = "spaceDelimited")]
SpaceDelimited,
#[serde(rename = "pipeDelimited")]
PipeDelimited,
#[serde(rename = "deepObject")]
DeepObject,
}
impl Default for QueryStyle {
fn default() -> Self {
QueryStyle::Form
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub enum CookieStyle {
#[serde(rename = "form")]
Form,
}
impl Default for CookieStyle {
fn default() -> CookieStyle {
CookieStyle::Form
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub enum HeaderStyle {
#[serde(rename = "simple")]
Simple,
}
impl Default for HeaderStyle {
fn default() -> HeaderStyle {
HeaderStyle::Simple
}
}