powertools-lambda-python icon indicating copy to clipboard operation
powertools-lambda-python copied to clipboard

Feature request: Support depth levels in feature flag keys

Open adriantomas opened this issue 1 year ago • 3 comments

Use case

Currently the key of the conditions of the feature flags only support that the values sent in the context are first level.

It would be very interesting to be able to support depth levels, like with a dot attribute access or with a string list of dictionary keys, so that for example a feature flag can be defined based on the raw content of the event without having to transform it or extract something from it.

Solution/User Experience

Context:

{
  "foo": {
    "bar": "premium"
  }
}

Schema:

{
    "premium_feature": {
        "default": false,
        "rules": {
            "customer tier equals premium": {
                "when_match": true,
                "conditions": [
                    {
                        "action": "EQUALS",
                        "key": ["foo", "bar"],
                        "value": "premium"
                    }
                ]
            }
        }
    }
}

Alternative solutions

No response

Acknowledgment

adriantomas avatar Jul 04 '24 12:07 adriantomas

Hey @adriantomas! I'm working in some critical issues and will reply to this tomorrow, ok?

Thanks

leandrodamascena avatar Jul 08 '24 21:07 leandrodamascena

Hey @adriantomas! I'm working in some critical issues and will reply to this tomorrow, ok?

Thanks

Sure, take your time :)

adriantomas avatar Jul 09 '24 06:07 adriantomas

Idea... maybe we could think of using JMESPath like we use in multiple places here. We started simple because we knew customers could pluck those values before calling .evaluate. JMESPath is used in Logger (correlation ID), Idempotency, etc., and it's a string to easy ;)

heitorlessa avatar Jul 23 '24 14:07 heitorlessa

Closing this issue as it's been open for a while now, and we didn't have much customer feedback. Please open a new one if it's still an issue.

anafalcao avatar Jan 28 '25 13:01 anafalcao

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Jan 28 '25 13:01 github-actions[bot]