Skip to content
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

[Feature request] support Pydantic v2 syntax / @validator -> @field_validator #150

Open
copdips opened this issue Sep 1, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@copdips
Copy link
Contributor

copdips commented Sep 1, 2023

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)

@copdips copdips added the enhancement New feature or request label Sep 1, 2023
@martimors
Copy link

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.

@JonasKs
Copy link
Member

JonasKs commented Oct 3, 2023

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? #144

@martimors
Copy link

martimors commented Oct 3, 2023

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.

@JonasKs
Copy link
Member

JonasKs commented Oct 4, 2023

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.

@nikstuckenbrock
Copy link
Contributor

Hey @JonasKs,

I've updated the docs according to pydantic v2, would appreciate your feedback on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants