@@ -30,7 +30,7 @@ export class ValidationExecutor {
30
30
// Constructor
31
31
// -------------------------------------------------------------------------
32
32
33
- constructor ( private validator : Validator , private validatorOptions ?: ValidatorOptions ) { }
33
+ constructor ( private validator : Validator , private validatorOptions ?: ValidatorOptions ) { }
34
34
35
35
// -------------------------------------------------------------------------
36
36
// Public Methods
@@ -46,8 +46,8 @@ export class ValidationExecutor {
46
46
if ( ! this . metadataStorage . hasValidationMetaData && this . validatorOptions ?. enableDebugMessages === true ) {
47
47
console . warn (
48
48
`No validation metadata found. No validation will be performed. There are multiple possible reasons:\n` +
49
- ` - There may be multiple class-validator versions installed. You will need to flatten your dependencies to fix the issue.\n` +
50
- ` - This validation runs before any file with validation decorator was parsed by NodeJS.`
49
+ ` - There may be multiple class-validator versions installed. You will need to flatten your dependencies to fix the issue.\n` +
50
+ ` - This validation runs before any file with validation decorator was parsed by NodeJS.`
51
51
) ;
52
52
}
53
53
@@ -76,19 +76,19 @@ export class ValidationExecutor {
76
76
e . message = ( ) =>
77
77
( this . validatorOptions ?. validationError ?. transformFunction as Function ) (
78
78
e . transformKey ||
79
- e . name ||
80
- e . type ||
81
- 'This validation does not have an name or type associated with it, please add one.'
79
+ e . name ||
80
+ e . type ||
81
+ 'This validation does not have an name or type associated with it, please add one.'
82
82
) ;
83
83
} ) ;
84
84
Object . keys ( groupedMetadatas ) . forEach ( prop => {
85
85
groupedMetadatas [ prop ] . forEach ( e => {
86
86
e . message = ( ) =>
87
87
( this . validatorOptions ?. validationError ?. transformFunction as Function ) (
88
88
e . transformKey ||
89
- e . name ||
90
- e . type ||
91
- 'This validation does not have an name or type associated with it, please add one.'
89
+ e . name ||
90
+ e . type ||
91
+ 'This validation does not have an name or type associated with it, please add one.'
92
92
) ;
93
93
} ) ;
94
94
} ) ;
@@ -295,7 +295,7 @@ export class ValidationExecutor {
295
295
} ;
296
296
297
297
if ( ! metadata . each || ! ( Array . isArray ( value ) || value instanceof Set || value instanceof Map ) ) {
298
- const validatedValue = customConstraintMetadata . instance . validate ( value , validationArguments ) ;
298
+ const validatedValue = customConstraintMetadata . instance . validate ( value , validationArguments , this . validatorOptions ) ;
299
299
if ( isPromise ( validatedValue ) ) {
300
300
const promise = validatedValue . then ( isValid => {
301
301
if ( ! isValid ) {
@@ -324,7 +324,7 @@ export class ValidationExecutor {
324
324
const arrayValue = convertToArray ( value ) ;
325
325
// Validation needs to be applied to each array item
326
326
const validatedSubValues = arrayValue . map ( ( subValue : any ) =>
327
- customConstraintMetadata . instance . validate ( subValue , validationArguments )
327
+ customConstraintMetadata . instance . validate ( subValue , validationArguments , this . validatorOptions )
328
328
) ;
329
329
const validationIsAsync = validatedSubValues . some ( ( validatedSubValue : boolean | Promise < boolean > ) =>
330
330
isPromise ( validatedSubValue )
0 commit comments