Skip to content

Fixes Base64 enconding for ALB and API Gateway HTTP events #150

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 2 commits into from
Jul 30, 2020

Conversation

galquezar
Copy link
Contributor

Issue
Jackson uses the getters/setters names to name the JSON keys when serializing/deserializing, and Lombok automatically generate getters/setters. A class using the boolean variable IsBase64Encoded would have IsBase64Encoded/SetBase64Encoded methods. Jackson would convert them to base64Encoded key instead of isBase64Encoded. That is incompatible with the ALB and API Gateway events JSON specification. By using lombok.getter.noIsPrefix = true, we would have GetIsBase64Encoded/SetIsBase64Encoded methods, and Jackson would convert them to the expected key isBase64Encoded.

Description of changes:
Adds lombok.config with lombok.getter.noIsPrefix = true to change the serialization behavior with the isBase64Encoded key.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…ializing/deserializing, and Lombok automatically generate getters/setters. A class using the boolean variable IsBase64Encoded would have IsBase64Encoded/SetBase64Encoded methods. Jackson would convert them to base64Encoded key instead of isBase64Encoded. That is incompatible with the ALB and API Gateway JSON specification. By using lombok.getter.noIsPrefix = true, we would have GetIsBase64Encoded/SetIsBase64Encoded methods, and Jackson would convert them to the expected key isBase64Encoded.
@carlzogh
Copy link
Contributor

Can validate that this works - thanks! A suggestion would be to move the lombok.config file further up in the tree so it doesn't live alongside the events

…runtime/events/lombok.config to src/main/java
@galquezar
Copy link
Contributor Author

Sure, moved to src/main/java

@carlzogh carlzogh merged commit 7f7b089 into aws:master Jul 30, 2020
raupachz pushed a commit to raupachz/aws-lambda-java-libs that referenced this pull request Dec 1, 2020
* Jackson uses the getters/setters names to name the JSON keys when serializing/deserializing, and Lombok automatically generate getters/setters. A class using the boolean variable IsBase64Encoded would have IsBase64Encoded/SetBase64Encoded methods. Jackson would convert them to base64Encoded key instead of isBase64Encoded. That is incompatible with the ALB and API Gateway JSON specification. By using lombok.getter.noIsPrefix = true, we would have GetIsBase64Encoded/SetIsBase64Encoded methods, and Jackson would convert them to the expected key isBase64Encoded.
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.

2 participants