Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies = [
"requests",
"canonicaljson",
"setuptools>=78.1.0", # TODO remove this pin caused by HGVS issue
"typing-extensions",
]

[project.optional-dependencies]
Expand Down
7 changes: 4 additions & 3 deletions src/ga4gh/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
StringConstraints,
model_validator,
)
from typing_extensions import Self

from ga4gh.core.identifiers import GA4GH_IR_REGEXP

Expand Down Expand Up @@ -216,12 +217,12 @@ class MappableConcept(Element, BaseModelForbidExtra):
)

@model_validator(mode="after")
def require_name_or_primary_coding(cls, v): # noqa: ANN001 N805 ANN201
def require_name_or_primary_coding(self) -> Self:
"""Ensure that ``name`` or ``primaryCoding`` is provided"""
if v.primaryCoding is None and v.name is None:
if self.primaryCoding is None and self.name is None:
err_msg = "One of `name` or `primaryCoding` must be provided."
raise ValueError(err_msg)
return v
return self


Element.model_rebuild()
Expand Down
Loading