forked from airlift/airlift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exclude non-fields from record serialization
Before the change, a record's getter-like methods would be considered getters and would be parsed of serialized form. This is undesirable because - For record component `foo`, the `foo()` method should be considered the accessor. If `getFoo()` exists, it may return something else. Using it can lead to correctness problems. - A method like `getFoo()` may not be accessor to a record component at all, it should not be part of serialization. - The default behavior is different than one for regular classes, so a benign refactor from a class to a record changes what gets serialized as JSON -- the getter-like non-getters on a class are ignored (do not need `@JsonIgnore`) and are included on a record (unless annotated with `@JsonIgnore`). This changes serialized form in a hard to notice manner, because we ignore those additional properties during deserialization. This commit fixes this. Now only the canonical accessors are considered a getter in a record. Alternative solution would be to rely on Jackson built-in record support. However, it relies on private field access, and we disable CAN_OVERRIDE_ACCESS_MODIFIERS mapper feature.
- Loading branch information
Showing
3 changed files
with
248 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
246 | ||
|
||
- Exclude getter-like record methods from JSON serialization | ||
|
||
245 | ||
|
||
- Update bouncycastle to 1.78 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters