class-validator#MaxLength TypeScript Examples

The following examples show how to use class-validator#MaxLength. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: create-user.request.dto.ts    From domain-driven-hexagon with MIT License 6 votes vote down vote up
@ApiProperty({
    example: '[email protected]',
    description: 'User email address',
  })
  @MaxLength(320)
  @MinLength(5)
  @IsEmail()
  @Field() // <- only if you are using graphql
  readonly email: string;
Example #2
Source File: create-user.dto.ts    From nestjs-starter with MIT License 6 votes vote down vote up
@ApiProperty({
    description: 'Username for your account, must be unique.',
  })
  @IsUsernameAlreadyExist({
    message: 'Username $value already exists. Choose another username.',
  })
  @IsString()
  @MinLength(8)
  @MaxLength(20)
  @Matches(PATTERN_VALID_USERNAME, {
    message: `Username $value don't have a valid format`,
  })
  @IsNotEmpty()
  username!: string;
Example #3
Source File: ChangePasswordRequest.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@MaxLength(15, {
        message: 'New Password is maximum 15 character',
    })
    @MinLength(4, {
        message: 'New Password is minimum 4 character',
    })
    @IsNotEmpty({
        message: 'New Password is required',
    })
    public newPassword: string;
Example #4
Source File: sign-in.dto.ts    From nest-js-boilerplate with MIT License 5 votes vote down vote up
@ApiProperty({ type: String })
  @IsNotEmpty()
  @IsString()
  @IsEmail()
  @MinLength(3)
  @MaxLength(128)
  readonly email: string = '';
Example #5
Source File: create-user.request.dto.ts    From domain-driven-hexagon with MIT License 5 votes vote down vote up
@ApiProperty({ example: 'France', description: 'Country of residence' })
  @MaxLength(50)
  @MinLength(4)
  @IsString()
  @Matches(/^[a-zA-Z ]*$/)
  @Field() // <- only if you are using graphql
  readonly country: string;
Example #6
Source File: create-application.dto.ts    From uniauth-backend with MIT License 5 votes vote down vote up
/** name of the application */
  @ApiProperty({ description: 'name to identify applicaiton in your console', example: 'simple oauth' })
  @IsNotEmpty()
  @MinLength(3)
  @MaxLength(255)
  name: string;
Example #7
Source File: Student.ts    From Typescript_TypeORM with Apache License 2.0 5 votes vote down vote up
@Column({
    type: 'varchar',
    nullable: false,
    transformer: MyCrypto,
  })
  @MaxLength(50, { message: 'Nome precisar no máximo 50 caracteres' })
  @MinLength(2, { message: 'Nome deve possuir no mínimo 1 caractere' })
  name: string;
Example #8
Source File: AddTodo.ts    From remix-hexagonal-architecture with MIT License 5 votes vote down vote up
@IsString()
  @IsNotEmpty({ message: "The title of your todo is required." })
  @MaxLength(50, {
    message: "The title of your todo is limited to 50 characters.",
  })
  todoTitle!: string;
Example #9
Source File: update-site.dto.ts    From aqualink-app with MIT License 5 votes vote down vote up
@ApiProperty({ example: 'Duxbury Site' })
  @IsOptional()
  @IsString()
  @IsNotEmpty()
  @MaxLength(100)
  readonly name?: string;
Example #10
Source File: category.dto.ts    From codeclannigeria-backend with MIT License 5 votes vote down vote up
@MaxLength(columnSize.length32)
  @Expose()
  name: string;
Example #11
Source File: mutation.ts    From backend with MIT License 5 votes vote down vote up
@Field(type => String)
    @MaxLength(100)
    firstname: string;
Example #12
Source File: role.validator.ts    From ddd-cqrs-es-aws-sam with MIT License 5 votes vote down vote up
@IsAlpha()
  @MinLength(1)
  @MaxLength(30)
  name!: string;
Example #13
Source File: custom-project-metadata.dto.ts    From etherspot-sdk with MIT License 5 votes vote down vote up
@IsOptional()
  @MaxLength(128)
  customProjectMetadata?: string = null;
Example #14
Source File: register.dto.ts    From nestjs-rest-sample with GNU General Public License v3.0 5 votes vote down vote up
@IsNotEmpty()
    @MinLength(8, { message: " The min length of password is 8 " })
    @MaxLength(20, { message: " The password can't accept more than 20 characters " })
    // @Matches(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{8,20}$/,
    //     { message: " A password at least contains one numeric digit, one supercase char and one lowercase char" }
    // )
    readonly password: string;
Example #15
Source File: createSubmission.dto.ts    From coronatest with GNU Affero General Public License v3.0 5 votes vote down vote up
@IsString()
    @MaxLength(255)
    @IsOptional()
    latitude: string;
Example #16
Source File: auth-login-input.dto.ts    From nestjs-starter-rest-api with MIT License 5 votes vote down vote up
@IsNotEmpty()
  @ApiProperty()
  @IsString()
  @MaxLength(200)
  username: string;
Example #17
Source File: user.create.input.ts    From api with GNU Affero General Public License v3.0 5 votes vote down vote up
@Field()
  @MinLength(2)
  @MaxLength(50)
    username: string
Example #18
Source File: Vulnerability.ts    From bulwark with MIT License 5 votes vote down vote up
@Column({ length: 4000 })
  @MaxLength(4000)
  description: string;
Example #19
Source File: ChangePasswordRequest.ts    From spurtcommerce with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@MaxLength(15, {
        message: 'Old Password is maximum 15 character',
    })
    @MinLength(5, {
        message: 'Old Password is minimum 5 character',
    })
    @IsNotEmpty()
    public oldPassword: string;