fastapi-azure-auth
fastapi-azure-auth copied to clipboard
[Feature request] support Pydantic v2 syntax / @validator -> @field_validator
Describe the feature you'd like
I got following warnings:
.venv/lib/python3.10/site-packages/fastapi_azure_auth/user.py:234: PydanticDeprecatedSince20: Pydantic V1 style
@validator
validators are deprecated. You should migrate to Pydantic V2 style@field_validator
validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.3/migration/ @validator('scp', pre=True)
Requesting this library be updated to use pydantic 2.x asap. I think it is ok to drop support for FastAPI versions that don't support pydantic 2.x.
I haven't been able to use Pydantic v2 personally, but as far as I know, it is supported?
What does not work for you? https://github.com/Intility/fastapi-azure-auth/pull/144
Oups - my bad. Yeah, it's supported, but logging deprecation warnings due to using deprecated features such as @validator
, Field
with kwargs etc. I guess that's aligned with the PR you've linked. These will stop working some time in the future when pydantic 2.x finally removes them, but it's probably fine to wait for FastAPI to pin pydantic to >2. Sorry for the noise.
I agree, I do want to migrate to v2 fully. Right now there is a version supporting both, but I'll probably only support v2 going forward(and release a v5), only pushing security fixes to the v4.x releases.
First step is to rewrite all docs to be v2 compliant. I've started with #153 and single-tenant right now. I'd love if someone would like to contribute with migrating multi-tenant and b2c docs.
Hey @JonasKs,
I've updated the docs according to pydantic v2, would appreciate your feedback on it.