Schema
CLASS | DESCRIPTION |
---|---|
FeaturesValidator |
Validates each feature and calls RulesValidator to validate its rules |
ModuloRangeValues |
Possible values when using modulo range rule |
RulesValidator |
Validates each rule and calls ConditionsValidator to validate each rule's conditions |
SchemaValidator |
Validates feature flag schema configuration |
TimeKeys |
Possible keys when using time rules |
TimeValues |
Possible values when using time rules |
FeaturesValidator ¶
FeaturesValidator(
schema: dict,
logger: logging.Logger | Logger | None = None,
)
Bases: BaseValidator
Validates each feature and calls RulesValidator to validate its rules
Source code in aws_lambda_powertools/utilities/feature_flags/schema.py
227 228 229 |
|
RulesValidator ¶
RulesValidator(
feature: dict[str, Any],
boolean_feature: bool,
logger: logging.Logger | Logger | None = None,
)
Bases: BaseValidator
Validates each rule and calls ConditionsValidator to validate each rule's conditions
Source code in aws_lambda_powertools/utilities/feature_flags/schema.py
258 259 260 261 262 263 264 265 266 267 268 |
|
SchemaValidator ¶
SchemaValidator(
schema: dict[str, Any],
logger: logging.Logger | Logger | None = None,
)
Bases: BaseValidator
Validates feature flag schema configuration
RAISES | DESCRIPTION |
---|---|
SchemaValidationError
|
When schema doesn't conform with feature flag schema |
Schema
Feature object
A dictionary containing default value and rules for matching. The value MUST be an object and MIGHT contain the following members:
- default:
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: str | int | float | bool | None | dict[str, Any] | list[Any]
1 2 3 4 5 6 7 8 9 10 11 |
|
Rules object
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 | JSONType
. Defines value to return when context matches conditions - conditions:
list[dict]
. Conditions object. This MUST be present
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
Conditions object
A list of dictionaries containing conditions for a given rule. The value MUST contain the following members:
-
action:
str
. Operation to perform to match a key and value. The value MUST be either EQUALS, STARTSWITH, ENDSWITH, KEY_IN_VALUE KEY_NOT_IN_VALUE VALUE_IN_KEY VALUE_NOT_IN_KEY -
key:
str
. Key in given context to perform operation - value:
Any
. Value in given context that should match action operation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Source code in aws_lambda_powertools/utilities/feature_flags/schema.py
201 202 203 204 205 206 207 208 |
|