Skip to content

Commit ed84fb5

Browse files
committed
cleanup
1 parent 9a41599 commit ed84fb5

411 files changed

Lines changed: 1177 additions & 794 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
@@ -36,7 +36,7 @@ class {{classname}}(RootModel[Union[{{#anyOf}}{{.}}{{^-last}}, {{/-last}}{{/anyO
3636
@classmethod
3737
def from_dict(cls, obj: Dict[str, Any]) -> Self:
3838
"""Returns the object represented by the python Dict"""
39-
return cls.model_validate(obj)
39+
return cls.model_validate(obj, strict=True)
4040

4141
@classmethod
4242
def from_json(cls, json_str: str) -> Self:

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import re # noqa: F401
88
{{#vendorExtensions.x-py-model-imports}}
99
{{{.}}}
1010
{{/vendorExtensions.x-py-model-imports}}
11-
from typing import Self
11+
from typing import Literal, Self
12+
from pydantic import Field
1213

1314
{{#hasChildren}}
1415
{{#discriminator}}
@@ -156,7 +157,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
156157
@classmethod
157158
def from_dict(cls, obj: Dict[str, Any]) -> Self:
158159
"""Returns the object represented by the Dict"""
159-
return cls.model_validate(obj)
160+
return cls.model_validate(obj, strict=True)
160161

161162
@classmethod
162163
def from_json(cls, json_str: str) -> Self:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class {{classname}}(RootModel[Union[{{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/on
3636
@classmethod
3737
def from_dict(cls, obj: Dict[str, Any]) -> Self:
3838
"""Returns the object represented by the python Dict"""
39-
return cls.model_validate(obj)
39+
return cls.model_validate(obj, strict=True)
4040

4141
@classmethod
4242
def from_json(cls, json_str: str) -> Self:

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
from pydantic import BaseModel, ConfigDict, StrictStr
2121
from typing import Any, ClassVar, Dict, List, Optional
22-
from typing import Self
22+
from typing import Literal, Self
23+
from pydantic import Field
2324

2425
class Bird(BaseModel):
2526
"""
@@ -39,7 +40,7 @@ class Bird(BaseModel):
3940
@classmethod
4041
def from_dict(cls, obj: Dict[str, Any]) -> Self:
4142
"""Returns the object represented by the Dict"""
42-
return cls.model_validate(obj)
43+
return cls.model_validate(obj, strict=True)
4344

4445
@classmethod
4546
def from_json(cls, json_str: str) -> Self:

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
2121
from typing import Any, ClassVar, Dict, List, Optional
22-
from typing import Self
22+
from typing import Literal, Self
23+
from pydantic import Field
2324

2425
class Category(BaseModel):
2526
"""
@@ -39,7 +40,7 @@ class Category(BaseModel):
3940
@classmethod
4041
def from_dict(cls, obj: Dict[str, Any]) -> Self:
4142
"""Returns the object represented by the Dict"""
42-
return cls.model_validate(obj)
43+
return cls.model_validate(obj, strict=True)
4344

4445
@classmethod
4546
def from_json(cls, json_str: str) -> Self:

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
from pydantic import ConfigDict, Field, StrictStr
2222
from typing import Any, ClassVar, Dict, List, Optional
2323
from openapi_client.models.query import Query
24-
from typing import Self
24+
from typing import Literal, Self
25+
from pydantic import Field
2526

2627
class DataQuery(Query):
2728
"""
@@ -42,7 +43,7 @@ class DataQuery(Query):
4243
@classmethod
4344
def from_dict(cls, obj: Dict[str, Any]) -> Self:
4445
"""Returns the object represented by the Dict"""
45-
return cls.model_validate(obj)
46+
return cls.model_validate(obj, strict=True)
4647

4748
@classmethod
4849
def from_json(cls, json_str: str) -> Self:

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator
2121
from typing import Any, ClassVar, Dict, List, Optional
2222
from openapi_client.models.string_enum_ref import StringEnumRef
23-
from typing import Self
23+
from typing import Literal, Self
24+
from pydantic import Field
2425

2526
class DefaultValue(BaseModel):
2627
"""
@@ -60,7 +61,7 @@ def array_string_enum_default_validate_enum(cls, value):
6061
@classmethod
6162
def from_dict(cls, obj: Dict[str, Any]) -> Self:
6263
"""Returns the object represented by the Dict"""
63-
return cls.model_validate(obj)
64+
return cls.model_validate(obj, strict=True)
6465

6566
@classmethod
6667
def from_json(cls, json_str: str) -> Self:

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
2121
from typing import Any, ClassVar, Dict, List, Optional, Union
2222
from typing_extensions import Annotated
23-
from typing import Self
23+
from typing import Literal, Self
24+
from pydantic import Field
2425

2526
class NumberPropertiesOnly(BaseModel):
2627
"""
@@ -41,7 +42,7 @@ class NumberPropertiesOnly(BaseModel):
4142
@classmethod
4243
def from_dict(cls, obj: Dict[str, Any]) -> Self:
4344
"""Returns the object represented by the Dict"""
44-
return cls.model_validate(obj)
45+
return cls.model_validate(obj, strict=True)
4546

4647
@classmethod
4748
def from_json(cls, json_str: str) -> Self:

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
from typing import Any, ClassVar, Dict, List, Optional
2222
from openapi_client.models.category import Category
2323
from openapi_client.models.tag import Tag
24-
from typing import Self
24+
from typing import Literal, Self
25+
from pydantic import Field
2526

2627
class Pet(BaseModel):
2728
"""
@@ -58,7 +59,7 @@ def status_validate_enum(cls, value):
5859
@classmethod
5960
def from_dict(cls, obj: Dict[str, Any]) -> Self:
6061
"""Returns the object represented by the Dict"""
61-
return cls.model_validate(obj)
62+
return cls.model_validate(obj, strict=True)
6263

6364
@classmethod
6465
def from_json(cls, json_str: str) -> Self:

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
2121
from typing import Any, ClassVar, Dict, List, Optional
22-
from typing import Self
22+
from typing import Literal, Self
23+
from pydantic import Field
2324

2425
class Query(BaseModel):
2526
"""
@@ -53,7 +54,7 @@ def outcomes_validate_enum(cls, value):
5354
@classmethod
5455
def from_dict(cls, obj: Dict[str, Any]) -> Self:
5556
"""Returns the object represented by the Dict"""
56-
return cls.model_validate(obj)
57+
return cls.model_validate(obj, strict=True)
5758

5859
@classmethod
5960
def from_json(cls, json_str: str) -> Self:

0 commit comments

Comments
 (0)