Skip to content

Conversation

@r4victor
Copy link
Collaborator

The PR restores recently removed models fields to keep the server compatible with 0.18 clients that continue to send those fields as null. It also excludes the fields so that the new clients do not send them and the fields can be removed in the future.

if not kwargs.get("deep", False):
raise TypeError(f"shallow copying of {self.__class__.__name__} is prohibited")
return super().copy(**kwargs)
new_copy.__root__ = new_copy.__root__.copy()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@un-def, I had to implement shallow copy for Env somehow because if a model defines excludes/includes, pydantic performs shallow copy for fields internally when calling copy(deep=True). Yes, copy(deep=True) may call copy(deep=False).

@r4victor r4victor requested a review from un-def March 17, 2025 06:22
@r4victor r4victor merged commit bddd28d into master Mar 17, 2025
24 checks passed
@r4victor r4victor deleted the pr_fix_models_backward_compatibility branch March 17, 2025 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants