Is there an existing issue for this?
Current behavior
Using oneOf for @ApiProperty always results in ref to Object
export class Example {
foo: string;
bar: string;
}
export class Params {
@ApiProperty({
oneOf: [
{$ref: getSchemaPath(Example)},
{type: 'array', items: {$ref: getSchemaPath(Example)}}
],
})
example: Example | Example[]
}
Results in the generated swagger schema
schema:
$ref: '#/components/schemas/Object'
Minimum reproduction code
https://gist.github.com/mbehm/965da4b9251118b288115aac160291e1
Steps to reproduce
No response
Expected behavior
Expect oneOf to correctly produce the following schema
schema:
oneOf:
- $ref: '#/components/schemas/Example'
- type: array
items:
$ref: '#/components/schemas/Example'
Package version
11.2.0
NestJS version
11.0.1
Node.js version
24.3.0
In which operating systems have you tested?
Other
No response
Is there an existing issue for this?
Current behavior
Using
oneOffor@ApiPropertyalways results in ref toObjectResults in the generated swagger schema
Minimum reproduction code
https://gist.github.com/mbehm/965da4b9251118b288115aac160291e1
Steps to reproduce
No response
Expected behavior
Expect
oneOfto correctly produce the following schemaPackage version
11.2.0
NestJS version
11.0.1
Node.js version
24.3.0
In which operating systems have you tested?
Other
No response