Skip to content

Commit 1189512

Browse files
allenovntkathole
authored andcommitted
fix: dell pydantic v1
Signed-off-by: allenov <allenov@webshark34.ru>
1 parent fc44222 commit 1189512

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

sdk/python/feast/permissions/auth_model.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# --------------------------------------------------------------------
22
# Extends OIDC client auth model with an optional `token` field.
3-
# Works on Pydantic v1 and v2.
3+
# Works on Pydantic v2-only.
44
#
55
# Accepted credential sets (exactly **one** of):
66
# 1 pre-issued `token`
@@ -11,19 +11,9 @@
1111

1212
from typing import Literal, Optional
1313

14-
from feast.repo_config import FeastConfigBaseModel
15-
16-
# pick the correct validator decorator for current Pydantic version
17-
try: # Pydantic ≥ 2.0
18-
from pydantic import model_validator as _v2 # type: ignore
14+
from pydantic import model_validator
1915

20-
def _cred_validator(fn):
21-
return _v2(mode="after")(fn) # run after field validation
22-
except ImportError: # Pydantic 1.x
23-
from pydantic import root_validator as _v1 # type: ignore
24-
25-
def _cred_validator(fn):
26-
return _v1(skip_on_failure=True)(fn)
16+
from feast.repo_config import FeastConfigBaseModel
2717

2818

2919
class AuthConfig(FeastConfigBaseModel):
@@ -42,7 +32,7 @@ class OidcClientAuthConfig(OidcAuthConfig):
4232
client_secret: Optional[str] = None
4333
token: Optional[str] = None # pre-issued `token`
4434

45-
@_cred_validator
35+
@model_validator(mode="after")
4636
def _validate_credentials(cls, values):
4737
"""Enforce exactly one valid credential set."""
4838
d = values.__dict__ if hasattr(values, "__dict__") else values

0 commit comments

Comments
 (0)