Skip to content

Commit

Permalink
fix: add correct signature for custom error message handler
Browse files Browse the repository at this point in the history
  • Loading branch information
hpohlmeyer authored and NoNameProvided committed Nov 4, 2018
1 parent 00385c0 commit 249c41d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/decorator/ValidationOptions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {ValidationArguments} from "../validation/ValidationArguments";

/**
* Options used to pass to validation decorators.
*/
Expand All @@ -10,13 +12,9 @@ export interface ValidationOptions {

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

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

0 comments on commit 249c41d

Please sign in to comment.