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"""
|
"""Create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string"""
|
||||||
return cls.from_dict(json.loads(json_str))
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
"""Returns the dictionary representation of the model using alias"""
|
"""Return the dictionary representation of the model using alias.
|
||||||
_dict = self.model_dump(by_alias=True,
|
|
||||||
exclude={
|
This has the following differences from calling pydantic's
|
||||||
},
|
`self.model_dump(by_alias=True)`:
|
||||||
exclude_none=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)
|
# override the default output from pydantic by calling `to_dict()` of each value in dict_property (dict of array)
|
||||||
_field_dict_of_array = {}
|
_field_dict_of_array = {}
|
||||||
if self.dict_property:
|
if self.dict_property:
|
||||||
|
@ -54,12 +54,22 @@ class UnnamedDictWithAdditionalStringListProperties(BaseModel):
|
|||||||
"""Create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string"""
|
"""Create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string"""
|
||||||
return cls.from_dict(json.loads(json_str))
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
"""Returns the dictionary representation of the model using alias"""
|
"""Return the dictionary representation of the model using alias.
|
||||||
_dict = self.model_dump(by_alias=True,
|
|
||||||
exclude={
|
This has the following differences from calling pydantic's
|
||||||
},
|
`self.model_dump(by_alias=True)`:
|
||||||
exclude_none=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
|
return _dict
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -56,13 +56,24 @@ class UnnamedDictWithAdditionalModelListProperties(BaseModel):
|
|||||||
"""Create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string"""
|
"""Create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string"""
|
||||||
return cls.from_dict(json.loads(json_str))
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
"""Returns the dictionary representation of the model using alias"""
|
"""Return the dictionary representation of the model using alias.
|
||||||
_dict = self.model_dump(by_alias=True,
|
|
||||||
exclude={
|
This has the following differences from calling pydantic's
|
||||||
"additional_properties"
|
`self.model_dump(by_alias=True)`:
|
||||||
},
|
|
||||||
exclude_none=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)
|
# override the default output from pydantic by calling `to_dict()` of each value in dict_property (dict of array)
|
||||||
_field_dict_of_array = {}
|
_field_dict_of_array = {}
|
||||||
if self.dict_property:
|
if self.dict_property:
|
||||||
|
@ -55,13 +55,24 @@ class UnnamedDictWithAdditionalStringListProperties(BaseModel):
|
|||||||
"""Create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string"""
|
"""Create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string"""
|
||||||
return cls.from_dict(json.loads(json_str))
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
"""Returns the dictionary representation of the model using alias"""
|
"""Return the dictionary representation of the model using alias.
|
||||||
_dict = self.model_dump(by_alias=True,
|
|
||||||
exclude={
|
This has the following differences from calling pydantic's
|
||||||
"additional_properties"
|
`self.model_dump(by_alias=True)`:
|
||||||
},
|
|
||||||
exclude_none=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
|
# puts key-value pairs in additional_properties in the top level
|
||||||
if self.additional_properties is not None:
|
if self.additional_properties is not None:
|
||||||
for _key, _value in self.additional_properties.items():
|
for _key, _value in self.additional_properties.items():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user