@nestjs/swagger#ApiPropertyOptional TypeScript Examples

The following examples show how to use @nestjs/swagger#ApiPropertyOptional. 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: pagination-args.dto.ts    From ironfish-api with Mozilla Public License 2.0 6 votes vote down vote up
@ApiPropertyOptional({
    description: 'A limit on the number of objects to return between 1 and 100',
  })
  @Max(100)
  @Min(1)
  @IsNumber()
  @IsOptional()
  @Type(() => Number)
  readonly limit?: number;
Example #2
Source File: page-options.dto.ts    From bank-server with MIT License 6 votes vote down vote up
@ApiPropertyOptional({
    minimum: 1,
    maximum: 50,
    default: 10,
  })
  @Type(() => Number)
  @IsInt()
  @Min(1)
  @Max(50)
  @IsOptional()
  readonly take?: number = 10;
Example #3
Source File: pagination-params.dto.ts    From nestjs-starter-rest-api with MIT License 6 votes vote down vote up
@ApiPropertyOptional({
    description: 'Optional, defaults to 100',
    type: Number,
  })
  @IsNumber()
  @IsOptional()
  @Min(0)
  @Transform(({ value }) => parseInt(value, 10), { toClassOnly: true })
  limit = 100;
Example #4
Source File: block-query.dto.ts    From ironfish-api with Mozilla Public License 2.0 6 votes vote down vote up
@ApiPropertyOptional({
    description:
      'Block sequence. Will only return blocks on the main chain if provided',
  })
  @ValidateIf((o: BlockQueryDto) => o.hash === undefined)
  @IsDefined({
    message: '"hash" or "sequence" required to query for single block',
  })
  @Max(Number.MAX_SAFE_INTEGER)
  @Min(1)
  @IsInt()
  @Type(() => Number)
  readonly sequence?: number;
Example #5
Source File: pagination-params.dto.ts    From nestjs-starter-rest-api with MIT License 6 votes vote down vote up
@ApiPropertyOptional({
    description: 'Optional, defaults to 0',
    type: Number,
  })
  @IsNumber()
  @IsOptional()
  @Min(0)
  @Transform(({ value }) => parseInt(value, 10), { toClassOnly: true })
  offset = 0;
Example #6
Source File: users-query.dto.ts    From ironfish-api with Mozilla Public License 2.0 5 votes vote down vote up
@ApiPropertyOptional({ description: 'Keyword search filter' })
  @IsOptional()
  @IsString()
  readonly search?: string;
Example #7
Source File: create-prefecture.dto.ts    From mamori-i-japan-api with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@ApiPropertyOptional({ example: 'This is optional message. Can be later added via PATCH.' })
  @IsString()
  @IsOptional()
  message: string
Example #8
Source File: users-query.dto.ts    From ironfish-api with Mozilla Public License 2.0 5 votes vote down vote up
@ApiPropertyOptional({ description: 'Event types filter', enum: EventType })
  @IsOptional()
  @IsEnum(EventType)
  readonly event_type?: EventType;
Example #9
Source File: pagination-params.class.ts    From mamori-i-japan-api with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@ApiPropertyOptional({
    description: 'Optional, defaults to 0',
    type: Number,
  })
  @IsNumber()
  @IsOptional()
  @Transform((value) => parseInt(value, 10), { toClassOnly: true })
  offset = 0
Example #10
Source File: users-query.dto.ts    From ironfish-api with Mozilla Public License 2.0 5 votes vote down vote up
@ApiPropertyOptional({
    description: 'ISO 3166-1 Alpha-3 country code filter',
  })
  @IsOptional()
  @IsISO31661Alpha3()
  readonly country_code?: string;
Example #11
Source File: abstract-search.dto.ts    From bank-server with MIT License 5 votes vote down vote up
@ApiPropertyOptional()
  @IsNumber()
  @IsOptional()
  @ToInt()
  take = 10;
Example #12
Source File: update-user.dto.ts    From nest-js-boilerplate with MIT License 5 votes vote down vote up
@ApiPropertyOptional({
    type: Boolean,
  })
  @IsOptional()
  @IsBoolean()
  readonly verified: boolean = false;
Example #13
Source File: user.dto.ts    From bank-server with MIT License 5 votes vote down vote up
@ApiPropertyOptional({ type: UserAuthDto })
  @IsOptional()
  readonly userAuth?: UserAuthDto;
Example #14
Source File: create-prefecture.dto.ts    From mamori-i-japan-api with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@ApiPropertyOptional({ example: 'This is optional message. Can be later added via PATCH.' })
  @IsString()
  @IsOptional()
  message: string
Example #15
Source File: user-update-input.dto.ts    From nestjs-starter-rest-api with MIT License 5 votes vote down vote up
@ApiPropertyOptional()
  @IsOptional()
  @IsNotEmpty()
  @Length(6, 100)
  @IsString()
  password: string;
Example #16
Source File: delete-diagnosis-keys.dto.ts    From mamori-i-japan-api with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@ApiPropertyOptional()
  @IsOptional()
  @IsString()
  @IsNotEmpty()
  randomID: string
Example #17
Source File: user.dto.ts    From bank-server with MIT License 5 votes vote down vote up
@ApiPropertyOptional({ type: UserConfigDto })
  @IsOptional()
  readonly userConfig?: UserConfigDto;
Example #18
Source File: pagination-params.class.ts    From mamori-i-japan-api with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@ApiPropertyOptional({
    description: 'Optional, defaults to 100',
    type: Number,
  })
  @IsNumber()
  @IsOptional()
  @Transform((value) => parseInt(value, 10), { toClassOnly: true })
  limit = 100
Example #19
Source File: collection-data.dto.ts    From aqualink-app with MIT License 5 votes vote down vote up
@ApiPropertyOptional({ example: 2 })
  [Metric.WAVE_MEAN_DIRECTION]?: number;
Example #20
Source File: events-query.dto.ts    From ironfish-api with Mozilla Public License 2.0 5 votes vote down vote up
@ApiPropertyOptional({ description: 'Unique User identifier' })
  @IsInt()
  @IsOptional()
  @Max(Number.MAX_SAFE_INTEGER)
  @Type(() => Number)
  readonly user_id?: number;
Example #21
Source File: users.entity.ts    From aqualink-app with MIT License 5 votes vote down vote up
@ApiPropertyOptional()
  @ManyToMany(() => Site, (site) => site.admins, { cascade: true })
  @JoinTable()
  administeredSites: Site[];
Example #22
Source File: transaction-query.dto.ts    From ironfish-api with Mozilla Public License 2.0 5 votes vote down vote up
@ApiPropertyOptional({
    description: 'Whether or not to include blocks in the response',
  })
  @IsOptional()
  @Transform(({ value }: TransformFnParams) => stringToBoolean(value))
  readonly with_blocks?: boolean;
Example #23
Source File: sites.entity.ts    From aqualink-app with MIT License 5 votes vote down vote up
@ApiPropertyOptional()
  @OneToMany(() => Survey, (survey) => survey.site)
  surveys: Survey[];