Skip to content

DefaultMsg

@tsed/schema

Usage

typescript
import { DefaultMsg } from "@tsed/schema";

See /packages/specs/schema/src/types/decorators/common/defaultMsg.ts.

Overview

ts
function DefaultMsg(message: string): ClassDecorator;

Description

Set default error message.

Example

typescript
@DefaultMsg("foo should be a string")
class Model {
   property: number;
}

Will produce:

json
{
  "type": "object",
  "properties": {
    "property": "number"
  }
  "errorMessage": {
    "_": "foo should be a string"
  }
}

Released under the MIT License.