eclipse / microprofile-open-api

Microprofile open api
Apache License 2.0
131 stars 81 forks source link

Kotlin value classes not represented correctly. #544

Closed dirkbolte closed 2 years ago

dirkbolte commented 2 years ago

When adding a kotlind value class to a response, the property name is added twice. I tried different approaches with specifying schema, but wasn't able to correct or hide the additional property.

value class:

@JvmInline
value class IdWithOverwrittenSchema(val value: Long)

Response:

data class TestResponse(
    @field:Schema(type = SchemaType.INTEGER, implementation = Long::class, name = "idWithOverwrittenSchema")
)

Resource:

@Path("/test")
class TestResource {
    @GET
    fun testMethod(): TestResponse {
        return TestResponse()
    }
}

I tried different variations and put some of them in a sample project: https://github.com/dirkbolte/openapi-test

The result looks like this:

value_class_bug

value classes as method parameters (e.g. on @GET with @PathParam do not have this issue and are parsed correctly.

Versions:

phillip-kruger commented 2 years ago

Rather open an issue in Quarkus, or maybe even Smallrye openapi.

dirkbolte commented 2 years ago

done: https://github.com/smallrye/smallrye-open-api/issues/1195