Compile error on arrays of objects with `additionalPropertiesOption: strict`
At compile-time we see the following when setting additionalPropertiesOption: strict in the config:
Cannot check for instance of erased type: List<Bar.Foo>
For a schema containing an array of objects:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "bar.schema.json",
"properties": {
"foos": {
"type": "array",
"items": {
"id": "foo",
"type": "object"
}
}
}
}
The offending generated code in Bar.kt:
if (cg_map.containsKey("foos"))
require(cg_map["foos"] is List<Foo>) { "foos is not the correct type, expecting List<Foo>?" }
This is a blocker for us, since our schema required pattern properties, thus iiuc we need to enable additionalPropertiesOption: strict for the relevant code the generated.
Applying via json-kotlin-gradle plugin 0.102.
@pwall567 Do you have bandwidth to provide a fix? 🙏
I had already encountered this one, and I was hoping to get a fix out before anyone else ran into it. :smile:
I expect to have a fix for this shortly.
And version 0.103 should also fix this problem.
Thank you for your help in identifying these issues. As you have probably seen, there are a large number of combinations to be tested, and while I hope my tests cover most of them, I suspect there are still issues yet to be unearthed.