You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a set of Enums implementing a common interface. But in the generated code, the Enums are not implementing the interface. Using discriminatorMapping - the type is referenced as an External Property
Sample code - The issue, in this case is Cow and Sheep classes in the client do not implement Animal
@Schema(
description = "Animals",
discriminatorProperty = "type",
discriminatorMapping = [
DiscriminatorMapping(value = "COW_FARM", schema = Cow::class),
DiscriminatorMapping(value = "SHEEP_FARM", schema = Sheep::class),
],
)
@JsonTypeInfo(
use = JsonTypeInfo.Id.NONE,
include = JsonTypeInfo.As.EXTERNAL_PROPERTY,
property = "type",
)
@JsonSubTypes(
JsonSubTypes.Type(name = "COW_FARM", value = Cow::class),
JsonSubTypes.Type(name = "SHEEP_FARM", value = Sheep::class),
)
interface Animal
enum class Cow : Animal {
"Moo";
}
enum class Sheep : Animal {
"Baa";
}
enum class FarmType {
"COW_FARM",
"SHEEP_FARM";
}
interface Farm {
val type: FarmType
val animal: Animal
}
class CowFarm : Farm {
val type : FarmType = FarmType.COW_FARM,
val animal: Cow
}
class SheepFarm : Farm {
val type : FarmType = FarmType.SHEEP_FARM,
val animal: Sheep
}
The text was updated successfully, but these errors were encountered:
We have a set of Enums implementing a common interface. But in the generated code, the Enums are not implementing the interface. Using discriminatorMapping - the type is referenced as an External Property
Sample code - The issue, in this case is Cow and Sheep classes in the client do not implement Animal
The text was updated successfully, but these errors were encountered: