I have a class that one of the properties can be string or array of strings, not sure how should I define it in swagger
@ApiProperty({
description: `to email address`,
type: ???, <- what should be here?
required: true,
})
to: string | Array<string>;
I tried
@ApiProperty({
description: `to email address(es)`,
additionalProperties: {
oneOf: [
{ type: 'string' },
{ type: 'Array<string>' },
],
},
required: true,
})
and
@ApiProperty({
description: `to email address(es)`,
additionalProperties: {
oneOf: [
{ type: 'string' },
{ type: 'string[]' },
],
},
required: true,
})
and
@ApiProperty({
description: `to email address(es)`,
additionalProperties: {
oneOf: [
{ type: 'string' },
{ type: '[string]' },
],
},
required: true,
})
but the result is like below image, which is not correct
