Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions dandischema/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
List,
Literal,
Optional,
Sequence,
Type,
TypeVar,
Union,
Expand Down Expand Up @@ -928,7 +927,7 @@ class Contributor(DandiBaseModel):
description="Identifier associated with a sponsored or gift award.",
json_schema_extra={"nskey": DANDI_NSKEY},
)
schemaKey: Literal["Contributor", "Organization", "Person"] = Field(
schemaKey: Literal["Contributor"] = Field(
"Contributor", validate_default=True, json_schema_extra={"readOnly": True}
)

Expand Down Expand Up @@ -965,7 +964,7 @@ class Organization(Contributor):
description="Contact for the organization",
json_schema_extra={"nskey": "schema"},
)
schemaKey: Literal["Organization"] = Field(
schemaKey: Literal["Organization"] = Field( # type: ignore[assignment]
"Organization", validate_default=True, json_schema_extra={"readOnly": True}
)
_ldmeta = {
Expand Down Expand Up @@ -1014,7 +1013,7 @@ class Person(Contributor):
description="An organization that this person is affiliated with.",
json_schema_extra={"nskey": "schema"},
)
schemaKey: Literal["Person"] = Field(
schemaKey: Literal["Person"] = Field( # type: ignore[assignment]
"Person", validate_default=True, json_schema_extra={"readOnly": True}
)

Expand Down Expand Up @@ -1289,7 +1288,7 @@ class Activity(DandiBaseModel):
description="A listing of equipment used for the activity.",
json_schema_extra={"nskey": "prov"},
)
schemaKey: Literal["Activity", "Project", "Session", "PublishActivity"] = Field(
schemaKey: Literal["Activity"] = Field(
"Activity", validate_default=True, json_schema_extra={"readOnly": True}
)

Expand All @@ -1311,7 +1310,7 @@ class Project(Activity):
description="A brief description of the project.",
json_schema_extra={"nskey": "schema"},
)
schemaKey: Literal["Project"] = Field(
schemaKey: Literal["Project"] = Field( # type: ignore[assignment]
"Project", validate_default=True, json_schema_extra={"readOnly": True}
)

Expand All @@ -1328,13 +1327,13 @@ class Session(Activity):
description="A brief description of the session.",
json_schema_extra={"nskey": "schema"},
)
schemaKey: Literal["Session"] = Field(
schemaKey: Literal["Session"] = Field( # type: ignore[assignment]
"Session", validate_default=True, json_schema_extra={"readOnly": True}
)


class PublishActivity(Activity):
schemaKey: Literal["PublishActivity"] = Field(
schemaKey: Literal["PublishActivity"] = Field( # type: ignore[assignment]
"PublishActivity", validate_default=True, json_schema_extra={"readOnly": True}
)

Expand Down Expand Up @@ -1637,9 +1636,9 @@ class CommonModel(DandiBaseModel):
None, json_schema_extra={"nskey": DANDI_NSKEY}
)

wasGeneratedBy: Optional[Sequence[Activity]] = Field(
None, json_schema_extra={"nskey": "prov"}
)
wasGeneratedBy: Optional[
list[Union[Activity, Project, PublishActivity, Session]]
] = Field(None, json_schema_extra={"nskey": "prov"})
schemaKey: str = Field(
"CommonModel", validate_default=True, json_schema_extra={"readOnly": True}
)
Expand Down Expand Up @@ -1784,7 +1783,7 @@ def contributor_musthave_contact(
json_schema_extra={"readOnly": True, "nskey": "schema"},
)

wasGeneratedBy: Optional[Sequence[Project]] = Field(
wasGeneratedBy: Optional[list[Project]] = Field( # type: ignore[assignment]
None,
title="Associated projects",
description="Project(s) that generated this Dandiset.",
Expand Down Expand Up @@ -1927,10 +1926,12 @@ class BareAsset(CommonModel):
description="Associated participant(s) or subject(s).",
json_schema_extra={"nskey": "prov"},
)
wasGeneratedBy: Optional[List[Union[Session, Project, Activity]]] = Field(
wasGeneratedBy: Optional[
list[Union[Activity, Project, PublishActivity, Session]]
] = Field(
None,
title="Name of the session, project or activity.",
description="Describe the session, project or activity that generated this asset.",
title="Associated activities",
description="Activities that generated this asset.",
json_schema_extra={"nskey": "prov"},
)

Expand Down
Loading