Skip to content

Commit

Permalink
fix: update schema validation docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
heitorlessa committed Dec 31, 2021
1 parent 5dd6eaa commit c34b7ff
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions aws_lambda_powertools/utilities/feature_flags/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,22 @@ class SchemaValidator(BaseValidator):
A dictionary containing default value and rules for matching.
The value MUST be an object and MIGHT contain the following members:
* **default**: `bool`. Defines default feature value. This MUST be present
* **default**: Union[`bool`, `JSONType`]. Defines default feature value. This MUST be present
* **boolean_type**: bool. Defines whether feature has non-boolean value (`JSONType`). This MIGHT be present
* **rules**: `Dict[str, Dict]`. Rules object. This MIGHT be present
`JSONType` being any JSON primitive value: `Union[str, int, float, bool, None, Dict[str, Any], List[Any]]`
```python
{
"my_feature": {
"default": True,
"rules": {}
},
"my_non_boolean_feature": {
"default": {"group": "read-only"},
"boolean_type": False,
"rules": {}
}
}
```
Expand All @@ -66,7 +74,7 @@ class SchemaValidator(BaseValidator):
A dictionary with each rule and their conditions that a feature might have.
The value MIGHT be present, and when defined it MUST contain the following members:
* **when_match**: `bool`. Defines value to return when context matches conditions
* **when_match**: Union[`bool`, `JSONType`]. Defines value to return when context matches conditions
* **conditions**: `List[Dict]`. Conditions object. This MUST be present
```python
Expand All @@ -79,6 +87,16 @@ class SchemaValidator(BaseValidator):
"conditions": []
}
}
},
"my_non_boolean_feature": {
"default": {"group": "read-only"},
"boolean_type": False,
"rules": {
"tenant id equals 345345435": {
"when_match": {"group": "admin"},
"conditions": []
}
}
}
}
```
Expand Down

0 comments on commit c34b7ff

Please sign in to comment.