# MinItems Decorator validation swagger schema collections

Module
import { MinItems } from "@tsed/common"
Source/packages/common/src/jsonschema/decorators/minItems.ts

# Overview

function MinItems(minItems: number): (...parameters: any[]) => any;

# Description

An array instance is valid against minItems if its size is greater than, or equal to, the value of this keyword.

WARNING

The value minItems MUST be a non-negative integer.

TIP

Omitting this keyword has the same behavior as a value of 0.

WARNING

This decorator will be removed in v7. For v6 user, use from @tsed/schema instead of @tsed/common.

# Example

class Model {
   @CollectionOf(String)
   @MinItems(10)
   property: string[];
}
1
2
3
4
5

Will produce:

{
  "type": "object",
  "properties": {
    "property": {
      "type": "string",
      "minItems": 10
    }
  }
}
1
2
3
4
5
6
7
8
9