We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValidateIf
ValidateNested
This is the DTO (excerpt from it):
{ ... @IsArray() @ArrayMinSize(1) @ValidateIf((o) => o.type === AddHubElementTypes.AUDIO || o.type === AddHubElementTypes.GENERAL) @ValidateNested({ each: true }) @Type(() => AudioUrlDto) @ApiProperty() @Transform(({ value }) => JSON.parse(value)) audioUrls?: AudioUrlDto[]; ... }
This is the definition of AudioUrlDto:
AudioUrlDto
export class AudioUrlDto { @IsEnum(HubPageAudioUrlType) @ApiProperty() type: HubPageAudioUrlType; @IsUrl() @ApiProperty() url: string; @IsInt() @ApiProperty() order: number; }
This is what I send:
I receive a 500 error because the audioUrls array was not properly validated.
audioUrls
The text was updated successfully, but these errors were encountered:
@dmitriy-nz
Sorry, something went wrong.
Hey, could you provide your ValidationPipe declaration. In ideal will be grate to have playground for reproducing
ValidationPipe
@dmitriy-nz this is how my app.module.ts looks like:
providers: [ { provide: APP_FILTER, useClass: PrismaExceptionFilter, scope: Scope.REQUEST, }, { provide: APP_PIPE, useValue: new ValidationPipe({ transform: true, }), }, AppService, UserService, TwilioService, StripeService, ],
No branches or pull requests
This is the DTO (excerpt from it):
This is the definition of
AudioUrlDto
:This is what I send:
I receive a 500 error because the
audioUrls
array was not properly validated.The text was updated successfully, but these errors were encountered: