Nested oneOf and allOf when using oneOf with @JsonSubTypes
Describe the bug When I use @JsonSubTypes with @Schema(oneOf = {..}), the model schema shows infinite nested oneOf and allOf. When I remove @JsonSubTypes from the parent model, everything works well. Am i doing something wrong or is this expected behaviour ?
Expected behavior The expected behavior is to show only the oneOf field. After selecting one of the child classes, it should stop expanding.
Screenshots
The structure of the model
The output
Versions
- springdoc-openapi-starter-webmvc-ui 2.1.0
Also mentioned in #2575 and #2577, which have since been closed
This is still broken in 2.6.0
We ran into a similar (maybe the same?) issue when trying to use polymorphic types, like:
@JsonTypeInfo(use = NAME, include = PROPERTY, property = DISCRIMINATOR_PROPERTY) @JsonSubTypes( Type(value = Activate::class, name = ACTIVATE) ) @Schema( subTypes = [Activate::class], oneOf = [Activate::class], discriminatorProperty = DISCRIMINATOR_PROPERTY, discriminatorMapping = [ DiscriminatorMapping(value = ACTIVATE, schema = Activate::class) ] ) sealed interface PolymorphicEvent { @Schema(requiredProperties = [DISCRIMINATOR_PROPERTY]) @SchemaProperty(name = DISCRIMINATOR_PROPERTY, schema = Schema(allowableValues = [ACTIVATE])) data object Activate : PolymorphicEvent companion object { const val DISCRIMINATOR_PROPERTY = "type" const val ACTIVATE = "ACTIVATE" } }Defining this in 2.3.0 would work, but totally broke our Schema view in SwaggerUI after 2.5.0, where the
oneOfdefinition just references itself recursively forever. (This might even be worth a second issue)
I have the same probleme in 2.6.0
Do you have any updates on this? Thanks!
@ghovhannesVM,
Not reproducible. Feel free to provide a Minimal, Reproducible Example - with HelloController that reproduces the problem.
This ticket will be closed, but can be reopened if your provide the reproducible sample.
