MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / FeatureIdentifierSerializer

Class FeatureIdentifierSerializer

api/features/feature_states/serializers.py:51–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49
50
51class FeatureIdentifierSerializer(serializers.Serializer): # type: ignore[type-arg]
52 name = serializers.CharField(required=False, allow_blank=False)
53 id = serializers.IntegerField(required=False)
54
55 def validate(self, data: dict) -> dict: # type: ignore[type-arg]
56 has_name = "name" in data
57 has_id = "id" in data
58 if not has_name and not has_id:
59 raise serializers.ValidationError(
60 "Either 'name' or 'id' is required for feature identification"
61 )
62 if has_name and has_id:
63 raise serializers.ValidationError("Provide either 'name' or 'id', not both")
64 return data
65
66
67class FeatureUpdateSegmentDataSerializer(serializers.Serializer): # type: ignore[type-arg]

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…