Skip to content

Validate the selected union member with serdevalid - #200

Open
EricLiu2000 wants to merge 1 commit into
Metaswitch:masterfrom
EricLiu2000:codex/validate-selected-union-member
Open

EricLiu2000 wants to merge 1 commit into
Metaswitch:masterfrom
EricLiu2000:codex/validate-selected-union-member

Conversation

@EricLiu2000

@EricLiu2000 EricLiu2000 commented Oct 15, 2026 •

Copy link
Copy Markdown

Fixes #199.

With serdevalid enabled, OneOfN and AnyOfN currently return success without checking their selected member. Replace the empty derived validation with a match that returns the selected member's validation result.

The Validate bounds apply to the trait implementation. The union types keep their existing bounds, so unions with primitive members still support serialization and deserialization.

Validation: cargo fmt -- --check, cargo test, cargo test --all-features, cargo clippy --all-targets -- -D warnings, and cargo clippy --all-targets --all-features -- -D warnings pass. The new tests fail before the fix and cover both union kinds and primitive serialization.

Signed-off-by: Eric Liu <ericxliu@gmail.com>
@EricLiu2000
EricLiu2000 force-pushed the codex/validate-selected-union-member branch from f7dd843 to 9edf46b Compare October 15, 2026 04:18
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.

serdevalid union validation does not validate the selected member

1 participant