Skip to content

fix(parser): lambda function url cognitoIdentity and principalOrgId nullable #2430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions packages/parser/src/schemas/apigwv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ const RequestContextV2Authorizer = z.object({
accessKey: z.string().optional(),
accountId: z.string().optional(),
callerId: z.string().optional(),
principalOrgId: z.string().optional(),
principalOrgId: z.string().nullish(),
userArn: z.string().optional(),
userId: z.string().optional(),
cognitoIdentity: z.object({
amr: z.array(z.string()),
identityId: z.string(),
identityPoolId: z.string(),
}),
cognitoIdentity: z
.object({
amr: z.array(z.string()),
identityId: z.string(),
identityPoolId: z.string(),
})
.nullish(),
})
.optional(),
lambda: z.record(z.string(), z.any()).optional(),
Expand All @@ -42,7 +44,7 @@ const RequestContextV2 = z.object({
.object({
clientCert: APIGatewayCert.optional(),
})
.optional(),
.nullish(),
domainName: z.string(),
domainPrefix: z.string(),
http: RequestContextV2Http,
Expand Down
6 changes: 6 additions & 0 deletions packages/parser/tests/unit/schema/lambda.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@ describe('Lambda ', () => {
lambdaFunctionUrlEvent
);
});

it('should parse url IAM event', () => {
const urlIAMEvent = TestEvents.lambdaFunctionUrlIAMEvent;

expect(LambdaFunctionUrlSchema.parse(urlIAMEvent)).toEqual(urlIAMEvent);
});
});