# Allow Decorator validation swagger schema input

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

# Overview

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

# Description

Add allowed values when the property or parameters is required.

# Example on parameter:

@Post("/")
async method(@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 {
  @Allow("")
  field: string;
}
1
2
3
4

Other topics