Answers for "js Validating maps"

0

js Validating maps

// If your field is a map and you want to perform 
// validation of each item in the map you must 
// specify a special each: true decorator option:

import { MinLength, MaxLength } from 'class-validator';

export class Post {
  @MaxLength(20, {
    each: true,
  })
  tags: Map<string, string>;
}
Posted by: Guest on March-30-2022

Code answers related to "TypeScript"

Browse Popular Code Answers by Language