Description
Hello
Describe the bug
It seems that when having polymorphic types that contain attribute that are of polymorphic type themselves the generated docs bail on describing it with the oneOf schema.
Given the structure
AbstractParent - >
ParentType1
abstractChild
ParentType2
AbstractChild ->
ChildType1
ChildType2
Seems to generate the correct definitions if the AbstractChild class is used in the controller directly but it doesn't generate a ref to be used in ParentType1.
Here is a sample repo showcasing the issue: https://github.com/rsescu/springdoc-nested-oneof-issue
Seems different from #2575 since after downgrading to 2.3.0 the behaviour is the same.
To Reproduce
Steps to reproduce the behaviour:
Using
org.springframework.boot:3.2.5
org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0
Have a abstract class parent that has two implementation. If one the the implementations uses an abstract child class field The definition for the Child class will not show it polymorphic but only as the base class with the field from the base class only.
Assuming the abstract base class is named AbstractChild and it's implementation are ChildType1 and ChildType2 I get the output:
"abstractChild": {
"$ref": "#/components/schemas/AbstractChild"
}
Expected behavior
I would expect the output for the nested child to have a oneOf schema definition. It just contains a reference to the base class definition now.
"abstractChild": {
"oneOf": [
{
"$ref": "#/components/schemas/ChildType1"
},
{
"$ref": "#/components/schemas/ChildType2"
}
]
}