Skip to content

Commit 5d552ba

Browse files
authored
Fix Auth (#221)
Create robust initializers for dataclasses so they don't fail if the response JSON contains additional fields.
1 parent e96ade6 commit 5d552ba

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

dbos/_cloudutils/cloudutils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ class DBOSCloudCredentials:
2929
@dataclass
3030
class UserProfile:
3131
Name: str
32-
Email: str
3332
Organization: str
34-
SubscriptionPlan: str
33+
34+
def __init__(self, **kwargs: Any) -> None:
35+
self.Name = kwargs.get("Name", "")
36+
self.Organization = kwargs.get("Organization", "")
3537

3638

3739
class AppLanguages(Enum):

dbos/_cloudutils/databases.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ class UserDBCredentials:
2323
RoleName: str
2424
Password: str
2525

26+
def __init__(self, **kwargs: Any) -> None:
27+
self.RoleName = kwargs.get("RoleName", "")
28+
self.Password = kwargs.get("Password", "")
29+
2630

2731
@dataclass
2832
class UserDBInstance:

0 commit comments

Comments
 (0)