-
-
Notifications
You must be signed in to change notification settings - Fork 543
Closed
Description
I have a set of objects that have a shared interface of type "Action." The yaml being produced includes a discriminator property name like it should, but it's missing the mapping. Here's what it looks like (kotlin, sorry):
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXISTING_PROPERTY,
property = "name",
visible = true
)
@JsonSubTypes(
value = [
Type(name = "type1", value = ActionType1::class),
Type(name = "type2, value = ActionType2::class),
...
]
)
interface Action {
val name: String //this is the discriminator
...
}
This produces the following yaml:
ActionObject:
type: object
properties:
name:
type: string
...
discriminator:
propertyName: name
It should also produce a mapping like so:
discriminator:
propertyName: name
mapping:
type1: '#/components/schemas/ActionType1'
type2: '#/components/schemas/ActionType2'
Then a code generator will include the mappings on the resulting JsonSubTypes annotation as in the original source.
Metadata
Metadata
Assignees
Labels
No labels