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.
I searched in the issues of databind and other modules used and found nothing similar.
I have confirmed that the problem only occurs when using Kotlin.
Describe the bug
I use value class for the field type. I have that type annotated by JsonProperty for assigning mapping to some other field name in JSON.
But it seems that it is ignored and is used field name in class for the search field in JSON.
Edit: it happened also for other fields in object which aren't value class
Edit2: when I use @field:JsonProperty(...) on all fields in class it works as expected...but it is bad
error:
Instantiation of [simple type, class com.xyz.api.financial.adapter.output.sadd.client.dto.SymbolSearchResult$Symbol] value failed for JSON property exchangeTimezone due to missing (therefore NULL) value for creator parameter exchangeTimezone which is a non-nullable type
at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: com.xyz.api.financial.adapter.output.sadd.client.dto.SymbolSearchResult["data"]->java.util.ArrayList[0]-com.xyz.api.financial.adapter.output.sadd.client.dto.SymbolSearchResult$Symbol["exchangeTimezone"])
com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException: Instantiation of [simple type, class com.xyz.api.financial.adapter.output.sadd.client.dto.SymbolSearchResult$Symbol] value failed for JSON property exchangeTimezone due to missing (therefore NULL) value for creator parameter exchangeTimezone which is a non-nullable type
at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: com.xyz.api.financial.adapter.output.sadd.client.dto.SymbolSearchResult["data"]->java.util.ArrayList[0]-com.xyz.api.financial.adapter.output.sadd.client.dto.SymbolSearchResult$Symbol["exchangeTimezone"])
at com.fasterxml.jackson.module.kotlin.KotlinValueInstantiator.createFromObjectWith(KotlinValueInstantiator.kt:97)
To Reproduce
@JvmInline
value classCurrencyCodeTw(valtwCurrencyCode:String)
data classSymbol(
@JsonProperty("currency") valcurrencyCode:CurrencyCodeTw,
@JsonProperty("exchange_timezone") valexchangeTimezone:String
)
Search before asking
Describe the bug
I use value class for the field type. I have that type annotated by JsonProperty for assigning mapping to some other field name in JSON.
But it seems that it is ignored and is used field name in class for the search field in JSON.
Edit: it happened also for other fields in object which aren't value class
Edit2: when I use
@field:JsonProperty(...)
on all fields in class it works as expected...but it is baderror:
Instantiation of [simple type, class com.xyz.api.financial.adapter.output.sadd.client.dto.SymbolSearchResult$Symbol] value failed for JSON property exchangeTimezone due to missing (therefore NULL) value for creator parameter exchangeTimezone which is a non-nullable type
at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: com.xyz.api.financial.adapter.output.sadd.client.dto.SymbolSearchResult["data"]->java.util.ArrayList[0]-com.xyz.api.financial.adapter.output.sadd.client.dto.SymbolSearchResult$Symbol["exchangeTimezone"])
com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException: Instantiation of [simple type, class com.xyz.api.financial.adapter.output.sadd.client.dto.SymbolSearchResult$Symbol] value failed for JSON property exchangeTimezone due to missing (therefore NULL) value for creator parameter exchangeTimezone which is a non-nullable type
at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: com.xyz.api.financial.adapter.output.sadd.client.dto.SymbolSearchResult["data"]->java.util.ArrayList[0]-com.xyz.api.financial.adapter.output.sadd.client.dto.SymbolSearchResult$Symbol["exchangeTimezone"])
at com.fasterxml.jackson.module.kotlin.KotlinValueInstantiator.createFromObjectWith(KotlinValueInstantiator.kt:97)
To Reproduce
Expected behavior
No response
Versions
Kotlin: 1.9
Jackson-module-kotlin: 2.17.0
Jackson-databind:
Additional context
No response
The text was updated successfully, but these errors were encountered: