@@ -644,6 +644,36 @@ public void testIntArrayToEnum() throws IOException {
644644 TestUtils .assertFileContains (modelKt , "enum class DaysOfWeek(val value: kotlin.Int)" );
645645 }
646646
647+ @ Test (description = "convert an empty model to object" )
648+ public void emptyModelKotlinxSerializationTest () throws IOException {
649+ final Schema <?> schema = new ObjectSchema ()
650+ .description ("an empty model" );
651+ final DefaultCodegen codegen = new KotlinClientCodegen ();
652+ codegen .processOpts ();
653+
654+ OpenAPI openAPI = TestUtils .createOpenAPIWithOneSchema ("EmptyModel" , schema );
655+ codegen .setOpenAPI (openAPI );
656+
657+ File output = Files .createTempDirectory ("test" ).toFile ();
658+ output .deleteOnExit ();
659+
660+ final CodegenConfigurator configurator = new CodegenConfigurator ()
661+ .setGeneratorName ("kotlin" )
662+ .setAdditionalProperties (new HashMap <>() {{
663+ put (CodegenConstants .MODEL_PACKAGE , "model" );
664+ put (SERIALIZATION_LIBRARY , "kotlinx_serialization" );
665+ }})
666+ .setInputSpec ("src/test/resources/3_0/kotlin/empty-model.yaml" )
667+ .setOutputDir (output .getAbsolutePath ().replace ("\\ " , "/" ));
668+
669+ final ClientOptInput clientOptInput = configurator .toClientOptInput ();
670+ DefaultGenerator generator = new DefaultGenerator ();
671+ generator .opts (clientOptInput ).generate ();
672+
673+ final Path modelKt = Paths .get (output + "/src/main/kotlin/model/EmptyModel.kt" );
674+ TestUtils .assertFileNotContains (modelKt , "data class EmptyModel" );
675+ }
676+
647677 private static class ModelNameTest {
648678 private final String expectedName ;
649679 private final String expectedClassName ;
0 commit comments