@@ -75,35 +75,11 @@ class ParameterLocation(str, enum.Enum):
75
75
COOKIE = "cookie"
76
76
77
77
78
- class Parameter (BaseModel ):
79
- """
80
- Describes a single operation parameter.
81
-
82
- A unique parameter is defined by a combination of a [name](#parameterName) and
83
- [location](#parameterIn).
84
- """
85
-
86
- """Fixed Fields"""
87
-
88
- name : str
89
- """
90
- **REQUIRED**. The name of the parameter.
91
- Parameter names are *case sensitive*.
92
-
93
- - If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to a
94
- template expression occurring within the [path](#pathsPath) field in the
95
- [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further
96
- information.
97
- - If [`in`](#parameterIn) is `"header"` and the `name` field is `"Accept"`,
98
- `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.
99
- - For all other cases, the `name` corresponds to the parameter name used by the
100
- [`in`](#parameterIn) property.
78
+ class ParameterBase (BaseModel ):
101
79
"""
80
+ Base class for Parameter and Header.
102
81
103
- param_in : ParameterLocation = Field (alias = "in" )
104
- """
105
- **REQUIRED**. The location of the parameter. Possible values are `"query"`,
106
- `"header"`, `"path"` or `"cookie"`.
82
+ (Header is like Parameter, but has no `name` or `in` fields.)
107
83
"""
108
84
109
85
description : Optional [str ] = None
@@ -128,23 +104,6 @@ class Parameter(BaseModel):
128
104
Default value is `false`.
129
105
"""
130
106
131
- allowEmptyValue : bool = False
132
- """
133
- Sets the ability to pass empty-valued parameters.
134
- This is valid only for `query` parameters and allows sending a parameter with an
135
- empty value. Default value is `false`.
136
- If [`style`](#parameterStyle) is used, and if behavior is `n/a` (cannot be
137
- serialized), the value of `allowEmptyValue` SHALL be ignored.
138
- Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later
139
- revision.
140
- """
141
-
142
- """
143
- The rules for serialization of the parameter are specified in one of two ways.
144
- For simpler scenarios, a [`schema`](#parameterSchema) and [`style`](#parameterStyle)
145
- can describe the structure and syntax of the parameter.
146
- """
147
-
148
107
style : Optional [str ] = None
149
108
"""
150
109
Describes how the parameter value will be serialized depending on the type of the
@@ -165,15 +124,6 @@ class Parameter(BaseModel):
165
124
For all other styles, the default value is `false`.
166
125
"""
167
126
168
- allowReserved : bool = False
169
- """
170
- Determines whether the parameter value SHOULD allow reserved characters,
171
- as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2)
172
- `:/?#[]@!$&'()*+,;=` to be included without percent-encoding.
173
- This property only applies to parameters with an `in` value of `query`.
174
- The default value is `false`.
175
- """
176
-
177
127
param_schema : Optional [Union [Reference , Schema ]] = Field (
178
128
default = None , alias = "schema"
179
129
)
@@ -230,3 +180,55 @@ class Config:
230
180
extra = Extra .allow
231
181
allow_population_by_field_name = True
232
182
schema_extra = {"examples" : _examples }
183
+
184
+
185
+ class Parameter (ParameterBase ):
186
+ """
187
+ Describes a single operation parameter.
188
+
189
+ A unique parameter is defined by a combination of a [name](#parameterName) and
190
+ [location](#parameterIn).
191
+ """
192
+
193
+ """Fixed Fields"""
194
+
195
+ name : str
196
+ """
197
+ **REQUIRED**. The name of the parameter.
198
+ Parameter names are *case sensitive*.
199
+
200
+ - If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to a
201
+ template expression occurring within the [path](#pathsPath) field in the
202
+ [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further
203
+ information.
204
+ - If [`in`](#parameterIn) is `"header"` and the `name` field is `"Accept"`,
205
+ `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.
206
+ - For all other cases, the `name` corresponds to the parameter name used by the
207
+ [`in`](#parameterIn) property.
208
+ """
209
+
210
+ param_in : ParameterLocation = Field (alias = "in" )
211
+ """
212
+ **REQUIRED**. The location of the parameter. Possible values are `"query"`,
213
+ `"header"`, `"path"` or `"cookie"`.
214
+ """
215
+
216
+ allowEmptyValue : bool = False
217
+ """
218
+ Sets the ability to pass empty-valued parameters.
219
+ This is valid only for `query` parameters and allows sending a parameter with an
220
+ empty value. Default value is `false`.
221
+ If [`style`](#parameterStyle) is used, and if behavior is `n/a` (cannot be
222
+ serialized), the value of `allowEmptyValue` SHALL be ignored.
223
+ Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later
224
+ revision.
225
+ """
226
+
227
+ allowReserved : bool = False
228
+ """
229
+ Determines whether the parameter value SHOULD allow reserved characters,
230
+ as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2)
231
+ `:/?#[]@!$&'()*+,;=` to be included without percent-encoding.
232
+ This property only applies to parameters with an `in` value of `query`.
233
+ The default value is `false`.
234
+ """
0 commit comments