Closed georgi-mirchev closed 1 month ago
Enums as sealed subtypes isn't a case I'd considered. PR is welcome though!
I don't think it would work the way you've described in your sample though. They'd be more akin to a nested sealed subtype and would work functionally the same as this
sealed class Error : Outcome {
@TypeLabel(...)
object USER_FAILURE : Error()
@TypeLabel(...)
object SYSTEM_FAILURE : Error()
}
I'm going to close this as wontfix, the example you've put forward doesn't actually make much practical sense as there's no way to decide which enum member to use in your example. Feel free to revisit if you have an idea.
We cannot get Moshi sealed to work correctly with enums that implement a sealed interface. We have the following example:
Does it support such cases?