How to add a Schema derivation of a Union Type

Hi
I have a union type of 2 Scala 3 Enums, like

case class In(
      subStatusKey: SubStatusKeyDocuments | SubStatusKeyGeneral = SubStatusKeyDocuments.`documents-prepared`,
     )
object In:
    given Schema[In] = Schema.derived
    given CirceCodec[In] = deriveCodec
end In

enum SubStatusKeyGeneral derives ConfiguredEnumCodec:
  case canceled
  case finished

object SubStatusKeyGeneral:
  given Schema[SubStatusKeyGeneral] = Schema.derived
end SubStatusKeyGeneral
...

This does not work - is there a working example or are union types not supported?
I use Circe for Json Marshalling.

I am the only one that uses Union Types with Tapir? :cry:

Sorry for the late reply :slight_smile:

Indeed that’s something that we should definitely support. Can you create an issue on GH to track this?

Also, I suspect you’d expect a coproduct (oneOf schema) to be generated? Would this match your JSON format?

Thanks, here the issue on Github: Support Union Types in Tapir · Issue #3412 · softwaremill/tapir · GitHub