@@ -87,13 +87,22 @@ def load_json_schema() -> dict[str, Any]:
8787 return data
8888
8989
90+ @dataclasses .dataclass (frozen = True )
91+ class OwnerInfo :
92+ team : str
93+ "The team that owns this feature."
94+
95+ email : str | None = None
96+ "The email address of the owner."
97+
98+
9099@dataclasses .dataclass (frozen = True )
91100class Feature :
92101 name : str
93102 "The feature name."
94103
95- owner : str
96- "The owner of this feature. Either an email address or team name, preferably. "
104+ owner : str | OwnerInfo
105+ "The owner of this feature."
97106
98107 enabled : bool = dataclasses .field (default = True )
99108 "Whether or not the feature is enabled."
@@ -133,9 +142,19 @@ def from_feature_dictionary(cls, name: str, config_dict: dict[str, Any]) -> Feat
133142 raise InvalidFeatureFlagConfiguration ("Feature has no segments defined" )
134143 try :
135144 segments = [Segment .from_dict (segment ) for segment in segment_data ]
145+
146+ raw_owner = config_dict .get ("owner" , "" )
147+ if isinstance (raw_owner , dict ):
148+ owner = OwnerInfo (
149+ team = raw_owner ["team" ],
150+ email = raw_owner .get ("email" ),
151+ )
152+ else :
153+ owner = str (raw_owner )
154+
136155 feature = cls (
137156 name = name ,
138- owner = str ( config_dict . get ( " owner" , "" )) ,
157+ owner = owner ,
139158 enabled = bool (config_dict .get ("enabled" , True )),
140159 created_at = str (config_dict .get ("created_at" )),
141160 segments = segments ,
0 commit comments