Skip to content

fix: add mapBlankStringToNull option to JsonNullableModule#126

Open
krangerich wants to merge 1 commit intoOpenAPITools:masterfrom
krangerich:fix/blank-string-deserializes-to-undefined
Open

fix: add mapBlankStringToNull option to JsonNullableModule#126
krangerich wants to merge 1 commit intoOpenAPITools:masterfrom
krangerich:fix/blank-string-deserializes-to-undefined

Conversation

@krangerich
Copy link

@krangerich krangerich commented Feb 27, 2026

Blank strings for non-String fields were silently deserialized as undefined() instead of of(null), breaking PATCH semantics. Default remains false for backwards compatibility.


Summary by cubic

Adds a module option to control how blank strings deserialize for non-String JsonNullable fields. When enabled, "" or " " become JsonNullable.of(null) instead of undefined, restoring correct PATCH semantics. Default stays false for backward compatibility.

  • New Features

    • JsonNullableModule.mapBlankStringToNull(boolean): if true, blank strings for non-String targets deserialize as JsonNullable.of(null). Strings are unaffected.
    • Configuration is passed through JsonNullableDeserializers and JsonNullableDeserializer; tests added.
  • Migration

    • To enable: register new JsonNullableModule().mapBlankStringToNull(true).

Written for commit 67a328e. Summary will update on new commits.

Blank strings for non-String fields were silently deserialized as undefined()
instead of of(null), breaking PATCH semantics. Default remains false for
backwards compatibility.
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

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.

1 participant