diff --git a/dandischema/models.py b/dandischema/models.py index c91afad0..791e8142 100644 --- a/dandischema/models.py +++ b/dandischema/models.py @@ -11,7 +11,6 @@ List, Literal, Optional, - Sequence, Type, TypeVar, Union, @@ -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} ) @@ -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 = { @@ -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} ) @@ -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} ) @@ -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} ) @@ -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} ) @@ -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} ) @@ -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.", @@ -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"}, )