Skip to content

Replaced pydantic_core deprecated method #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pydantic_extra_types/country.py
Original file line number Diff line number Diff line change
@@ -95,7 +95,7 @@ def _validate(cls, __input_value: str, _: core_schema.ValidationInfo) -> Country
def __get_pydantic_core_schema__(
cls, source: type[Any], handler: GetCoreSchemaHandler
) -> core_schema.AfterValidatorFunctionSchema:
return core_schema.general_after_validator_function(
return core_schema.with_info_after_validator_function(
cls._validate,
core_schema.str_schema(to_upper=True),
)
@@ -158,7 +158,7 @@ def _validate(cls, __input_value: str, _: core_schema.ValidationInfo) -> Country
def __get_pydantic_core_schema__(
cls, source: type[Any], handler: GetCoreSchemaHandler
) -> core_schema.AfterValidatorFunctionSchema:
return core_schema.general_after_validator_function(
return core_schema.with_info_after_validator_function(
cls._validate,
core_schema.str_schema(to_upper=True),
serialization=core_schema.to_string_ser_schema(),
@@ -222,7 +222,7 @@ def _validate(cls, __input_value: str, _: core_schema.ValidationInfo) -> Country
def __get_pydantic_core_schema__(
cls, source: type[Any], handler: GetCoreSchemaHandler
) -> core_schema.AfterValidatorFunctionSchema:
return core_schema.general_after_validator_function(
return core_schema.with_info_after_validator_function(
cls._validate,
core_schema.str_schema(to_upper=True),
serialization=core_schema.to_string_ser_schema(),
@@ -285,7 +285,7 @@ def _validate(cls, __input_value: str, _: core_schema.ValidationInfo) -> Country
def __get_pydantic_core_schema__(
cls, source: type[Any], handler: GetCoreSchemaHandler
) -> core_schema.AfterValidatorFunctionSchema:
return core_schema.general_after_validator_function(
return core_schema.with_info_after_validator_function(
cls._validate,
core_schema.str_schema(),
serialization=core_schema.to_string_ser_schema(),
@@ -340,7 +340,7 @@ def _validate(cls, __input_value: str, _: core_schema.ValidationInfo) -> Country
def __get_pydantic_core_schema__(
cls, source: type[Any], handler: GetCoreSchemaHandler
) -> core_schema.AfterValidatorFunctionSchema:
return core_schema.general_after_validator_function(
return core_schema.with_info_after_validator_function(
cls._validate,
core_schema.str_schema(),
serialization=core_schema.to_string_ser_schema(),
2 changes: 1 addition & 1 deletion pydantic_extra_types/payment.py
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ def __init__(self, card_number: str):

@classmethod
def __get_pydantic_core_schema__(cls, source: type[Any], handler: GetCoreSchemaHandler) -> core_schema.CoreSchema:
return core_schema.general_after_validator_function(
return core_schema.with_info_after_validator_function(
cls.validate,
core_schema.str_schema(
min_length=cls.min_length, max_length=cls.max_length, strip_whitespace=cls.strip_whitespace
2 changes: 1 addition & 1 deletion pydantic_extra_types/phone_numbers.py
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ class PhoneNumber(str):

@classmethod
def __get_pydantic_core_schema__(cls, source: type[Any], handler: GetCoreSchemaHandler) -> core_schema.CoreSchema:
return core_schema.general_after_validator_function(
return core_schema.with_info_after_validator_function(
cls._validate,
core_schema.str_schema(min_length=cls.min_length, max_length=cls.max_length),
)
2 changes: 1 addition & 1 deletion pydantic_extra_types/routing_number.py
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ def __init__(self, routing_number: str):
def __get_pydantic_core_schema__(
cls, source: Type[Any], handler: GetCoreSchemaHandler
) -> core_schema.AfterValidatorFunctionSchema:
return core_schema.general_after_validator_function(
return core_schema.with_info_after_validator_function(
cls._validate,
core_schema.str_schema(
min_length=cls.min_length,