@@ -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).
96
- See [Path Templating](#pathTemplating) for further 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,7 +104,7 @@ class Parameter(BaseModel):
128
104
Default value is `false`.
129
105
"""
130
106
131
- allowEmptyValue : bool = False
107
+ allowEmptyValue : Optional [ bool ] = None
132
108
"""
133
109
Sets the ability to pass empty-valued parameters.
134
110
This is valid only for `query` parameters and allows sending a parameter with an
@@ -165,7 +141,7 @@ class Parameter(BaseModel):
165
141
For all other styles, the default value is `false`.
166
142
"""
167
143
168
- allowReserved : bool = False
144
+ allowReserved : Optional [ bool ] = None
169
145
"""
170
146
Determines whether the parameter value SHOULD allow reserved characters,
171
147
as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2)
@@ -231,3 +207,35 @@ class Config:
231
207
extra = Extra .allow
232
208
allow_population_by_field_name = True
233
209
schema_extra = {"examples" : _examples }
210
+
211
+
212
+ class Parameter (ParameterBase ):
213
+ """
214
+ Describes a single operation parameter.
215
+
216
+ A unique parameter is defined by a combination of a [name](#parameterName) and
217
+ [location](#parameterIn).
218
+ """
219
+
220
+ """Fixed Fields"""
221
+
222
+ name : str
223
+ """
224
+ **REQUIRED**. The name of the parameter.
225
+ Parameter names are *case sensitive*.
226
+
227
+ - If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to a
228
+ template expression occurring within the [path](#pathsPath) field in the
229
+ [Paths Object](#pathsObject).
230
+ See [Path Templating](#pathTemplating) for further information.
231
+ - If [`in`](#parameterIn) is `"header"` and the `name` field is `"Accept"`,
232
+ `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.
233
+ - For all other cases, the `name` corresponds to the parameter name used by the
234
+ [`in`](#parameterIn) property.
235
+ """
236
+
237
+ param_in : ParameterLocation = Field (alias = "in" )
238
+ """
239
+ **REQUIRED**. The location of the parameter. Possible values are `"query"`,
240
+ `"header"`, `"path"` or `"cookie"`.
241
+ """
0 commit comments