# Allow Decorator

Module
import { Allow } from "@tsed/common"
Source/packages/common/src/mvc/decorators/allow.ts

# Overview

function Allow(...allowedRequiredValues: any[]): any;

# Description

Add allowed values when the property or parameters is required.

# Example on parameter:

@Post("/")
async method(@Required() @Allow("") @BodyParams("field") field: string) {}
1
2

Required will throw a BadRequest when the given value is null or undefined but not for an empty string.

# Example on model:

class Model {
  @Property()
  @Required()
  @Allow("")
  field: string;
}
1
2
3
4
5
6