Skip to content

Commit c34b7ff

Browse files
committed
fix: update schema validation docstring
1 parent 5dd6eaa commit c34b7ff

File tree

1 file changed

+20
-2
lines changed
  • aws_lambda_powertools/utilities/feature_flags

1 file changed

+20
-2
lines changed

aws_lambda_powertools/utilities/feature_flags/schema.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,22 @@ class SchemaValidator(BaseValidator):
4949
A dictionary containing default value and rules for matching.
5050
The value MUST be an object and MIGHT contain the following members:
5151
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
5354
* **rules**: `Dict[str, Dict]`. Rules object. This MIGHT be present
5455
56+
`JSONType` being any JSON primitive value: `Union[str, int, float, bool, None, Dict[str, Any], List[Any]]`
57+
5558
```python
5659
{
5760
"my_feature": {
5861
"default": True,
5962
"rules": {}
63+
},
64+
"my_non_boolean_feature": {
65+
"default": {"group": "read-only"},
66+
"boolean_type": False,
67+
"rules": {}
6068
}
6169
}
6270
```
@@ -66,7 +74,7 @@ class SchemaValidator(BaseValidator):
6674
A dictionary with each rule and their conditions that a feature might have.
6775
The value MIGHT be present, and when defined it MUST contain the following members:
6876
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
7078
* **conditions**: `List[Dict]`. Conditions object. This MUST be present
7179
7280
```python
@@ -79,6 +87,16 @@ class SchemaValidator(BaseValidator):
7987
"conditions": []
8088
}
8189
}
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+
}
82100
}
83101
}
84102
```

0 commit comments

Comments
 (0)