@@ -49,14 +49,22 @@ class SchemaValidator(BaseValidator):
49
49
A dictionary containing default value and rules for matching.
50
50
The value MUST be an object and MIGHT contain the following members:
51
51
52
- * **default**: `bool`. Defines default feature value. This MUST be present
52
+ * **default**: Union[`bool`, `JSONType`]. Defines default feature value. This MUST be present
53
+ * **boolean_type**: bool. Defines whether feature has non-boolean value (`JSONType`). This MIGHT be present
53
54
* **rules**: `Dict[str, Dict]`. Rules object. This MIGHT be present
54
55
56
+ `JSONType` being any JSON primitive value: `Union[str, int, float, bool, None, Dict[str, Any], List[Any]]`
57
+
55
58
```python
56
59
{
57
60
"my_feature": {
58
61
"default": True,
59
62
"rules": {}
63
+ },
64
+ "my_non_boolean_feature": {
65
+ "default": {"group": "read-only"},
66
+ "boolean_type": False,
67
+ "rules": {}
60
68
}
61
69
}
62
70
```
@@ -66,7 +74,7 @@ class SchemaValidator(BaseValidator):
66
74
A dictionary with each rule and their conditions that a feature might have.
67
75
The value MIGHT be present, and when defined it MUST contain the following members:
68
76
69
- * **when_match**: `bool`. Defines value to return when context matches conditions
77
+ * **when_match**: Union[ `bool`, `JSONType`] . Defines value to return when context matches conditions
70
78
* **conditions**: `List[Dict]`. Conditions object. This MUST be present
71
79
72
80
```python
@@ -79,6 +87,16 @@ class SchemaValidator(BaseValidator):
79
87
"conditions": []
80
88
}
81
89
}
90
+ },
91
+ "my_non_boolean_feature": {
92
+ "default": {"group": "read-only"},
93
+ "boolean_type": False,
94
+ "rules": {
95
+ "tenant id equals 345345435": {
96
+ "when_match": {"group": "admin"},
97
+ "conditions": []
98
+ }
99
+ }
82
100
}
83
101
}
84
102
```
0 commit comments