Protobuf java converter
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 }
})
}For one message and all its nested sub messages:
private fun Application.mainModule() {
// ...
install(NotarizedApplication()) {
spec = baseSpec
customTypes = MyJavaProto.getDefaultInstance().createCustomTypesForTypeAndSubTypes().toMap()
}
}For multiple messages and their submesages:
Example User
The protobuf that is used on our endpoint
A custom serializer deserializer:
Setting the content type:
The installation of the noterized application:
Route configuration as you normally would with one exception which is createType() to create kotlin type from a javaClass.
Last updated