Skip to content

Use model_validator mode=before for MappableConcept#620

Open
knQzx wants to merge 2 commits intoga4gh:mainfrom
knQzx:fix/model-validator-mode-before
Open

Use model_validator mode=before for MappableConcept#620
knQzx wants to merge 2 commits intoga4gh:mainfrom
knQzx:fix/model-validator-mode-before

Conversation

@knQzx
Copy link

@knQzx knQzx commented Mar 24, 2026

split out from #619

switches require_name_or_primary_coding from mode="after" to mode="before", so no need to construct the full object just to check if name or primaryCoding is set, also drops the Self import since it's no longer used

fixes #618
I emailed you about GSoC 2026 (knqzx0@gmail.com)

mode=after constructs the full object before validating, which is
wasteful when we just need to check if name or primaryCoding exists.
switched to mode=before so it checks the raw dict directly.
also removes the unused Self import.

Fixes ga4gh#618
Copy link
Contributor

@jsstevenson jsstevenson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see linter results -- feel free to # noqa the ANN401 violations but the "single if statement" fix should be done

@knQzx
Copy link
Author

knQzx commented Mar 25, 2026

see linter results -- feel free to # noqa the ANN401 violations but the "single if statement" fix should be done

fixed, merged the nested ifs and added noqa for ANN401

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.

deprecated use of model_validator(mode="after") in MappableConcept

2 participants