Skip to content

Conversation

@WhiteLotusLA
Copy link
Contributor

Summary

This PR fixes a Pydantic v2.12+ deprecation warning in OidcClientAuthConfig._validate_credentials.

The warning:

DeprecationWarning: Using `@model_validator` with mode='after' on a classmethod is deprecated

Changes

In Pydantic v2.12, using @model_validator(mode="after") with a classmethod-style signature (cls, values) was deprecated in favor of an instance method signature (self).

Before:

@model_validator(mode="after")
def _validate_credentials(cls, values):
    d = values.__dict__ if hasattr(values, "__dict__") else values
    has_user_pass = bool(d.get("username")) and bool(d.get("password"))
    # ...
    return values

After:

@model_validator(mode="after")
def _validate_credentials(self):
    has_user_pass = bool(self.username) and bool(self.password)
    # ...
    return self

Benefits

  • Eliminates deprecation warning spam in user logs
  • Uses direct attribute access instead of dict gymnastics
  • Cleaner, more idiomatic Pydantic v2 code
  • No functional changes - same validation logic

Testing

This is a non-breaking change that maintains identical validation behavior. The only difference is the method signature and attribute access pattern.

References

@WhiteLotusLA WhiteLotusLA requested a review from a team as a code owner January 9, 2026 04:52
@franciscojavierarceo
Copy link
Member

Can you fix DCO?

Pydantic v2.12 deprecated using @model_validator(mode='after') with a
classmethod-style signature (cls, values). This change updates the
_validate_credentials method to use the correct instance method signature
(self), which:

- Eliminates the deprecation warning
- Uses direct attribute access (self.username) instead of dict access
- Returns self instead of values

This is a non-breaking change that maintains the same validation logic
while conforming to Pydantic v2.12+ best practices.

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

Signed-off-by: WhiteLotusLA <calvin.devereaux@gmail.com>
@WhiteLotusLA WhiteLotusLA force-pushed the fix/pydantic-model-validator-deprecation branch from 4609a0d to a42fe11 Compare January 9, 2026 15:16
@ntkathole ntkathole changed the title fix: update model_validator to use instance method signature (Pydantic v2.12 deprecation) fix: Update model_validator to use instance method signature (Pydantic v2.12 deprecation) Jan 11, 2026
Copy link
Member

@ntkathole ntkathole left a comment

Choose a reason for hiding this comment

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

Thank you

@ntkathole ntkathole merged commit 3c10b6e into feast-dev:master Jan 13, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants