-
Notifications
You must be signed in to change notification settings - Fork 1
/
reusableFields.js
60 lines (60 loc) · 1.81 KB
/
reusableFields.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
helper variable. It holds some commonly used required fields definitions to avoid redundancy on the requiredFields
definition.
The supported types are:
- int (must be an integer)
- date (must be a date in the format of the validationString
- oneof (must be a one of the strings contained on the acceptedValues array)
- boolean (must be boolean)
- string (must be a string)
- numeric (must be a number)
- email (must be an email)
*/
module.exports = {
id:{
key:'id',
type:'int',
humanReadable: 'sample id field',
description:'This is just a sample for creating an int type reusable param',
mandatory:true,
validationFailureTexts:{
mandatory: 'id is mandatory'
}
},
testobj:{
key:'testObj',
type:'object',
humanReadable:'my test obj',
description:'This is just a sample for defining an object type reusable param',
mandatory:true,
keys:{
alpha:{
type:'array',
mandatory:true,
validationFailureTexts:{
mandatory: 'the alpha type is mandatory'
}
},
beta:{
type:'oneof',
acceptedValues:['day', 'week', 'month', 'year'],
validationFailureTexts:{
acceptedValues: 'Please pick from one of the allowed values'
}
},
gamma:{
type:'object',
keys:{
gammaOne:{
mandatory:true,
type:'numeric'
},
gammaTwo:{
mandatory:false,
type:'numeric'
}
}
}
}
}
};