Swagger `@Schema` annotation is ignored
Closed this issue · 3 comments
rmcmk commented
Reproducer
import io.swagger.v3.oas.annotations.media.Schema
import io.github.smiley4.schemakenerator.core.annotations.Default
enum class OrderBy {
ASC,
DESC
}
data class Query(
val limit: Int,
@Schema(defaultValue = "asc")
val order: OrderBy = OrderBy.ASC
)
data class AnotherQuery(
val limit: Int,
@Default("asc")
val order: OrderBy = OrderBy.ASC
)
rmcmk commented
Some more info:
- This is using the kotlinx-generator (have not tested with reflection)
@Default
did not work for me due to #34. Other core annotations are working as expected@Schema
is the only annotation I am having issues with (seems like none of the properties are being forwarded)
generator = { type ->
type
.processKotlinxSerialization()
.connectSubTypes()
.handleNameAnnotation()
.addDiscriminatorProperty()
.generateSwaggerSchema { optionalHandling = OptionalHandling.NON_REQUIRED }
.withTitle(TitleType.OPENAPI_SIMPLE)
.handleCoreAnnotations()
.handleSwaggerAnnotations()
.handleSchemaAnnotations()
.compileReferencingRoot(RefType.OPENAPI_SIMPLE)
}