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
interfaceFoo {
val empty
val notEmpty get() =!empty
}
data classBar(overrideval empty) : Foo
If I try to add @ru.tinkoff.kora.json.common.annotation.JsonSkip annotation to notEmpty property, I get the following error:
This annotation is not applicable to target 'member property without backing field or delegate'
However, if I then serialize Bar(false) instance with generated JsonWriter<Bar>, I get the following JSON:
{
"empty": false,
"notEmpty": true
}
So, there's currently no way to exclude inherited default property from serialization. The only workaround is to explicitly declare notEmpty inside Bar with backing field like so:
data classBar(overrideval empty) : Foo {
@JsonSkip
overrideval optional =!required // notice I'm not using get() anymore, so !required is stored in field
}
But this kills the whole point of creating notEmpty property in interface.
The text was updated successfully, but these errors were encountered:
Assume I have the following type hierarchy:
If I try to add
@ru.tinkoff.kora.json.common.annotation.JsonSkip
annotation tonotEmpty
property, I get the following error:However, if I then serialize
Bar(false)
instance with generatedJsonWriter<Bar>
, I get the following JSON:So, there's currently no way to exclude inherited default property from serialization. The only workaround is to explicitly declare
notEmpty
insideBar
with backing field like so:But this kills the whole point of creating
notEmpty
property in interface.The text was updated successfully, but these errors were encountered: