File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,13 @@ pub struct FeatureMetadata {
1717 /// The feature ID.
1818 #[ serde( default ) ]
1919 pub feature_id : u32 ,
20+ /// The feature type (e.g., "STANDARD", "MULTIVARIATE").
21+ #[ serde( default = "default_feature_type" ) ]
22+ pub feature_type : String ,
23+ }
24+
25+ fn default_feature_type ( ) -> String {
26+ "STANDARD" . to_string ( )
2027}
2128
2229/// Represents a multivariate value for a feature flag.
Original file line number Diff line number Diff line change @@ -68,6 +68,11 @@ fn map_feature_state_to_feature_context(fs: &FeatureState) -> FeatureContext {
6868 variants : map_multivariate_values_to_variants ( & fs. multivariate_feature_state_values ) ,
6969 metadata : FeatureMetadata {
7070 feature_id : fs. feature . id ,
71+ feature_type : fs
72+ . feature
73+ . feature_type
74+ . clone ( )
75+ . unwrap_or_else ( || "STANDARD" . to_string ( ) ) ,
7176 } ,
7277 } ;
7378
@@ -184,6 +189,7 @@ struct OverrideKey {
184189 enabled : String ,
185190 feature_value : String ,
186191 feature_id : u32 ,
192+ feature_type : String ,
187193}
188194
189195/// Maps identity overrides to segment contexts
@@ -207,6 +213,11 @@ fn map_identity_overrides_to_segments(identities: &[Identity]) -> HashMap<String
207213 enabled : fs. enabled . to_string ( ) ,
208214 feature_value,
209215 feature_id : fs. feature . id ,
216+ feature_type : fs
217+ . feature
218+ . feature_type
219+ . clone ( )
220+ . unwrap_or_else ( || "STANDARD" . to_string ( ) ) ,
210221 } ) ;
211222 }
212223
@@ -263,6 +274,7 @@ fn map_identity_overrides_to_segments(identities: &[Identity]) -> HashMap<String
263274 variants : vec ! [ ] ,
264275 metadata : FeatureMetadata {
265276 feature_id : override_key. feature_id ,
277+ feature_type : override_key. feature_type . clone ( ) ,
266278 } ,
267279 } ;
268280
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ pub struct Feature {
99 pub id : u32 ,
1010 pub name : String ,
1111 #[ serde( rename = "type" ) ]
12- feature_type : Option < String > ,
12+ pub feature_type : Option < String > ,
1313}
1414
1515#[ derive( Serialize , Deserialize , Clone , Debug ) ]
You can’t perform that action at this time.
0 commit comments