Jeremiah Zucker
01/03/2022, 8:25 PMclass SomeSerializer : KSerializer<SomeClass> {
override val descriptor: SerialDescriptor = buildClassSerialDescriptor("SomeClass") {
element<Boolean>("flag")
element("nested", SomeSerializer().descriptor, isOptional = true)
}
// ...
}
This leads to a stack overflow since the init
of SomeSerializer
creates the descriptor
which then tries to new up another SomeSerializer
. That makes sense to me, but I wasn’t sure what the intended way of accomplishing something like this is. I know it’s possible if using one of the plugin generated serializers. Does this mean I might potentially need to implement SerialDescriptor
myself or is this something that’s already solved for and I’m just not seeing the path forward?Jeremiah Zucker
01/03/2022, 9:19 PM