Skip to content

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

Draft
theferrit32 wants to merge 1 commit into
mainfrom
kf/from-vrs-reject-non-variation
Draft

theferrit32 wants to merge 1 commit 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.

This branch has not been deployed

No deployments
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.

1 participant