Skip to content

Commit

Permalink
Remove error when no fields are set in oneof
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienVannson committed Sep 9, 2024
1 parent 1538e15 commit db6ee45
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/betterproto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1864,9 +1864,7 @@ def _validate_field_groups(cls, values):
if getattr(values, field.name, None) is not None
]

if not set_fields:
raise ValueError(f"Group {group} has no value; all fields are None")
elif len(set_fields) > 1:
if len(set_fields) > 1:
set_fields_str = ", ".join(set_fields)
raise ValueError(
f"Group {group} has more than one value; fields {set_fields_str} are not None"
Expand Down

0 comments on commit db6ee45

Please sign in to comment.