class-validator#Length TypeScript Examples

The following examples show how to use class-validator#Length. 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: user.inputs.ts    From convoychat with GNU General Public License v3.0 6 votes vote down vote up
@Field({ nullable: true })
  @Length(5, 100)
  @IsUrl(
    {
      disallow_auth: true,
      allow_protocol_relative_urls: false,
    },
    { message: "Invalid website URL" }
  )
  public website?: string;
Example #2
Source File: classes.ts    From epicgames-freegames-node with MIT License 6 votes vote down vote up
/**
   * If 2FA is enabled, add your TOTP secret
   * @example EMNCF83ULU3K3PXPJBSWY3DPEHPK3PXPJWY3DPEHPK3YI69R39NE
   * @env TOTP
   */
  @IsOptional()
  @Length(52)
  @Matches(/^[A-Z2-7]+=*$/) // IsBase32 also checks for mod 8 length, which these aren't
  totp?: string;
Example #3
Source File: auth.ts    From MyAPI with MIT License 6 votes vote down vote up
@ApiProperty({
    description: 'Password is required',
    type: String,
    required: true,
    minLength: 8
  })
  @Length(8, null, {
    message: 'Password length must be at least 8 digits'
  })
  @IsNotEmpty({
    message: 'Password is required'
  })
  readonly password: string
Example #4
Source File: Application.ts    From Designer-Server with GNU General Public License v3.0 5 votes vote down vote up
@Column({ length: 100 })
  @Length(1, 100)
  @NotContains("-")
  nameSpace: string;
Example #5
Source File: UserDto.ts    From jaebook-server with MIT License 5 votes vote down vote up
@IsNotEmpty()
  @Length(1, 50)
  public realName: string;
Example #6
Source File: user-create-request.dto.ts    From nestjs-api-example with MIT License 5 votes vote down vote up
@IsNotEmpty({ message: '이름(firstName)은 필수값입니다.' })
  @IsString({ message: '이름(firstName)의 형식이 올바르지 않습니다.' })
  @Length(1, 50)
  @ApiProperty({ description: '이름' })
  firstName: string;
Example #7
Source File: shards.ts    From Discord-Bot-TypeScript-Template with MIT License 5 votes vote down vote up
@IsDefined()
    @IsString()
    @Length(1, 128)
    name: string;
Example #8
Source File: Thread.ts    From Full-Stack-React-TypeScript-and-Node with MIT License 5 votes vote down vote up
@Column("varchar", { name: "Title", length: 150, nullable: false })
  @Length(5, 150)
  title: string;
Example #9
Source File: create-option.dto.ts    From nest-js-quiz-manager with MIT License 5 votes vote down vote up
@ApiProperty({
    description: 'The option for a question',
    example: 'Owl',
  })
  @IsNotEmpty()
  @Length(2, 255)
  text: string;
Example #10
Source File: message-inputs.ts    From convoychat with GNU General Public License v3.0 5 votes vote down vote up
@Field({ nullable: false })
  @Length(2, 500)
  content: string;
Example #11
Source File: user.dto.ts    From codeclannigeria-backend with MIT License 5 votes vote down vote up
@Expose()
  @IsArray()
  @Length(1, columnSize.length32, { each: true })
  @ApiProperty({ isArray: true, type: String })
  @IsOptional()
  technologies?: string[];
Example #12
Source File: user.validator.ts    From ddd-cqrs-es-aws-sam with MIT License 5 votes vote down vote up
@Length(1, 50)
  @IsAlpha()
  firstName!: string;
Example #13
Source File: auth-register-input.dto.ts    From nestjs-starter-rest-api with MIT License 5 votes vote down vote up
@ApiProperty()
  @IsNotEmpty()
  @Length(6, 100)
  @IsString()
  password: string;
Example #14
Source File: Captcha.ts    From tezos-academy with MIT License 5 votes vote down vote up
@Property({ required: true })
  @Length(4, 4)
  solution!: string
Example #15
Source File: user-forgotten-password.dto.ts    From bank-server with MIT License 5 votes vote down vote up
@Length(2)
  @IsString()
  @IsNotEmpty()
  @ApiProperty()
  readonly locale: string;
Example #16
Source File: Pagenation.ts    From tatum-blockchain-connector with MIT License 5 votes vote down vote up
@Length(0, 50)
  public limit: string;