@Serializable
data class A(
val a: JsonObject,
// val b: JsonObject,
)
But will break when a second JsonObject is contained in the data class:
@Serializable
data class A(
val a: JsonObject,
val b: JsonObject,
)
java.lang.NullPointerException
at io.github.smiley4.schemakenerator.swagger.steps.SwaggerSchemaCompileStep$referenceDefinitionsReferences$json$1.invoke(SwaggerSchemaCompileStep.kt:84)
at io.github.smiley4.schemakenerator.swagger.steps.SwaggerSchemaCompileStep$referenceDefinitionsReferences$json$1.invoke(SwaggerSchemaCompileStep.kt:82)
at io.github.smiley4.schemakenerator.swagger.steps.SwaggerSchemaCompileStep.replaceReferences(SwaggerSchemaCompileStep.kt:158)
at io.github.smiley4.schemakenerator.swagger.steps.SwaggerSchemaCompileStep.replaceReferences(SwaggerSchemaCompileStep.kt:162)
at io.github.smiley4.schemakenerator.swagger.steps.SwaggerSchemaCompileStep.referenceDefinitionsReferences(SwaggerSchemaCompileStep.kt:82)
at io.github.smiley4.schemakenerator.swagger.steps.SwaggerSchemaCompileStep.compileReferencing(SwaggerSchemaCompileStep.kt:47)
at io.github.smiley4.schemakenerator.swagger.steps.SwaggerSchemaCompileStep.compileReferencingRoot(SwaggerSchemaCompileStep.kt:60)
at io.github.smiley4.schemakenerator.swagger.StepsKt.compileReferencingRoot(steps.kt:89)
at io.github.smiley4.schemakenerator.swagger.StepsKt.compileReferencingRoot$default(steps.kt:88)
Though it does work when using the reflection schema generator instead of the kotlinx.serialization schema generator, like this:
type
.collectSubTypes()
.processReflection()
.connectSubTypes()
.handleNameAnnotation()
.generateSwaggerSchema()
.handleCoreAnnotations()
.withAutoTitle(TitleType.SIMPLE)
.compileReferencingRoot()
Hi, thanks for reporting this bug.
The issue should now be fixed with version 1.0.1 (and for ktor-swagger-ui soon aswell).
I you encounter any other issues just let me know :)
When using this setup:
It is able to compile a swagger schema for:
But will break when a second JsonObject is contained in the data class:
Though it does work when using the reflection schema generator instead of the kotlinx.serialization schema generator, like this: