eadwinCode / ninja-schema

Ninja Schema is Pydantic full support for Django ORM.
MIT License
41 stars 1 forks source link

`PydanticDeprecatedSince20` warning is emitted on import of `Schema` #10

Closed dzonecat closed 10 months ago

dzonecat commented 10 months ago

When doing

from ninja_schema import Schema

the following warning is emitted:

[...]/3.11.6/lib/python3.11/site-packages/pydantic/_migration.py:290: UserWarning: `pydantic.utils:is_valid_field` has been removed. We are importing from `pydantic.v1.utils:is_valid_field` instead.See the migration guide for more details: https://docs.pydantic.dev/latest/migration/

This is because is_valid_field is imported in pydanticutils/__init__.py.

Although the code still does the right thing, I would prefer it not to be alerted with warnings on software startup.

I found no easy way to fix it because the functionality moved to _internal/_fields.py:is_valid_field_name() in pydantic V2, which should not be used by other packages.

Versions:

ninja-schema==0.13.5
pydantic==2.5.2
python==3.11.6
eadwinCode commented 10 months ago

@dzonecat let me look into this

dzonecat commented 10 months ago

It is fixed for me with 0.13.6. Thanks a lot!