Skip to content

Commit 8692de6

Browse files
authored
fix(parser): make identitySource nulablel in APIGatewayRequestAuthorizerEventV2Schema (#3485)
1 parent e1bc6c5 commit 8692de6

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Diff for: packages/parser/src/schemas/apigwv2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ const APIGatewayRequestAuthorizerEventV2Schema = z.object({
230230
version: z.literal('2.0'),
231231
type: z.literal('REQUEST'),
232232
routeArn: z.string(),
233-
identitySource: APIGatewayStringArray,
233+
identitySource: APIGatewayStringArray.nullish(),
234234
routeKey: z.string(),
235235
rawPath: z.string(),
236236
rawQueryString: z.string(),

Diff for: packages/parser/tests/unit/schema/apigwv2.test.ts

+15
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,21 @@ describe('API Gateway HTTP (v2) Schemas', () => {
9898
// Assess
9999
expect(parsedEvent).toEqual(event);
100100
});
101+
102+
it('should parse the authorizer event with null identitySource', () => {
103+
// Prepare
104+
const event = getTestEvent({
105+
eventsPath,
106+
filename: 'authorizer-request',
107+
});
108+
event.identitySource = null;
109+
110+
// Act
111+
const parsedEvent = APIGatewayRequestAuthorizerEventV2Schema.parse(event);
112+
113+
// Assess
114+
expect(parsedEvent).toEqual(event);
115+
});
101116
});
102117

103118
describe('APIGatewayRequestContextV2Schema', () => {

0 commit comments

Comments
 (0)