Skip to content

Commit 16a9740

Browse files
run bump-pydantic
1 parent 02d950e commit 16a9740

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

packages/pytest-simcore/src/pytest_simcore/helpers/httpx_calls_capture_parameters.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
from typing import Literal
22

3-
from pydantic import BaseModel, Field, root_validator, validator
3+
from pydantic import field_validator, model_validator, ConfigDict, BaseModel, Field
44

55
from .httpx_calls_capture_errors import OpenApiSpecError
66

77

88
class CapturedParameterSchema(BaseModel):
9-
title: str | None
10-
type_: Literal["str", "int", "float", "bool"] | None = Field(
11-
None, alias="type", optional=True
12-
)
9+
title: str | None = None
10+
type_: Literal["str", "int", "float", "bool"] | None = Field(None, alias="type")
1311
pattern: str | None
14-
format_: Literal["uuid"] | None = Field(None, alias="format", optional=True)
12+
format_: Literal["uuid"] | None = Field(None, alias="format")
1513
exclusiveMinimum: bool | None
1614
minimum: int | None
1715
anyOf: list["CapturedParameterSchema"] | None
@@ -22,7 +20,7 @@ class Config:
2220
validate_always = True
2321
allow_population_by_field_name = True
2422

25-
@validator("type_", pre=True)
23+
@field_validator("type_", mode="before")
2624
@classmethod
2725
def preprocess_type_(cls, val):
2826
if val == "string":
@@ -33,7 +31,7 @@ def preprocess_type_(cls, val):
3331
val = "bool"
3432
return val
3533

36-
@root_validator(pre=False)
34+
@model_validator(mode="after")
3735
@classmethod
3836
def check_compatibility(cls, values):
3937
type_ = values.get("type_")
@@ -100,10 +98,7 @@ class CapturedParameter(BaseModel):
10098
response_value: str | None = (
10199
None # attribute for storing the params value in a concrete response
102100
)
103-
104-
class Config:
105-
validate_always = True
106-
allow_population_by_field_name = True
101+
model_config = ConfigDict(validate_default=True, populate_by_name=True)
107102

108103
def __hash__(self):
109104
return hash(

0 commit comments

Comments
 (0)