Skip to content

Commit

Permalink
review @sanderegg
Browse files Browse the repository at this point in the history
  • Loading branch information
matusdrobuliak66 committed Oct 24, 2024
1 parent a2710df commit aab352e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/models-library/src/models_library/projects_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from enum import Enum, unique
from typing import Any, ClassVar

from pydantic import BaseModel, Extra, Field, validator
from pydantic import BaseModel, Extra, Field, root_validator, validator

from .projects_access import Owner

Expand Down Expand Up @@ -91,13 +91,13 @@ def check_status_compatible(cls, v, values):
raise ValueError(msg)
return v

@validator("owner", always=True)
@root_validator(pre=True)
@classmethod
def check_owner_compatible(cls, v, values):
def check_owner_compatible(cls, values):
if (
values["value"] is True
and v is None
and values.get("status")
and values.get("owner") is None
and values["status"]
in [
status.value
for status in ProjectStatus
Expand All @@ -106,7 +106,7 @@ def check_owner_compatible(cls, v, values):
):
msg = "Owner must be specified when the project is not in the 'MAINTAINING' status."
raise ValueError(msg)
return v
return values


class ProjectRunningState(BaseModel):
Expand Down

0 comments on commit aab352e

Please sign in to comment.