Skip to content

Commit

Permalink
Explicitly rebuild models on init to troubleshoot unit test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Nov 23, 2024
1 parent 0289609 commit 795ac19
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions neon_data_models/models/api/mq/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@


class CreateUserRequest(MQContext):
def __init__(self, **kwargs):
# `User` may be rebuilt upon init, so make sure this model is too
self.model_rebuild()
MQContext.__init__(self, **kwargs)

operation: Literal["create"] = "create"
user: User = Field(description="User object to create")

Expand Down Expand Up @@ -60,6 +65,11 @@ def validate_params(self) -> 'ReadUserRequest':


class UpdateUserRequest(MQContext):
def __init__(self, **kwargs):
# `User` may be rebuilt upon init, so make sure this model is too
self.model_rebuild()
MQContext.__init__(self, **kwargs)

operation: Literal["update"] = "update"
user: User = Field(description="Updated User object to write to database")
auth_username: str = Field(
Expand All @@ -85,6 +95,11 @@ def get_auth_username(self) -> 'UpdateUserRequest':


class DeleteUserRequest(MQContext):
def __init__(self, **kwargs):
# `User` may be rebuilt upon init, so make sure this model is too
self.model_rebuild()
MQContext.__init__(self, **kwargs)

operation: Literal["delete"] = "delete"
user: User = Field(description="Exact User object to remove from the "
"database")
Expand Down

0 comments on commit 795ac19

Please sign in to comment.