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

Pickler: add transientNone for optional fields #3816

Merged
merged 1 commit into from
Jun 4, 2024
Merged

Conversation

kciesielski
Copy link
Member

This PR enhances Pickler JSON codec with 2 features:

  1. When deserializing, missing fields for Option fields are now treated as None instead of causing errors.
  2. When serializing a None, a transientNone flag from PicklerConfiguration decides how to handle it:
    a) skip the field entirely (when transientNone == true, default)
    b) serialize value as null (when transientNone == false)
    The flag name and behavior are inspired by jsoniter-scala. This changes the current behavior, which was b). Skipping by default seems like a more convenient default though.

@kciesielski kciesielski marked this pull request as ready for review June 3, 2024 20:13
@kciesielski kciesielski requested a review from adamw June 3, 2024 20:13
@adamw adamw merged commit 4baf7d0 into master Jun 4, 2024
26 checks passed
@adamw adamw deleted the pickler-option-none branch June 4, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants