You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the old specification parallel to Pydantic v2 produces warnings using models package.
Warning content: .../.../python3.9/site-packages/pydantic/fields.py:804: PydanticDeprecatedSince20: Using extra keyword arguments on Fieldis deprecated and will be removed. Usejson_schema_extra instead. (Extra keys: 'example'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.7/migration/
according to pedantic v2 Field should not have example attribute. With Pydantic v3 it will be considered as error.
As our models are generated based on specification with use of datamodel-code-generator we are somewhat dependent on it.
Right now there is a way to modify the specification in the way Pydantic v2 will not throw errors, but with this approach OpenAPI (Swagger) used for documentation will not correctly understand the examples.
Old specification (Pydantic throws errors, documentation is OK):
Using the old specification parallel to Pydantic v2 produces warnings using models package.
Warning content:
.../.../python3.9/site-packages/pydantic/fields.py:804: PydanticDeprecatedSince20: Using extra keyword arguments on
Fieldis deprecated and will be removed. Use
json_schema_extrainstead. (Extra keys: 'example'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.7/migration/
Roots of warning - models package, for example:
according to pedantic v2
Field
should not haveexample
attribute. With Pydantic v3 it will be considered as error.As our models are generated based on specification with use of
datamodel-code-generator
we are somewhat dependent on it.Right now there is a way to modify the specification in the way Pydantic v2 will not throw errors, but with this approach OpenAPI (Swagger) used for documentation will not correctly understand the examples.
Invocation command for
datamodel-code-generator
:Maybe with later versions of
datamodel-code-generator
this will be fixed.The text was updated successfully, but these errors were encountered: