OpenAPITools / OpenAPITools/jackson-databind-nullable
Blank strings should not be deserialized as JsonNullable.undefined()
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 153
- Forks
- 47
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 6
Description
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()
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the JsonNullable Jackson deserialization path in this repository and compare how blank strings are handled for Integer, Optional, and JsonNullable. Confirm the change by adding or updating coverage for blank-string input so it yields JsonNullable.of(null) rather than JsonNullable.undefined().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100