Skip to content

Blank strings should not be deserialized as JsonNullable.undefined() #125

@krangerich

Description

@krangerich

Context: When a request object has a field like Integer, but an empty/blank string is given, then Jackson deserializes this value as null.
When deserializing the empty/blank string into something like Optional<Integer>, then this will result in a value of Optional.empty(), not null.

The behavior of JsonNullable is inconsistent here: When using JsonNullable<Integer>, an empty/blank string will be deserialized as JsonNullable.undefined() (=not provided in the request) instead of JsonNullable.of(null) (=provided, but a null value).

I think, the best behavior here should be, that empty/blank strings should be deserialized as JsonNullable.of(null), not JsonNullable.undefined()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions