Allow to suppress null values in serialization
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start by reading JsonNullableSerializer and JsonNullableModule to understand how suppressNull is currently handled, then inspect the repository's existing serialization tests. Define whether the change should make the serializer respect ObjectMapper's Include.NON_NULL setting or add a module-level toggle, and consider the work done when the chosen behavior is covered by tests.
Written by the indexing model from the issue text.
Description
In order to minimize my response body size from my REST controllers, I would like to be able to supress all null values when serializing to JSON, however when I changed my ObjectMapper to use Include.NON_NULL by default I found that suppressNull is hard coded to false in JsonNullableSerializer. This results in considerable bloat.
You might wonder why I don't use JsonNullable.undefined() instead. I have an OpenAPI schema with 679 different fields, of which 174 are nullable. Keeping track of which fields are nullable, and changing all of those converter classes to use JsonNullable is quite a lot of work. On top of that, the Java models generated with openapi-generator-maven-plugin do not create fluent setters for JsonNullable.
It would save me a lot of effort if JsonNullableSerializer would just respect suppressNull, is that something you would agree to change?
If not, I could submit a PR to add a setting to JsonNullableModule to toggle whether suppressNull should be respected?
- Dominant language
- Java
- Stars
- 158
- Forks
- 47
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 3
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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.
More from OpenAPITools/jackson-databind-nullable
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
OpenAPITools/jackson-databind-nullable#47 · 4 comments · 1 reaction ·
Maintainers usually reply within 2 days
-
Blank strings should not be deserialized as JsonNullable.undefined()Possibly taken @joshuabrandes claimed this 152 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 45/100
OpenAPITools/jackson-databind-nullable#125 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
OpenAPITools/jackson-databind-nullable#74 · 13 comments ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
OpenAPITools/jackson-databind-nullable#71 · 24 comments ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
OpenAPITools/jackson-databind-nullable#17 · 4 comments ·
Maintainers usually reply within 2 days
All issues in OpenAPITools/jackson-databind-nullable
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
eclipse-tradista/tradista#371 ·
Maintainers usually reply within 1 day
-
critical
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mars-sim/mars-sim#2199 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
projeto-ong-amar/projeto-ong-amar-backend#26 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
primefaces/primefaces#15568 ·
Maintainers usually reply within 1 day
-
崩溃日志只按 CRLF 分行Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PCL-Community/PCL-CE#3872 ·
Maintainers usually reply within 1 day