Skip to content

Extend ObjectValidator to support composite objects - #1328

Merged
cbalioglu merged 2 commits into
mainfrom
balioglu/validation
Sep 23, 2025
Merged

Extend ObjectValidator to support composite objects#1328
cbalioglu merged 2 commits into
mainfrom
balioglu/validation

Conversation

@cbalioglu

Copy link
Copy Markdown
Contributor

This PR (1) extends ObjectValidator to support composite sub-objects. Till now, it only supported dataclasses and their sub-dataclasses reachable from their fields. With this PR, we now support list, Mapping, Set, and tuple as well, (2) adds both docstrings and some tutorial documentation, (3) introduces unit tests for StandardObjectValidator and ValidationError.

@cbalioglu
cbalioglu requested a review from zyaoj as a code owner September 23, 2025 17:26
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 23, 2025
@cbalioglu cbalioglu linked an issue Sep 23, 2025 that may be closed by this pull request
Comment thread src/fairseq2/utils/validation.py Outdated
Comment thread src/fairseq2/utils/validation.py Outdated
Comment thread src/fairseq2/utils/validation.py
Comment thread src/fairseq2/utils/validation.py
Comment thread tests/unit/utils/test_validation.py
Comment thread tests/unit/utils/test_validation.py
Comment thread src/fairseq2/utils/validation.py Outdated
@cbalioglu
cbalioglu requested a review from cirquit September 23, 2025 19:55

@cirquit cirquit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@zyaoj zyaoj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! LGTM!

@cbalioglu
cbalioglu merged commit aa7fac5 into main Sep 23, 2025
15 checks passed
@cbalioglu
cbalioglu deleted the balioglu/validation branch September 23, 2025 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend ObjectValidator to support composite objects

3 participants