@Schema oneOf config is ignored when generate the api-docs
Author: abccbaandyCreated Sep 11, 2024Updated Aug 26, 2026
Labelsbacklog
@Schema(oneOf = {Child1.class, Child2.class})
private Parent obj;The result is something like this
"MyPojo": {
"oneOf": [
{
"$ref": "#/components/schemas/Child1"
},
{
"$ref": "#/components/schemas/Child2"
},
{
"$ref": "#/components/schemas/Child3"
}
]
},Seems the result does not come from my config.
Also I think oneOf should take string($ref) instead class?
Source: swagger-api/swagger-core