# Integer Decorator validation swagger schema input

Module
import { Integer } from "@tsed/schema"
Source/packages/schema/src/decorators/common/integer.ts

# Overview

function Integer(): (...args: any[]) => any;

# Description

Set integer type.

WARNING

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

# Example

class Model {
   @Integer()
   property: number;
}
1
2
3
4

Will produce:

{
  "type": "object",
  "properties": {
    "property": {
      "type": "integer"
    }
  }
}
1
2
3
4
5
6
7
8

# With array of multiple types

class Model {
   @Integer()
   property: number[];
}
1
2
3
4

Will produce:

{
  "type": "object",
  "properties": {
    "property": {
      "type": "array",
      "items": {
         "type": "integer"
      }
    }
  }
}
1
2
3
4
5
6
7
8
9
10
11

Other topics