micronaut-data: `io.micronaut.core.annotation.Nullable` has stereotype `@Nonnull(when = When.MAYBE)` on it hence fails on null properties supplied
Expected Behavior
io.micronaut.core.annotation.Nullable
should make parameter non-required, nullable.
Actual Behaviour
This on is kind of nonsense… so annotation io.micronaut.core.annotation.Nullable
has @Nonnull(when = When.MAYBE)
, so this module - Serde - makes annotated properties required, non-nullable 🥇
😃
When I removed annotation io.micronaut.core.annotation.Nullable
after several hours of trials and failures- it worked!
io.micronaut.core.annotation.AnnotatedElement
/**
* @return Whether the element is declared as not being null
*/
default boolean isNonNull() { // this gives `true` for property annotated with `io.micronaut.core.annotation.Nullable`
return getAnnotationMetadata().hasStereotype(AnnotationUtil.NON_NULL);
}
Steps To Reproduce
I guess it simple enough from description.
Environment Information
Serde m7 micronaut 3.3.3
Example Application
https://github.com/soberich/micronaut-serialization-134
Version
3.3.3
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (9 by maintainers)
Commits related to this issue
- micronaut-projects/micronaut-serialization#134 Add failing test — committed to soberich/micronaut-serialization-134 by soberich 2 years ago
- micronaut-projects/micronaut-serialization#134 Change to indicate Lombok probably isn't the cause — committed to soberich/micronaut-serialization-134 by soberich 2 years ago
- micronaut-projects/micronaut-serialization#134 failing version — committed to soberich/micronaut-serialization-134 by soberich 2 years ago
- micronaut-projects/micronaut-serialization#134 failing version — committed to soberich/micronaut-serialization-134 by soberich 2 years ago
Fixed in core 3.3.x by https://github.com/micronaut-projects/micronaut-core/pull/6980 . thanks for the report.
yes I think we should fix the core issue
You can fix this by upgrading to
micronaut-data
3.3.0-M1 since the bug is there. When Micronaut 3.4 is final and this library is final it will be a non-issue