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

pydantic Field extra deprecationwarning is not clear #7099

Closed
1 task done
danilovmy opened this issue Aug 12, 2023 · 1 comment · Fixed by #7136
Closed
1 task done

pydantic Field extra deprecationwarning is not clear #7099

danilovmy opened this issue Aug 12, 2023 · 1 comment · Fixed by #7136
Assignees
Labels
bug V2 Bug related to Pydantic V2

Comments

@danilovmy
Copy link

danilovmy commented Aug 12, 2023

Initial Checks

  • I confirm that I'm using Pydantic V2

Description

if i start my project i see Deprecationwarning about extra kwargs in Field declaration.

PydanticDeprecatedSince20: Extra keyword arguments on Fieldis deprecated and will be removed. usejson_schema_extra instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.1.1/migration/

I can't made any suggestion about model of Field if i have more than 40 models.

I solve it in fields.py - added next code after 783 row:

783:    if extra:
784:         warn(str(extra), DeprecationWarning)  # i add this warning to see deprecated extra kwargs.
785:         warn('Extra keyword arguments on `Field` is .....', DeprecationWarning)

it helps me to migrate to V2 faster.
I think it should exists by default

Example Code

No response

Python, Pydantic & OS Version

pydantic version: 2.1.1                                                                                                                                          
        pydantic-core version: 2.4.0                                                                                                                                          
          pydantic-core build: profile=release pgo=false mimalloc=true                                                                                                        
                 install path: C:\picnic\Lib\site-packages\pydantic                                                                                                           
               python version: 3.11.1 (tags/v3.11.1:a7a450f, Dec  6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)]                                                               
                     platform: Windows-10-10.0.19045-SP0                                                                                                                      
     optional deps. installed: ['typing-extensions']

Selected Assignee: @lig

@danilovmy danilovmy added bug V2 Bug related to Pydantic V2 unconfirmed Bug not yet confirmed as valid/applicable labels Aug 12, 2023
@hramezani
Copy link
Member

Thanks @danilovmy for reporting this 🙏

I've created a PR #7136

@hramezani hramezani removed the unconfirmed Bug not yet confirmed as valid/applicable label Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug V2 Bug related to Pydantic V2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants