FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: Update model_validator to use instance method signature (Pydantic v2.12 deprecation) by WhiteLotusLA · Pull Request #5825 · feast-dev/feast · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
16 changes: 7 additions & 9 deletions sdk/python/feast/permissions/auth_model.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,23 @@ class OidcClientAuthConfig(OidcAuthConfig):
token: Optional[str] = None # pre-issued `token`

@model_validator(mode="after")
def _validate_credentials(cls, values):
def _validate_credentials(self):
"""Enforce exactly one valid credential set."""
d = values.__dict__ if hasattr(values, "__dict__") else values

has_user_pass = bool(d.get("username")) and bool(d.get("password"))
has_secret = bool(d.get("client_secret"))
has_token = bool(d.get("token"))
has_user_pass = bool(self.username) and bool(self.password)
has_secret = bool(self.client_secret)
has_token = bool(self.token)

# 1 static token
if has_token and not (has_user_pass or has_secret):
return values
return self

# 2 client_credentials
if has_secret and not has_user_pass and not has_token:
return values
return self

# 3 ROPG
if has_user_pass and has_secret and not has_token:
return values
return self

raise ValueError(
"Invalid OIDC client auth combination: "
Expand Down
Loading

Back | FazBrowse Home | New Git URL