Summary
The Kotlin/Klaxon renderer can generate map values as JsonObject for empty object shapes, but Klaxon fails to deserialize {} into JsonObject in that position.
Reproduction
This was found while adding the regression fixture in #2877:
{
"mission_specs": {
"1": { "objectives": { "2": { "rewards": { "3": {}, "5": {} } } } },
"4": { "objectives": { "6": { "rewards": {} } } }
}
}
The generated Kotlin contains:
val rewards: Map<String, Reward>
typealias Reward = JsonObject
Running the Kotlin/Klaxon fixture fails with:
KlaxonException: Couldn't find a suitable constructor for class JsonObject to initialize with {}
Expected behavior
The generated Kotlin/Klaxon code should deserialize empty object values in maps successfully, or represent that shape in a way Klaxon can handle.
Notes
#2877 is skipping its new fixture for Kotlin/Klaxon so the unrelated core regression fix can pass CI. Kotlin-Jackson did not hit this failure.
Summary
The Kotlin/Klaxon renderer can generate map values as
JsonObjectfor empty object shapes, but Klaxon fails to deserialize{}intoJsonObjectin that position.Reproduction
This was found while adding the regression fixture in #2877:
{ "mission_specs": { "1": { "objectives": { "2": { "rewards": { "3": {}, "5": {} } } } }, "4": { "objectives": { "6": { "rewards": {} } } } } }The generated Kotlin contains:
Running the Kotlin/Klaxon fixture fails with:
Expected behavior
The generated Kotlin/Klaxon code should deserialize empty object values in maps successfully, or represent that shape in a way Klaxon can handle.
Notes
#2877 is skipping its new fixture for Kotlin/Klaxon so the unrelated core regression fix can pass CI. Kotlin-Jackson did not hit this failure.