You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When instantiating an objectmapper with the KotlinModule and setting the nullIsSameAsDefault to true, the setting is not respected for non-string types. When parsing json with explicit {"field":null}, we expect the field to have the default, and not be null (see below)
…ight now
Cleaned up tests for null to default feature as they can now clearly show what is supported and what is not.
There is no way to provide default value for primitive fields which are not set as nullable, because the primitives are initialized to their defaults (0, 0.0, false etc.) and there is no possibility to distinguish if the value was initialized as a default primitive value or it was provided by user in content (in the first case we can use default parameter value but in the latter no)
Describe the bug
When instantiating an objectmapper with the KotlinModule and setting the nullIsSameAsDefault to true, the setting is not respected for non-string types. When parsing json with explicit {"field":null}, we expect the field to have the default, and not be null (see below)
This reopens ticket 425
To Reproduce
The following test should pass (but does not):
This prints
Only
myStr
,myNullable
andmyObj
used correct defaultsVersions
Kotlin: 1.6.21
Jackson-module-kotlin: 2.13.4
The text was updated successfully, but these errors were encountered: