Support for sealed interfaces (across multiple files)
See original GitHub issueI’m using a sealed interface and when I try to generate an avro schema for the sealed hierarchy I get:
Exception in thread "main" kotlinx.serialization.SerializationException: Unsupported type kotlinx.serialization.Polymorphic<SkillsCoachPublishedEvent> of OPEN
at com.sksamuel.avro4k.schema.SchemaForKt.schemaFor(SchemaFor.kt:160)
at com.sksamuel.avro4k.schema.ClassSchemaFor.buildField(ClassSchemaFor.kt:70)
at com.sksamuel.avro4k.schema.ClassSchemaFor.dataClassSchema(ClassSchemaFor.kt:55)
at com.sksamuel.avro4k.schema.ClassSchemaFor.schema(ClassSchemaFor.kt:43)
at com.sksamuel.avro4k.Avro.schema(Avro.kt:239)
at events.AvroSchemaGeneratorKt.main(AvroSchemaGenerator.kt:12)
it looks like kotlinx-serialization
thinks this class is SerialKind.OPEN
instead of SerialKind.SEALED
so I guess this could be a kotlinx-serialization
issue with sealed interfaces (not sure if being across multiple files matters)
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Sealed interfaces in Kotlin - Jorge Castillo
Sealed interfaces are Experimental. They may be dropped or changed at any time. You can give feedback on them in YouTrack. Subclass location....
Read more >Kotlin: Sealed classes and Sealed Interfaces in 2022 - Medium
Sealed classes can now form more flexible hierarchies. They can have subclasses in all files of the same compilation unit and the same...
Read more >Kotlin's Sealed Interfaces & The Hole in The Sealing
Sealed interfaces are a powerful new feature in Kotlin. But they can be easily misused. This article explains when and how to (not)...
Read more >Sealed classes | Kotlin
Sealed classes and interfaces represent restricted class hierarchies that provide more control over inheritance. All direct subclasses of a ...
Read more >Sealed interfaces and sealed classes freedom #226 - GitHub
Introduce the concept of a sealed interface. Allow more freedom to sealed class, unify both sealed interface and sealed class as the same ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Implemented with #111
Current main supports sealed interfaces