Skip to content

Commit 249c41d

Browse files
hpohlmeyerNoNameProvided
authored andcommitted
fix: add correct signature for custom error message handler
1 parent 00385c0 commit 249c41d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Diff for: src/decorator/ValidationOptions.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import {ValidationArguments} from "../validation/ValidationArguments";
2+
13
/**
24
* Options used to pass to validation decorators.
35
*/
@@ -10,13 +12,9 @@ export interface ValidationOptions {
1012

1113
/**
1214
* Error message used to be used on validation fail.
13-
* You can use "$value" to use value that was failed by validation.
14-
* You can use "$constraint1" and "$constraint2" keys in the message string,
15-
* and they will be replaced with constraint values if they exist.
1615
* Message can be either string, either a function that returns a string.
17-
* Second option allows to use values and custom messages depend of them.
1816
*/
19-
message?: string|((value?: any, constraint1?: any, constraint2?: any) => string);
17+
message?: string | ((validationArguments: ValidationArguments) => string);
2018

2119
/**
2220
* Validation groups used for this validation.
@@ -32,4 +30,4 @@ export interface ValidationOptions {
3230
* A transient set of data passed through to the validation result for response mapping
3331
*/
3432
context?: any;
35-
}
33+
}

0 commit comments

Comments
 (0)