Skip to content

Commit cba8861

Browse files
fix(parser): make identitySource optional for ApiGatewayAuthorizerRequestV2 model (#5880)
fix(parser): identitySource is optional for ApiGatewayAuthorizerRequestV2 Co-authored-by: Leandro Damascena <[email protected]>
1 parent 4a11418 commit cba8861

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

aws_lambda_powertools/utilities/parser/models/apigwv2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ class APIGatewayProxyEventV2Model(BaseModel):
7272
class ApiGatewayAuthorizerRequestV2(APIGatewayProxyEventV2Model):
7373
type: Literal["REQUEST"]
7474
routeArn: str
75-
identitySource: List[str]
75+
identitySource: Optional[List[str]] = None

tests/unit/parser/_pydantic/test_apigwv2.py

+9
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,12 @@ def test_apigw_v2_request_authorizer():
130130
assert parsed_event.type == raw_event["type"]
131131
assert parsed_event.identitySource == raw_event["identitySource"]
132132
assert parsed_event.routeArn == raw_event["routeArn"]
133+
134+
135+
def test_apigw_v2_request_authorizer_without_identity_source():
136+
raw_event = load_event("apiGatewayAuthorizerV2Event.json")
137+
raw_event["identitySource"] = None
138+
139+
parsed_event: ApiGatewayAuthorizerRequestV2 = ApiGatewayAuthorizerRequestV2(**raw_event)
140+
141+
assert parsed_event.identitySource == raw_event["identitySource"]

0 commit comments

Comments
 (0)