fix(flags): Added if check and return error for filters with empty groups fix#38896 (#39110)

Co-authored-by: SudeshHirave <sphirave@users.noreply.github.com>
Co-authored-by: Gustavo H. Strassburger <gustavo@posthog.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
SudeshHirave
2025-10-13 18:11:29 +05:30
committed by GitHub
parent a93f12b9d8
commit 8b899e28ca

View File

@@ -401,6 +401,12 @@ class FeatureFlagSerializer(
# mypy cannot tell that self.instance is a FeatureFlag
return self.instance.filters
groups = filters.get("groups", [])
if isinstance(groups, list) and len(groups) == 0:
raise serializers.ValidationError(
"Feature flag filters must contain at least one condition set. Empty 'groups' array is not allowed."
)
aggregation_group_type_index = filters.get("aggregation_group_type_index", None)
def properties_all_match(predicate):