You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i have this ValidatorPipe that should be the same as ValidationPipe in my nestjs server:
@Injectable()
export class ValidatorPipe extends ValidationPipe implements PipeTransform<any> {
constructor(private defaultValidatorOptions?: ValidationPipeOptions) {
super(defaultValidatorOptions)
}
async transform(value: any, metadata: ArgumentMetadata) {
const extraValidatorOptions = this.getExtraValidatorOptions(value, metadata)
this.validatorOptions = { ...this.defaultValidatorOptions, ...extraValidatorOptions }
// Continue with the standard validation afterwards
return super.transform(value, metadata)
}
protected getExtraValidatorOptions(value: any, metadata: ArgumentMetadata): ValidationPipeOptions {
// code that should check for extra validation options...
}
}
I'm looking for a way to get from the request some metadata, that i can use to choose the right validation options for the call that entered the server.
i have try to send metadata.data for the request, but, i cant get anything... it always was undefined..
The text was updated successfully, but these errors were encountered:
i have this ValidatorPipe that should be the same as ValidationPipe in my nestjs server:
I'm looking for a way to get from the request some metadata, that i can use to choose the right validation options for the call that entered the server.
i have try to send metadata.data for the request, but, i cant get anything... it always was
undefined
..The text was updated successfully, but these errors were encountered: