Skip to content
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

Add custom Decodable conformance #76

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

twistinside
Copy link

Add custom Decodable conformance. Closes #73

Motivation:

Absent collections would fail to decode, when in reality it is possible to have empty headers, for example. This allows processing to continue in the context of the Lambda runtime where users can handle the collections as dictated by their code.

Modifications:

Custom Decodable conformance has been added to both API Gateway request objects to optionally decode absent collections to empty collections.

Unit testa have been added for the same.

Result:

This will make the swift lambda runtime more accepting of input, allowing processing to proceed in the rare cases where collection fields would be absent in the JSON received by the runtime. This will unlock certain functionality in edge cases such as testing lambda code from API Gateway console with empty headers (the use case that prompted this change).

This change will require users to update their code to remove optional handling for the collections involved, potentially also requiring extra logic to validate that the collections they've received aren't empty.

@twistinside twistinside changed the title Add custom Decodable conformance Add custom Decodable conformance Nov 21, 2024
@twistinside twistinside marked this pull request as ready for review November 21, 2024 04:57
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.

Consider optional headers for APIGatewayRequest
1 participant