Is your feature request related to a problem? Please describe.
Enum names are always prefixed by ENUM_NAME_ and this is not very intuitive for kotlin code. This is a limitation to support C++ generated code.
Describe the solution you'd like
Add an option to automatically remove ENUM_NAME_ prefix from generated enums.
Describe alternatives you've considered
None
Additional context
I think we can include an option to remove the ENUM_NAME_ prefix from the actual enum names in the generated code. Such as
enum State {
STATE_UNKNOWN = 0
STATE_KNOWN = 1
}
will be converted to
@Serializable
public enum class State {
@ProtoNumber(number = 0)
UNKNOWN,
@ProtoNumber(number = 1)
KNOWN,
}
And this can be toggled via an option
generateProtoTasks {
all().forEach {
it.plugins {
id("kotlinx-protobuf-gen") {
option("remove_enum_prefix") // <-- this
}
}
}
}
Based on conversation with @tamnguyenhuy from #14
Is your feature request related to a problem? Please describe.
Enum names are always prefixed by
ENUM_NAME_and this is not very intuitive for kotlin code. This is a limitation to support C++ generated code.Describe the solution you'd like
Add an option to automatically remove
ENUM_NAME_prefix from generated enums.Describe alternatives you've considered
None
Additional context
I think we can include an option to remove the ENUM_NAME_ prefix from the actual enum names in the generated code. Such as
will be converted to
And this can be toggled via an option
generateProtoTasks { all().forEach { it.plugins { id("kotlinx-protobuf-gen") { option("remove_enum_prefix") // <-- this } } } }Based on conversation with @tamnguyenhuy from #14