Afaik there's no support for a "isNotBlank"-decorator, but you can just write one yourself:
import { registerDecorator, ValidationOptions } from "class-validator";
export function IsNotBlank(property: string, validationOptions?: ValidationOptions) {
return function (object: Object, propertyName: string) {
registerDecorator({
name: "isNotBlank",
target: object.constructor,
propertyName: propertyName,
constraints: [property],
options: validationOptions,
validator: {
validate(value: any) {
return typeof value === "string" && value.trim().length > 0;
}
}
});
};
}
You would then add this custom validator to your existing one:
@IsNotBlank()
@IsAlphaNumeric()
Address: string;
Checkout https://github.com/typestack/class-validator#custom-validation-decorators for more information regarding custom validators.