Skip to content

Commit 60b21d1

Browse files
committed
output schema
1 parent d9d3e13 commit 60b21d1

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

packages/models-library/src/models_library/api_schemas_webserver/projects.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
ProjectType,
3636
)
3737
from ..projects_access import AccessRights, GroupIDStr
38-
from ..projects_state import ProjectShareState, ProjectState
38+
from ..projects_state import ProjectState, ProjectStatus
3939
from ..utils._original_fastapi_encoders import jsonable_encoder
4040
from ..utils.common_validators import (
4141
empty_str_to_none_pre_validator,
@@ -105,7 +105,15 @@ def to_domain_model(self) -> dict[str, Any]:
105105
)
106106

107107

108-
class ProjectShareStateOutputSchema(ProjectShareState, OutputSchema): ...
108+
class ProjectShareStateOutputSchema(OutputSchema):
109+
status: Annotated[ProjectStatus, Field(description="The status of the project")]
110+
locked: Annotated[bool, Field(description="True if the project is locked")]
111+
current_user_groupids: Annotated[
112+
list[GroupID],
113+
Field(
114+
description="Current users in the project (if the project is locked, the list contains only the lock owner)"
115+
),
116+
]
109117

110118

111119
class ProjectStateOutputSchema(ProjectState, OutputSchema):

packages/models-library/src/models_library/projects_state.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ def _update_json_schema_extra(schema: JsonDict) -> None:
132132
)
133133

134134
model_config = ConfigDict(
135-
extra="forbid",
136-
json_schema_extra=_update_json_schema_extra,
135+
extra="forbid", json_schema_extra=_update_json_schema_extra
137136
)
138137

139138
@model_validator(mode="after")

0 commit comments

Comments
 (0)