# CollectionOf Decorator validation swagger schema input collections

Module
import { CollectionOf } from "@tsed/schema"
Source/packages/schema/src/decorators/collections/collectionOf.ts

# Overview

function CollectionOf(type: any, collectionType?: any): CollectionOfChainedDecorators;

# Description

Set the type of the item collection. The possible value is String, Boolean, Number, Date, Object, Class, etc...

class Model {
   @CollectionOf(String).MinLength(0).MaxLength(0)
   property: string[];
}
1
2
3
4

WARNING

You mustn't use the type Type = string | number as parameters Type.

This example doesn't work:

type Type = "string" | "number"
class Model {
   @CollectionOf(Type)
   property: Type[];
}
1
2
3
4
5

Other topics