From c2bcd31fe30d50a6a0e71a32224ddff8b3b786a7 Mon Sep 17 00:00:00 2001 From: Adrien Date: Sat, 5 Oct 2024 14:13:44 +0200 Subject: [PATCH] Remove error when no fields are set in oneof (#612) --- src/betterproto/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/betterproto/__init__.py b/src/betterproto/__init__.py index 4bc827f5e..8eee6f4c4 100644 --- a/src/betterproto/__init__.py +++ b/src/betterproto/__init__.py @@ -1879,9 +1879,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"