Skip to content

Commit 6460f34

Browse files
committed
revert for fastapi generator and apply pydantic constrain everywhere
1 parent 5918e69 commit 6460f34

13 files changed

Lines changed: 13 additions & 20 deletions

File tree

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
8181
{{/vars}}
8282

8383
model_config = {
84-
"validate_by_name": True,
85-
"validate_by_alias": True,
84+
"populate_by_name": True,
8685
"validate_assignment": True,
8786
"protected_namespaces": (),
8887
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ dependencies = [
7979
"pem (>=19.3.0)",
8080
"pycryptodome (>=3.9.0)",
8181
{{/hasHttpSignatureMethods}}
82-
"pydantic (>=2)",
82+
"pydantic (>=2.11)",
8383
"typing-extensions (>=4.7.1)",
8484
{{#lazyImports}}
8585
"lazy-imports (>=1,<2)"

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ requires-python = ">=3.9"
1313
dependencies = [
1414
"urllib3 (>=2.1.0,<3.0.0)",
1515
"python-dateutil (>=2.8.2)",
16-
"pydantic (>=2)",
16+
"pydantic (>=2.11)",
1717
"typing-extensions (>=4.7.1)",
1818
]
1919

samples/client/echo_api/python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ requires-python = ">=3.9"
1313
dependencies = [
1414
"urllib3 (>=2.1.0,<3.0.0)",
1515
"python-dateutil (>=2.8.2)",
16-
"pydantic (>=2)",
16+
"pydantic (>=2.11)",
1717
"typing-extensions (>=4.7.1)",
1818
]
1919

samples/openapi3/client/petstore/python-httpx/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies = [
1515
"httpx (>=0.28.1)",
1616
"pem (>=19.3.0)",
1717
"pycryptodome (>=3.9.0)",
18-
"pydantic (>=2)",
18+
"pydantic (>=2.11)",
1919
"typing-extensions (>=4.7.1)",
2020
]
2121

samples/openapi3/client/petstore/python-lazyImports/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies = [
1515
"python-dateutil (>=2.8.2)",
1616
"pem (>=19.3.0)",
1717
"pycryptodome (>=3.9.0)",
18-
"pydantic (>=2)",
18+
"pydantic (>=2.11)",
1919
"typing-extensions (>=4.7.1)",
2020
"lazy-imports (>=1,<2)"
2121
]

samples/openapi3/client/petstore/python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies = [
1515
"python-dateutil (>=2.8.2)",
1616
"pem (>=19.3.0)",
1717
"pycryptodome (>=3.9.0)",
18-
"pydantic (>=2)",
18+
"pydantic (>=2.11)",
1919
"typing-extensions (>=4.7.1)",
2020
]
2121

samples/server/petstore/python-fastapi/src/openapi_server/models/api_response.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ class ApiResponse(BaseModel):
3737
__properties: ClassVar[List[str]] = ["code", "type", "message"]
3838

3939
model_config = {
40-
"validate_by_name": True,
41-
"validate_by_alias": True,
40+
"populate_by_name": True,
4241
"validate_assignment": True,
4342
"protected_namespaces": (),
4443
}

samples/server/petstore/python-fastapi/src/openapi_server/models/category.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ def name_validate_regular_expression(cls, value):
4747
return value
4848

4949
model_config = {
50-
"validate_by_name": True,
51-
"validate_by_alias": True,
50+
"populate_by_name": True,
5251
"validate_assignment": True,
5352
"protected_namespaces": (),
5453
}

samples/server/petstore/python-fastapi/src/openapi_server/models/order.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ def status_validate_enum(cls, value):
5151
return value
5252

5353
model_config = {
54-
"validate_by_name": True,
55-
"validate_by_alias": True,
54+
"populate_by_name": True,
5655
"validate_assignment": True,
5756
"protected_namespaces": (),
5857
}

0 commit comments

Comments
 (0)