Skip to content

Add custom Decodable conformance #80

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 4 commits into from
Dec 3, 2024
Merged

Add custom Decodable conformance #80

merged 4 commits into from
Dec 3, 2024

Conversation

sebsto
Copy link
Contributor

@sebsto sebsto commented Dec 3, 2024

Add custom Decodable conformance.
Closes #73
Duplicate of #76 created by @twistinside

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.

@sebsto sebsto self-assigned this Dec 3, 2024
@sebsto sebsto added the semver/none No version bump required. label Dec 3, 2024
@sebsto sebsto requested a review from 0xTim December 3, 2024 20:36
@sebsto sebsto merged commit 334d865 into main Dec 3, 2024
18 of 19 checks passed
@sebsto sebsto deleted the pr-76 branch December 3, 2024 22:55
@adam-fowler
Copy link
Member

@sebsto this PR is a breaking change (changing optionals to non-optional). (It was just pointed out to me). It has broken hummingbird-lambda

@sebsto
Copy link
Contributor Author

sebsto commented Dec 19, 2024

@adam-fowler I know and we discussed this with @FranzBusch
The consensus was that as long as we are in 0.x versions, we can afford introducing breaking changes.

This change is on main branch only. The 0.5.0 tag is the last stable release.

Would you recommend to tag a v1.0.0 now and start to follow server rules to avoid future breaking change to impact downstream projects?

@adam-fowler
Copy link
Member

It would be good to have a stable version. Although we are reliant on AWS keeping the structs stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/none No version bump required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider optional headers for APIGatewayRequest
4 participants