Skip to content

Commit b651020

Browse files
committed
[FIX] Pig(RootModel...
1 parent a925bbd commit b651020

390 files changed

Lines changed: 1053 additions & 772 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/openapi-generator/src/main/resources/python/model_anyof.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class {{classname}}(RootModel[Union[{{#anyOf}}{{.}}{{^-last}}, {{/-last}}{{/anyO
1717
{{{description}}}{{^description}}{{{classname}}}{{/description}}
1818
"""
1919
root: Union[{{#anyOf}}{{.}}{{^-last}}, {{/-last}}{{/anyOf}}{{#isNullable}}, None{{/isNullable}}] = Field(
20-
{{#isNullable}}None{{/isNullable}}{{^isNullable}}...{{/isNullable}}{{#discriminator}}, discriminator="{{discriminatorName}}"{{/discriminator}}
20+
{{#isNullable}}None{{/isNullable}}{{^isNullable}}...{{/isNullable}}{{#discriminator}}{{/discriminator}}
2121
)
2222

2323
def __getattr__(self, name):

modules/openapi-generator/src/main/resources/python/model_generic.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
168168

169169
def to_dict(self) -> Dict[str, Any]:
170170
"""Returns the dict representation of the actual instance"""
171-
return self.model_dump(by_alias=True)
171+
return self.model_dump(by_alias=True, exclude_unset=True)
172172

173173
def to_json(self) -> str:
174174
"""Returns the JSON representation of the actual instance"""
175-
return json.dumps(self.model_dump(by_alias=True, exclude_none=True, mode="json"))
175+
return json.dumps(self.model_dump(by_alias=True, exclude_unset=True, mode="json"))
176176

177177
def to_str(self) -> str:
178178
"""Returns the string representation of the model using alias"""

modules/openapi-generator/src/main/resources/python/model_oneof.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class {{classname}}(RootModel[Union[{{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/on
1717
{{{description}}}{{^description}}{{{classname}}}{{/description}}
1818
"""
1919
root: Union[{{#oneOf}}{{.}}{{^-last}}, {{/-last}}{{/oneOf}}{{#isNullable}}, None{{/isNullable}}] = Field(
20-
{{#isNullable}}None{{/isNullable}}{{^isNullable}}...{{/isNullable}}{{#discriminator}}, discriminator="{{discriminatorName}}"{{/discriminator}}
20+
{{#isNullable}}None{{/isNullable}}{{^isNullable}}...{{/isNullable}}{{#discriminator}}{{/discriminator}}
2121
)
2222

2323
def __getattr__(self, name):

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/models/bird.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ def from_json(cls, json_str: str) -> Self:
5151

5252
def to_dict(self) -> Dict[str, Any]:
5353
"""Returns the dict representation of the actual instance"""
54-
return self.model_dump(by_alias=True)
54+
return self.model_dump(by_alias=True, exclude_unset=True)
5555

5656
def to_json(self) -> str:
5757
"""Returns the JSON representation of the actual instance"""
58-
return json.dumps(self.model_dump(by_alias=True, exclude_none=True, mode="json"))
58+
return json.dumps(self.model_dump(by_alias=True, exclude_unset=True, mode="json"))
5959

6060
def to_str(self) -> str:
6161
"""Returns the string representation of the model using alias"""

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/models/category.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ def from_json(cls, json_str: str) -> Self:
5151

5252
def to_dict(self) -> Dict[str, Any]:
5353
"""Returns the dict representation of the actual instance"""
54-
return self.model_dump(by_alias=True)
54+
return self.model_dump(by_alias=True, exclude_unset=True)
5555

5656
def to_json(self) -> str:
5757
"""Returns the JSON representation of the actual instance"""
58-
return json.dumps(self.model_dump(by_alias=True, exclude_none=True, mode="json"))
58+
return json.dumps(self.model_dump(by_alias=True, exclude_unset=True, mode="json"))
5959

6060
def to_str(self) -> str:
6161
"""Returns the string representation of the model using alias"""

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/models/data_query.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ def from_json(cls, json_str: str) -> Self:
5454

5555
def to_dict(self) -> Dict[str, Any]:
5656
"""Returns the dict representation of the actual instance"""
57-
return self.model_dump(by_alias=True)
57+
return self.model_dump(by_alias=True, exclude_unset=True)
5858

5959
def to_json(self) -> str:
6060
"""Returns the JSON representation of the actual instance"""
61-
return json.dumps(self.model_dump(by_alias=True, exclude_none=True, mode="json"))
61+
return json.dumps(self.model_dump(by_alias=True, exclude_unset=True, mode="json"))
6262

6363
def to_str(self) -> str:
6464
"""Returns the string representation of the model using alias"""

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/models/default_value.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ def from_json(cls, json_str: str) -> Self:
7272

7373
def to_dict(self) -> Dict[str, Any]:
7474
"""Returns the dict representation of the actual instance"""
75-
return self.model_dump(by_alias=True)
75+
return self.model_dump(by_alias=True, exclude_unset=True)
7676

7777
def to_json(self) -> str:
7878
"""Returns the JSON representation of the actual instance"""
79-
return json.dumps(self.model_dump(by_alias=True, exclude_none=True, mode="json"))
79+
return json.dumps(self.model_dump(by_alias=True, exclude_unset=True, mode="json"))
8080

8181
def to_str(self) -> str:
8282
"""Returns the string representation of the model using alias"""

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/models/number_properties_only.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ def from_json(cls, json_str: str) -> Self:
5353

5454
def to_dict(self) -> Dict[str, Any]:
5555
"""Returns the dict representation of the actual instance"""
56-
return self.model_dump(by_alias=True)
56+
return self.model_dump(by_alias=True, exclude_unset=True)
5757

5858
def to_json(self) -> str:
5959
"""Returns the JSON representation of the actual instance"""
60-
return json.dumps(self.model_dump(by_alias=True, exclude_none=True, mode="json"))
60+
return json.dumps(self.model_dump(by_alias=True, exclude_unset=True, mode="json"))
6161

6262
def to_str(self) -> str:
6363
"""Returns the string representation of the model using alias"""

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/models/pet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ def from_json(cls, json_str: str) -> Self:
7070

7171
def to_dict(self) -> Dict[str, Any]:
7272
"""Returns the dict representation of the actual instance"""
73-
return self.model_dump(by_alias=True)
73+
return self.model_dump(by_alias=True, exclude_unset=True)
7474

7575
def to_json(self) -> str:
7676
"""Returns the JSON representation of the actual instance"""
77-
return json.dumps(self.model_dump(by_alias=True, exclude_none=True, mode="json"))
77+
return json.dumps(self.model_dump(by_alias=True, exclude_unset=True, mode="json"))
7878

7979
def to_str(self) -> str:
8080
"""Returns the string representation of the model using alias"""

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/models/query.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ def from_json(cls, json_str: str) -> Self:
6565

6666
def to_dict(self) -> Dict[str, Any]:
6767
"""Returns the dict representation of the actual instance"""
68-
return self.model_dump(by_alias=True)
68+
return self.model_dump(by_alias=True, exclude_unset=True)
6969

7070
def to_json(self) -> str:
7171
"""Returns the JSON representation of the actual instance"""
72-
return json.dumps(self.model_dump(by_alias=True, exclude_none=True, mode="json"))
72+
return json.dumps(self.model_dump(by_alias=True, exclude_unset=True, mode="json"))
7373

7474
def to_str(self) -> str:
7575
"""Returns the string representation of the model using alias"""

0 commit comments

Comments
 (0)