forked from loafle/openapi-generator-original
python-pydantic-v1: Return the primitive type in to_dict for anyOf models (#19488)
* python: Return the primitive type in to_dict for anyOf models * Regenerate samples * Update test
This commit is contained in:
@@ -146,7 +146,8 @@ class AnyOfColor(BaseModel):
|
||||
if callable(to_json):
|
||||
return self.actual_instance.to_dict()
|
||||
else:
|
||||
return json.dumps(self.actual_instance)
|
||||
# primitive type
|
||||
return self.actual_instance
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the actual instance"""
|
||||
|
||||
@@ -125,7 +125,8 @@ class AnyOfPig(BaseModel):
|
||||
if callable(to_json):
|
||||
return self.actual_instance.to_dict()
|
||||
else:
|
||||
return json.dumps(self.actual_instance)
|
||||
# primitive type
|
||||
return self.actual_instance
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the actual instance"""
|
||||
|
||||
Reference in New Issue
Block a user