-
Notifications
You must be signed in to change notification settings - Fork 171
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
DeprecationWarning: FieldValidationInfo
is deprecated
#191
Labels
pydantic v2
Issues related to being between Pydantic v1 and v2
Comments
diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml
index afed84b..11abcc4 100644
--- a/.github/workflows/build_and_test.yml
+++ b/.github/workflows/build_and_test.yml
@@ -31,7 +31,7 @@ jobs:
pip install 'pydantic${{ matrix.pydantic-version }}'
- name: Test with unittest
run: |
- python -m unittest
+ python -W err -m unittest
- name: Run mypy
run: |
python -m mypy webauthn
diff --git a/webauthn/helpers/structs.py b/webauthn/helpers/structs.py
index 5bada95..1542b8d 100644
--- a/webauthn/helpers/structs.py
+++ b/webauthn/helpers/structs.py
@@ -7,7 +7,7 @@ try:
BaseModel,
field_validator,
ConfigDict,
- FieldValidationInfo,
+ ValidationInfo,
model_serializer,
)
@@ -66,24 +66,9 @@ class WebAuthnBaseModel(BaseModel):
@field_validator("*", mode="before")
def _pydantic_v2_validate_bytes_fields(
- cls, v: Any, info: FieldValidationInfo # type: ignore[valid-type]
+ cls, v: Any, info: ValidationInfo
) -> Any:
- """
- `FieldValidationInfo` above is being deprecated for `ValidationInfo`, see the following:
-
- - https://github.com/pydantic/pydantic-core/issues/994
- - https://github.com/pydantic/pydantic/issues/7667
-
- There are now docs for the new way to access `field_name` that's only available in
- Pydantic v2.4+...
-
- https://docs.pydantic.dev/latest/concepts/types/#access-to-field-name
-
- This use of `FieldValidationInfo` will continue to work for now, but when it gets
- removed from Pydantic the `info.field_name` below will need to get updated to
- `info.data.field_name` after changing the type of `info` above to `ValidationInfo`
- """
- field = cls.model_fields[info.field_name] # type: ignore[attr-defined]
+ field = cls.model_fields[info.field_name] # type: ignore[index]
if field.annotation != bytes:
return v |
This was referenced Jan 5, 2024
This will end up getting closed out if/when I move forward with #195. |
I've merged #195 which removed Pydantic as a dependency of this project so I'm closing out any PR's and issues related to Pydantic as they're no longer needed. |
MasterKale
added
the
pydantic v2
Issues related to being between Pydantic v1 and v2
label
Jan 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When running with
-W err
webauthn raises aDeprecationWarning
:The text was updated successfully, but these errors were encountered: