forked from loafle/openapi-generator-original
[Python] fix object arrays giving mypy error "Incompatible types in assignment" in to_dict() (#19223)
* [python] mypy fix for multiple arrays of objects * [python] mypy test for multiple arrays of objects
This commit is contained in:
@@ -92,9 +92,9 @@ class Pet(BaseModel):
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in tags (list)
|
||||
_items = []
|
||||
if self.tags:
|
||||
for _item in self.tags:
|
||||
if _item:
|
||||
_items.append(_item.to_dict())
|
||||
for _item_tags in self.tags:
|
||||
if _item_tags:
|
||||
_items.append(_item_tags.to_dict())
|
||||
_dict['tags'] = _items
|
||||
return _dict
|
||||
|
||||
|
||||
Reference in New Issue
Block a user