SMILEY4 / ktor-swagger-ui

Kotlin Ktor plugin to generate OpenAPI and provide Swagger UI
Apache License 2.0
150 stars 25 forks source link

v3.0 missing feature - configuring the example encoder #105

Closed rChaoz closed 1 month ago

rChaoz commented 2 months ago

Before we could do this:

encoding {
    exampleEncoder { type, example ->
        Json.encodeToString(Json.serializersModule.serializer(type), example)
    }
}

This is no longer possible in v3 and very much needed as the default serializer doesn't correctly serialize sealed classes (it omits the discriminator "type" field, for example).