Schema
@tsed/schema
Usage
typescript
import { Schema } from "@tsed/schema";
See /packages/specs/schema/src/types/decorators/common/schema.ts.
Overview
ts
function Schema(partialSchema: Partial<JsonSchemaObject> | JsonSchema): (...args: any[]) => any;
Description
Write data formatted to JsonSchema.
Example
typescript
@Schema({title: "test"})
class Model {
@Schema({formatMinimum: "1987-10-24"})
@Format("date")
birthDate: Date
}
Will produce:
json
{
"type": "object",
"title": "test",
"properties": {
"birthdate": {
"type": "string",
"format": "date",
"formatMinimum": "1987-10-24"
}
}
}