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
@koxudaxi The unit tests for datamodel_code_generator/parser/jsonschema.py also throw deprecation warnings for the same reasons as above. Should these be updated as well or do they need to stay for backwards compatibility with Pydantic V1?
Yes, this implementation is designed to support both v1 and v2. For backward compatibility reasons, we need to maintain support for both versions.
If this is causing issues for users, we could completely suppress these warnings. Would that be a better approach from a user perspective?
We should be able to avoid suppressing warnings, which is preferable as both maintainer and user IMO. The deprecation warnings will still get thrown when the unit tests are run, but that may be unavoidable without adding version handling in the unit tests themselves. What is preferable from a maintainers standpoint? I'm new to open source, but if this seems sensible I can open a new PR with the changes from the one I closed and request to merge.
The package currently uses several deprecated Pydantic v2 methods that should be updated to their new equivalents:
parse_obj
->model_validate
dict
->model_dump
__fields_set__
->model_fields_set
These deprecation warnings appear when using the package with Pydantic v2:
These methods will be removed in Pydantic v3.0, so they should be updated to ensure future compatibility.
Relevant files:
datamodel_code_generator/parser/jsonschema.py
See the Pydantic V2 Migration Guide for more details on the changes.
The text was updated successfully, but these errors were encountered: