Skip to content

Commit 7f71135

Browse files
committed
Rework _field2parameter to separate "multiple" logic
1 parent 9fc1cab commit 7f71135

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/apispec/ext/marshmallow/openapi.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,20 @@ def _field2parameter(
165165
)
166166

167167
prop = self.field2property(field)
168-
multiple = isinstance(field, marshmallow.fields.List)
169-
170168
if self.openapi_version.major < 3:
171-
if multiple:
172-
ret["collectionFormat"] = "multi"
173169
ret.update(prop)
174170
else:
175-
if multiple:
176-
ret["explode"] = True
177-
ret["style"] = "form"
178171
if prop.get("description", None):
179172
ret["description"] = prop.pop("description")
180173
ret["schema"] = prop
174+
175+
multiple = isinstance(field, marshmallow.fields.List)
176+
if multiple:
177+
if self.openapi_version.major < 3:
178+
ret["collectionFormat"] = "multi"
179+
else:
180+
ret["explode"] = True
181+
ret["style"] = "form"
181182
return ret
182183

183184
def schema2jsonschema(self, schema):

0 commit comments

Comments
 (0)