I have the following code:
import { IsNotEmpty, IsArray, ArrayMinSize } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
export class PublishDto {
@IsNotEmpty()
@IsArray()
@ArrayMinSize(1)
@ApiProperty({
type: [Product]
})
products: Product[];
}
interface Product {
id: string;
title: string;
sku: string;
stock: number;
description: string;
shortDescription: string;
imagesUrl: string[];
price: number;
department: string;
category: string;
brand: string;
keywords: string[];
isActive: boolean;
}
I'm trying to put the interface Product as a schema on swagger, but it's not working, I am getting an error.
Any idea?
