Skip to content

fix(translator): reject non-variation types in _from_vrs - #668

Merged
theferrit32 merged 2 commits into
mainfrom
kf/from-vrs-reject-non-variation
Oct 19, 2026
Merged

theferrit32 merged 2 commits into
mainfrom
kf/from-vrs-reject-non-variation

Conversation

@theferrit32

Copy link
Copy Markdown
Contributor

#656 fixed the TypeError in _from_vrs, but its getattr(models, var["type"]) lookup accepts any attribute of the models module. Inputs like {"type": "SequenceLocation", ...} or {"type": "Field"} return non-variation objects.

This narrows the accepted types to VRS variations by validating against the existing models.Variation union (tagged by type, mirroring the VRS Variation schema). Other types now raise a pydantic ValidationError listing the accepted types.

Validate VRS dict input against the models.Variation union instead of
looking up any attribute of the models module by name. Types that are not
VRS variations (e.g. SequenceLocation, or unrelated module attributes
like Field) now raise a pydantic ValidationError listing the accepted
types, rather than building a non-variation object or returning None.
@theferrit32 theferrit32 self-assigned this Oct 6, 2026
theferrit32 added a commit that referenced this pull request Oct 6, 2026
The fix landed on main separately (#656, follow-up #668), so remove it and
its tests to keep this branch focused on location bounds validation.
@theferrit32
theferrit32 marked this pull request as ready for review October 19, 2026 17:42
@theferrit32
theferrit32 requested review from a team as code owners October 19, 2026 17:42
@theferrit32
theferrit32 merged commit 1c8c0d0 into main Oct 19, 2026
16 checks passed
@theferrit32
theferrit32 deleted the kf/from-vrs-reject-non-variation branch October 19, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants