Describe the bug
Validators fail when values are Pydantic models instead of dicts
Steps to reproduce
onco_evidence_lines.append(
VariantOncogenicityEvidenceLine(
directionOfEvidenceProvided=Direction.SUPPORTS,
strengthOfEvidenceProvided=MappableConcept(
primaryCoding=Coding(
code=code(evidence_line_confidence.lower()),
system=CCV_SYSTEM,
)
),
evidenceOutcome=MappableConcept(
primaryCoding=Coding(
code=code(evidence_code_value["evidence_code"]),
system=CCV_SYSTEM,
)
),
scoreOfEvidenceProvided=evidence_line_confidence["score"],
)
)
Expected behavior
No error
Current behavior
Error is raised
@staticmethod
def _validate_evidence_outcome(
values: dict, system: System, code_pattern: str
) -> dict:
"""Validate ``evidenceOutcome`` property if it exists
:param values: Input values
:param system: System that should be used for ``primaryCoding.system``
:param code_pattern: The regex pattern that should be used for
``primaryCoding.code``
:raises ValueError: If ``evidenceOutcome`` exists and is invalid
:return: Validated input values. If ``evidenceOutcome`` exists, then it will be
validated and converted to a ``MappableConcept``
"""
if "evidenceOutcome" in values:
> mc = MappableConcept(**values["evidenceOutcome"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E TypeError: ga4gh.core.models.MappableConcept() argument after ** must be a mapping, not MappableConcept
Possible reason(s)
No response
Suggested fix
Change validator mode to after since we're just doing validation checks and no pre-processing
Branch, commit, and/or version
version: 0.5.0-a0
Screenshots
No response
Environment details
NA
Additional details
No response
Contribution
Yes, I can create a PR for this fix.
Describe the bug
Validators fail when values are Pydantic models instead of dicts
Steps to reproduce
Expected behavior
No error
Current behavior
Error is raised
Possible reason(s)
No response
Suggested fix
Change validator mode to after since we're just doing validation checks and no pre-processing
Branch, commit, and/or version
version: 0.5.0-a0
Screenshots
No response
Environment details
NA
Additional details
No response
Contribution
Yes, I can create a PR for this fix.