File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ const DATELIKE = /created|started|executed|modified|canceled|stopped|deleted|dat
2
2
3
3
// ISO8601 ensures parameters that look like they might hold dates are formatted
4
4
// correctly according to ISO 8601 (e.g. `2020-01-01T12:00:00Z`)
5
- module . exports = targetValue => {
5
+ module . exports = ( targetValue , options , paths ) => {
6
6
const errors = [ ] ;
7
7
8
8
// No parameter should end with a time zone in the name.
@@ -35,9 +35,11 @@ module.exports = targetValue => {
35
35
message : `${ targetValue . name } should have a schema`
36
36
} ) ;
37
37
} else {
38
+ let p = paths . given . concat ( [ 'schema' ] ) ;
38
39
if ( targetValue . schema . type && targetValue . schema . type !== 'string' ) {
39
40
errors . push ( {
40
- message : `${ targetValue . name } should be a string if it is a date/time`
41
+ message : `${ targetValue . name } should be a string if it is a date/time` ,
42
+ path : targetValue . schema . type ? p . concat ( [ 'type' ] ) : p
41
43
} ) ;
42
44
}
43
45
@@ -46,7 +48,8 @@ module.exports = targetValue => {
46
48
targetValue . schema . format != 'date-time'
47
49
) {
48
50
errors . push ( {
49
- message : `${ targetValue . name } should have a string format of 'date' or 'date-time'`
51
+ message : `${ targetValue . name } should have a string format of 'date' or 'date-time'` ,
52
+ path : p
50
53
} ) ;
51
54
}
52
55
}
You can’t perform that action at this time.
0 commit comments