Skip to content

feature: Added APIGatewayAuthorizerEvent & results#639

Open
Yummy-Yums wants to merge 11 commits into
typelevel:mainfrom
Yummy-Yums:main
Open

feature: Added APIGatewayAuthorizerEvent & results#639
Yummy-Yums wants to merge 11 commits into
typelevel:mainfrom
Yummy-Yums:main

Conversation

@Yummy-Yums

@Yummy-Yums Yummy-Yums commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

#48 : adds AWS Lambda event type APIGatewayAuthorizerEvent:

image

@Yummy-Yums

Copy link
Copy Markdown
Contributor Author

@armanbilge please review

}

sealed abstract class ApiGatewayCustomAuthorizerEvent {
def `type`: String

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Elias, great job!

I'm wondering if it would be better to have this as a custom object instead of String, similar to here, since "type" can only be "TOKEN" and "REQUEST" (reference).

I also noticed that DefinitelyTyped uses a single RequestContext function for both the proxy events and the authorizer ones, so I am also wondering if, in the future, unifying the implementations would be better than having separate ones (like the one in WebSocketEvent).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also noticed that DefinitelyTyped uses a single RequestContext function for both the proxy events and the authorizer ones, so I am also wondering if, in the future, unifying the implementations would be better than having separate ones (like the one in WebSocketEvent).

Oh this was meant for @armanbilge, sorry I didn't mention you!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also noticed that DefinitelyTyped uses a single RequestContext function for both the proxy events and the authorizer ones

Great catch! I agree, instead of defining a new class here, maybe let's re-use the existing RequestContext class and add all the additional fields. I'm not sure why it is currently missing most of them 🤔

sealed abstract class RequestContext {
def http: Http
}

@Yummy-Yums Yummy-Yums requested a review from Chingles2404 June 19, 2026 13:18

@Chingles2404 Chingles2404 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@armanbilge armanbilge left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea from Ching about sharing the RequestContext class, let's do that!

def resourcePath: String
def httpMethod: String
def extendedRequestId: String
def requestTime: String

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see there is requestTime: String and requestTimeEpoch: Long. Probably they are redundant, and we could use requestTime: Instant for the best UX?

@Yummy-Yums Yummy-Yums Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think they are redundant since it's enumerated here in the output format

Image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I mean by "redundant" is that the field contain identical information, just presented in different formats. We should be able to retrieve the time entirely using the epoch timestamp.

def domainPrefix: String
def requestTimeEpoch: Long
def requestId: String
def identity: Map[String, Option[String]]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type looks a bit strange 🤔 I wonder in what case would there be a key would no value? (instead of just not having the key at all).

@Yummy-Yums Yummy-Yums Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the Input format of a Lambda function for proxy integration there are such cases . Also, I'd specifically update the identity key to use an identity object as done here

Image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I see. It looks like it would be better to define a new class for identity instead of using a Map since the fields appear to be predefined.

}

sealed abstract class ApiGatewayCustomAuthorizerEvent {
def `type`: String

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also noticed that DefinitelyTyped uses a single RequestContext function for both the proxy events and the authorizer ones

Great catch! I agree, instead of defining a new class here, maybe let's re-use the existing RequestContext class and add all the additional fields. I'm not sure why it is currently missing most of them 🤔

sealed abstract class RequestContext {
def http: Http
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants