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
I searched in the issues and found nothing similar.
Describe the bug
First, I was not aware where to report this, so I chose this repo.
I'm aware that inline classes are not supported out-of-the-box yet, but this seems different than what is being discussed in issue 199, so I decided to create this new issue.
When annotating both @JsonSerialize and @JsonProperty in an inline class property inside data class, for some reason, all JsonProperty annotations in that class are not respected.
Scenarios I tested:
In my original code, I annotated inline class with JsonSerialize and JsonDeserlize.
I tested annotating property directly and it had the same result.
Scenarios I tested against:
Use custom serialization on a regular property: works as expected
Use a normal class as a wrapper instead of inline class: works as expected
Use directly wrapped value: works as expected
To Reproduce
I created a repo to reproduce this bug. I used spring-boot-web to be able to use @JsonTest with JacksonTester to make the test clearer. Just run tests with ./gradlew test
Just for the sake of documentation, assume SampleInline is a BigDecimal inline class and is annotated with a correct JsonSerializer that just does a toString in internal big decimal.
data classWithInlineClass(
@JsonProperty("testField1") valotherName1:SampleInline,
@JsonProperty("testField2") valotherName2:OtherClass,
)
data classOtherClass(
@JsonProperty("foo1") valbar1:Int,
@JsonProperty("foo2") valbar2:String,
)
Search before asking
Describe the bug
First, I was not aware where to report this, so I chose this repo.
I'm aware that inline classes are not supported out-of-the-box yet, but this seems different than what is being discussed in issue 199, so I decided to create this new issue.
When annotating both @JsonSerialize and @JsonProperty in an inline class property inside data class, for some reason, all JsonProperty annotations in that class are not respected.
Scenarios I tested:
Scenarios I tested against:
To Reproduce
I created a repo to reproduce this bug. I used spring-boot-web to be able to use
@JsonTest
withJacksonTester
to make the test clearer. Just run tests with./gradlew test
Just for the sake of documentation, assume SampleInline is a BigDecimal inline class and is annotated with a correct JsonSerializer that just does a
toString
in internal big decimal.Expected behavior
I expect that to seralize to something like:
But it is actually serializing to this:
Versions
Kotlin:
Jackson-module-kotlin:
Jackson-databind:
Additional context
In case this is expected not to work, as value class support is still WIP, no problem closing this issue. Just wanted to share this.
The text was updated successfully, but these errors were encountered: