Skip to content

Support repeated fields in MessageOneofEvaluator#428

Merged
timostamm merged 2 commits intomainfrom
tstamm/fix427
Mar 3, 2026
Merged

Support repeated fields in MessageOneofEvaluator#428
timostamm merged 2 commits intomainfrom
tstamm/fix427

Conversation

@timostamm
Copy link
Member

@timostamm timostamm commented Mar 3, 2026

The (buf.validate.message).oneof rule is validated by MessageOneofEvaluator. It counts selected fields via method hasField of class Message.

The method reports presence for most fields as expected, but throws an exception for repeated and map fields.

This PR adds a function to report whether a field is set that works for all kinds of fields: A repeated or map field is set if the container has one or more elements.

Fixes #427.

Map fields are considered repeated fields.
@timostamm timostamm merged commit a0ab196 into main Mar 3, 2026
6 checks passed
@timostamm timostamm deleted the tstamm/fix427 branch March 3, 2026 20:43
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.

[BUG] MessageOneofEvaluator crashes with UnsupportedOperationException on repeated/map fields

2 participants