add super hack to support undeclared polymorphic adapter fields (#84)
This commit is contained in:
@ -19,6 +19,7 @@ import io.bkbn.kompendium.playground.PlaygroundToC.testSingleGetInfo
|
||||
import io.bkbn.kompendium.playground.PlaygroundToC.testSingleGetInfoWithThrowable
|
||||
import io.bkbn.kompendium.playground.PlaygroundToC.testSinglePostInfo
|
||||
import io.bkbn.kompendium.playground.PlaygroundToC.testSinglePutInfo
|
||||
import io.bkbn.kompendium.playground.PlaygroundToC.testUndeclaredFields
|
||||
import io.bkbn.kompendium.routes.openApi
|
||||
import io.bkbn.kompendium.routes.redoc
|
||||
import io.bkbn.kompendium.swagger.swaggerUI
|
||||
@ -138,5 +139,10 @@ fun Application.mainModule() {
|
||||
error("bad things just happened")
|
||||
}
|
||||
}
|
||||
route("/undeclared") {
|
||||
notarizedGet(testUndeclaredFields) {
|
||||
call.respondText { "hi" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package io.bkbn.kompendium.playground
|
||||
import io.bkbn.kompendium.annotations.KompendiumField
|
||||
import io.bkbn.kompendium.annotations.KompendiumParam
|
||||
import io.bkbn.kompendium.annotations.ParamType
|
||||
import io.bkbn.kompendium.annotations.UndeclaredField
|
||||
import org.joda.time.DateTime
|
||||
|
||||
data class ExampleParams(
|
||||
@ -33,3 +34,11 @@ data class ExceptionResponse(val message: String)
|
||||
data class ExampleCreatedResponse(val id: Int, val c: String)
|
||||
|
||||
data class DateTimeWrapper(val dt: DateTime)
|
||||
|
||||
enum class Testerino {
|
||||
First,
|
||||
Second
|
||||
}
|
||||
|
||||
@UndeclaredField("type", Testerino::class)
|
||||
data class SimpleYetMysterious(val exists: Boolean)
|
||||
|
@ -109,4 +109,13 @@ object PlaygroundToC {
|
||||
),
|
||||
securitySchemes = setOf("basic")
|
||||
)
|
||||
val testUndeclaredFields = MethodInfo.GetInfo<Unit, SimpleYetMysterious>(
|
||||
summary = "Tests adding undeclared fields",
|
||||
description = "vvv mysterious",
|
||||
tags = setOf("mysterious"),
|
||||
responseInfo = ResponseInfo(
|
||||
status = HttpStatusCode.OK,
|
||||
description = "good tings"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user