I see that there is `@Required` in order to ensure...
# serialization
s
I see that there is
@Required
in order to ensure that during deserialization process, even if a class has a default value, the input still needs to have the field present. Is there something for the opposite, where I got a class like
Copy code
@Serializable
internal data class Foo(
    val bar: String,
) {
    val baz: String = "fixed_value"
}
and I do in fact want the serialization process for this for object
Foo("someInput")
to serialize into this
Copy code
{
  "bar": "someInput",
  "baz": "fixed_value"
}
I think that
encodeDefaults = true
on my
JsonBuilder
would fix this, but that is a global setting which I am not sure I necessarily want to enforce in all other places as well.
Oh, welp, it looks like
@kotlinx.serialization.EncodeDefault(mode = ALWAYS)
is what I want actually rubber duck