-
Notifications
You must be signed in to change notification settings - Fork 1k
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
MN:4.4.0 - Changed behavior for @JsonGetter in @Introspected-annotated classes #10737
Comments
@dstepanov Any ideas? |
It's probably some KSP stuff. I have added similar test to Micronaut Serialization and fixed some bug micronaut-projects/micronaut-serialization#826 |
Looks like the annotation is not retained in the property annotations |
Seems like you're right about KSP @dstepanov. When replacing it with |
It might be us, as changing the field name in the reproducer to be different to the JsonGetter name seems to work diff --git a/gradle.properties b/gradle.properties
index ab4cf7a..c3fd1bb 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,3 +1,3 @@
-micronautVersion=4.3.8
+micronautVersion=4.4.0
kotlinVersion=1.9.23
org.gradle.jvmargs=-Xmx4096M
diff --git a/src/main/kotlin/no/javatec/viewmodel/ClassificationAndStats.kt b/src/main/kotlin/no/javatec/viewmodel/ClassificationAndStats.kt
index 3972f0b..3ecf94a 100644
--- a/src/main/kotlin/no/javatec/viewmodel/ClassificationAndStats.kt
+++ b/src/main/kotlin/no/javatec/viewmodel/ClassificationAndStats.kt
@@ -9,8 +9,8 @@ data class ClassificationAndStats<out T : StatsEntry>(
val klassifisering: ClassificationVars,
/** Ignore field to avoid double wrapping of values in resulting JSON */
@JsonIgnore
- val stats: T
+ val spats: T
) {
@JsonGetter("stats")
- fun getValues(): Map<Aggregation, Int> = stats.shouldNotAppearInJson
+ fun getValues(): Map<Aggregation, Int> = spats.shouldNotAppearInJson
} |
Working now with MN:4.4.1 👍 |
Expected Behavior
With the example application and MN:4.4.0, I expect this JSON as output from the controller.
Actual Behaviour
This is a simplistic reconstruction of what happened:
changed to
with MN:4.4.0.
Steps To Reproduce
./gradlew clean run
Observe that JSON has changed to
Please note that removing
@Introspected
fixes the issue.Environment Information
JDK 21
Kotlin 1.9.23
Ubuntu 22.04
Example Application
https://github.com/roar-skinderviken/MN-4.4-jackson-issue
Version
4.4.0
The text was updated successfully, but these errors were encountered: