# Schema Decorator validation swagger schema classDecorator input

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

# Overview

function Schema(partialSchema: Partial<JSONSchema6 | JsonSchema>): (...args: any[]) => any;

# Description

Write data formatted to JsonSchema.

# Example

@Schema({title: "test"})
class Model {
   @Schema({formatMinimum: "1987-10-24"})
   @Format("date")
   birthDate: Date
}
1
2
3
4
5
6

Will produce:

{
  "type": "object",
  "title": "test",
  "properties": {
    "birthdate": {
       "type": "string",
       "format": "date",
       "formatMinimum": "1987-10-24"
    }
  }
}
1
2
3
4
5
6
7
8
9
10
11

Other topics