Skip to content

fix: replace deprecated classmethod model_validator with instance method in ShareCreateRequest#722

Open
Xenon010101 wants to merge 2 commits into
imDarshanGK:mainfrom
Xenon010101:fix/pydantic-deprecation
Open

fix: replace deprecated classmethod model_validator with instance method in ShareCreateRequest#722
Xenon010101 wants to merge 2 commits into
imDarshanGK:mainfrom
Xenon010101:fix/pydantic-deprecation

Conversation

@Xenon010101
Copy link
Copy Markdown

Summary

Pydantic V2.12+ deprecates using @model_validator(mode='after')\ on @classmethods. This PR converts the validator to a proper instance method and adds non-empty validation for \code\ and
esult\ fields.

Changes

  • \schemas.py: \ShareCreateRequest.validate_fields\ — changed from classmethod to instance method (no @classmethod\ decorator), added validation for empty code/result
  • Imported \model_validator\ from pydantic

Testing

  • Test suite passes cleanly (\pytest -v\ shows 0 deprecation warnings)

Closes #719

…hod in ShareCreateRequest

Pydantic V2.12+ deprecates using @model_validator(mode='after') on
@classmethods. Changed ShareCreateRequest.validate_fields to an instance
method and added non-empty validation for code and result fields.

Fixes deprecation warning:
PydanticDeprecatedSince212: Using @model_validator with mode='after'
on a classmethod is deprecated.

Closes imDarshanGK#719
@Xenon010101 Xenon010101 requested a review from imDarshanGK as a code owner May 31, 2026 05:43
Renamed the storage key used for persisting theme preference to match
the application prefix, preventing key collision with other scripts.

Closes imDarshanGK#717
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.

[Fix] Pydantic V2 deprecation warning in ShareCreateRequest validator

1 participant