generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
Description
In src/bedrock_agentcore/memory/models/filters.py, the EventMetadataFilter TypedDict defines operator: OperatorType (an enum), but the actual value stored is a string.
class EventMetadataFilter(TypedDict):
left: LeftExpression
operator: OperatorType # Type says enum
right: Optional[RightExpression]The build_expression method correctly converts the enum to a string:
filter = {"operator": operator.value} # Stores string, not enumRamifications
-
Type hint is misleading - The TypedDict suggests
operatorholds anOperatorTypeenum, but it actually holds a string like"EQUALS_TO" -
Potential runtime error - If a user follows the type hint and passes an enum directly (without using
build_expression), boto3 will fail to serialize it since enums are not JSON serializable -
Type checker inconsistency - Static type checkers like mypy may produce warnings or miss actual type errors due to this mismatch
Metadata
Metadata
Assignees
Labels
No labels