We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 81f8b7e commit c111346Copy full SHA for c111346
lib/annotations/validation/NotEmpty.ts
@@ -4,11 +4,21 @@ import {addAttributeOptions} from "../../services/models";
4
/**
5
* Don't allow empty strings
6
*/
7
-export function NotEmpty(target: any, propertyName: string): void {
+export function NotEmpty({msg}: {msg?: string}): Function {
8
9
- addAttributeOptions(target, propertyName, {
10
- validate: {
11
- notEmpty: true
12
- }
13
- });
+ let options: boolean | {msg: string};
+
+ if (msg) {
+ options = {msg};
+ } else {
14
+ options = true;
15
+ }
16
17
+ return (target: any, propertyName: string) => {
18
+ addAttributeOptions(target, propertyName, {
19
+ validate: {
20
+ notEmpty: options
21
22
+ });
23
24
}
0 commit comments