The Protobuf java converter functions allow you to generate documentation from your generated Java classes. Since Kompendium relies a lot on KProperties we have yet to find a way to connect this with our Java. For now the documentation is generated for the customTypes in NotarizedApplication.
Usage with Kotlinx
setup:
install(ContentNegotiation) {
json(Json {
encodeDefaults = false
// Combine the kompendium serializers with your custom java proto serializers
serializersModule =
KompendiumSerializersModule.module + SerializersModule { serializersModule = yourCustomProtoSerializers }
})
}
Route configuration as you normally would with one exception which is createType() to create kotlin type from a javaClass.
private fun Route.userDocumentation() {
install(NotarizedRoute()) {
post = PostInfo.builder {
summary("My User API")
description("Create a user")
request {
requestType(User::class.createType())
description("My user creation object")
}
response {
responseCode(HttpStatusCode.OK)
responseType(CreateUserResponse::class.createType())
description("Returns simulation object")
}
canRespond {
responseCode(HttpStatusCode.NotFound)
responseType<String>()
description("Indicates that the user could not be found")
}
}
}
}