Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring model so we could avoid shortcoming of linkml model #257

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
10 changes: 5 additions & 5 deletions dandischema/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ class PropertyValue(DandiBaseModel):
maxValue: Optional[float] = Field(None, json_schema_extra={"nskey": "schema"})
minValue: Optional[float] = Field(None, json_schema_extra={"nskey": "schema"})
unitText: Optional[str] = Field(None, json_schema_extra={"nskey": "schema"})
value: Union[Any, List[Any]] = Field(
value: Any = Field(
None,
validate_default=True,
json_schema_extra={"nskey": "schema"},
Expand All @@ -626,7 +626,7 @@ class PropertyValue(DandiBaseModel):

@field_validator("value")
@classmethod
def ensure_value(cls, val: Union[Any, List[Any]]) -> Union[Any, List[Any]]:
def ensure_value(cls, val: Any) -> Any:
if not val:
raise ValueError(
"The value field of a PropertyValue cannot be None or empty."
Expand Down Expand Up @@ -1262,7 +1262,7 @@ class PublishActivity(Activity):


class Locus(DandiBaseModel):
identifier: Union[Identifier, List[Identifier]] = Field(
identifier: Identifier = Field(
description="Identifier for genotyping locus.",
json_schema_extra={"nskey": "schema"},
)
Expand All @@ -1274,7 +1274,7 @@ class Locus(DandiBaseModel):


class Allele(DandiBaseModel):
identifier: Union[Identifier, List[Identifier]] = Field(
identifier: Identifier = Field(
description="Identifier for genotyping allele.",
json_schema_extra={"nskey": "schema"},
)
Expand Down Expand Up @@ -1373,7 +1373,7 @@ class Participant(DandiBaseModel):
"available. (e.g. from OBI)",
json_schema_extra={"nskey": "dandi"},
)
genotype: Optional[Union[List[GenotypeInfo], Identifier]] = Field(
genotype: Optional[Union[GenotypeInfo, Identifier]] = Field(
None,
description="Genotype descriptor of participant or subject if available",
json_schema_extra={"nskey": "dandi"},
Expand Down
Loading