# Schema Decorator validation swagger schema classDecorator input

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

# Overview

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

# Description

Write data formatted to JsonSchema.

WARNING

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

# 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