forked from loafle/openapi-generator-original
parent
2b6b3b0883
commit
384ff941ae
@ -55,12 +55,22 @@ class UnnamedDictWithAdditionalModelListProperties(BaseModel):
|
||||
"""Create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.model_dump(by_alias=True,
|
||||
exclude={
|
||||
},
|
||||
exclude_none=True)
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude={
|
||||
},
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of each value in dict_property (dict of array)
|
||||
_field_dict_of_array = {}
|
||||
if self.dict_property:
|
||||
|
@ -54,12 +54,22 @@ class UnnamedDictWithAdditionalStringListProperties(BaseModel):
|
||||
"""Create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.model_dump(by_alias=True,
|
||||
exclude={
|
||||
},
|
||||
exclude_none=True)
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude={
|
||||
},
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
|
@ -56,13 +56,24 @@ class UnnamedDictWithAdditionalModelListProperties(BaseModel):
|
||||
"""Create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.model_dump(by_alias=True,
|
||||
exclude={
|
||||
"additional_properties"
|
||||
},
|
||||
exclude_none=True)
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
* Fields in `self.additional_properties` are added to the output dict.
|
||||
"""
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude={
|
||||
"additional_properties",
|
||||
},
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of each value in dict_property (dict of array)
|
||||
_field_dict_of_array = {}
|
||||
if self.dict_property:
|
||||
|
@ -55,13 +55,24 @@ class UnnamedDictWithAdditionalStringListProperties(BaseModel):
|
||||
"""Create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.model_dump(by_alias=True,
|
||||
exclude={
|
||||
"additional_properties"
|
||||
},
|
||||
exclude_none=True)
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
* Fields in `self.additional_properties` are added to the output dict.
|
||||
"""
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude={
|
||||
"additional_properties",
|
||||
},
|
||||
exclude_none=True,
|
||||
)
|
||||
# puts key-value pairs in additional_properties in the top level
|
||||
if self.additional_properties is not None:
|
||||
for _key, _value in self.additional_properties.items():
|
||||
|
Loading…
x
Reference in New Issue
Block a user