-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There are cases where isRequired
specifications are not properly merged.
#668
Comments
@cowtowncoder |
@k163377 Yes and no: annotations are merged across accessors on purpose, to remove need to duplicate settings (i.e. can add One problem, however, is that information from annotations is not merged as part of flattening: so all information from |
isRequired
is overridden by the JsonProperty granted to accessor.isRequired
specifications are not properly merged.
@cowtowncoder |
Jackson
has a policy of merging annotations assigned to accessors, fields, or parameters into a single property.ProjectMapK/jackson-module-kogera#101 (comment)
Therefore, the goal of this issue is to match the behavior of
databind
.The following is an old explanation.
Describe the bug
For example, if a getter is given
JsonProperty(required = true)
, the parameternullability
is ignored and overridden byrequired = true
.This appears to be an unexpected behavior, since getters are not involved in deserialization.
Also, since this override does not occur for setters, there is no consistency in behavior.
To Reproduce
Expected behavior
Annotations assigned to accessors should not affect the creator.
Versions
Kotlin: 1.5.32
Jackson-module-kotlin & Jackson-databind: 2.15.0
Additional context
If processing is performed without registering a
KotlinModule
, a ~ c and x ~ z will all betrue
.Therefore, a possible policy is to match the
KotlinModule
to this result.The text was updated successfully, but these errors were encountered: