Are some kind of adapters/converters in the roadma...
# kotlinx-rpc
j
Are some kind of adapters/converters in the roadmap? For example, allowing using value classes for IDs instead of generating a String and mapping it manually to the value class?
a
Can you give an example please?
j
Copy code
// foo.proto

string id = 1 [(kotlinx.rpc.field).type = "com.example.UserId", (kotlinx.rpc.field).converter = "com.example.UserIdConverter"];
Copy code
// converter.kt

object UserIdConverter : ProtoConverter<String, UserId> {
    override fun wrap(value: String) = UserId(value)
    override fun unwrap(value: UserId) = value.value
}
That generates
val id: UserId
.
a
Wasn't on the table, but we'll take a note, thanks!
Cc @Johannes Zottele
👀 1