# Constant MinProperties

Constant validation swagger schema input collections ajv-errors
Module
import { MinProperties } from "@tsed/schema"
Source/packages/specs/schema/src/types/decorators/collections/minProperties.ts

# Overview

const MinProperties: import("../../utils/withErrorMsg").ErrorChainedDecorator<(minProperties: number) => (...args: any[]) => any>;

# Description

An object instance is valid against minProperties if its number of properties is less than, or equal to, the value of this keyword.

WARNING

The value of this keyword MUST be a non-negative integer.

WARNING

For v6 user, use MinProperties from @tsed/schema instead of @tsed/common.

# Example

# On prop

class Model {
   @MinProperties(10)
   property: any;
}
1
2
3
4

Will produce:

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

# On class

@MinProperties(10)
class Model {
}
1
2
3

Will produce:

{
  "type": "object",
  "minProperties": 10
}
1
2
3
4

# On Parameter


class Model {
  method(@Any() @MinProperties(10) obj: any){}
}
1
2
3
4