File tree 2 files changed +21
-3
lines changed
2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,15 @@ function createAjv(
59
59
obj [ propName ] = sch . deserialize ( data ) ;
60
60
}
61
61
catch ( e ) {
62
+ ( < ajv . ValidateFunction > validate ) . errors = [
63
+ {
64
+ keyword : 'serdes' ,
65
+ schemaPath : data ,
66
+ dataPath : path ,
67
+ message : `format is invalid` ,
68
+ params : { 'x-eov-serdes' : propName } ,
69
+ } ,
70
+ ] ;
62
71
return false ;
63
72
}
64
73
}
@@ -108,6 +117,15 @@ function createAjv(
108
117
obj [ propName ] = sch . serialize ( data ) ;
109
118
}
110
119
catch ( e ) {
120
+ ( < ajv . ValidateFunction > validate ) . errors = [
121
+ {
122
+ keyword : 'serdes' ,
123
+ schemaPath : data ,
124
+ dataPath : path ,
125
+ message : `format is invalid` ,
126
+ params : { 'x-eov-serdes' : propName } ,
127
+ } ,
128
+ ] ;
111
129
return false ;
112
130
}
113
131
}
Original file line number Diff line number Diff line change @@ -307,13 +307,13 @@ describe('serdes serialize response components only', () => {
307
307
. expect ( 500 )
308
308
. then ( ( r ) => {
309
309
console . log ( r ) ;
310
- expect ( r . body . message ) . to . equal ( 'd.toISOString is not a function ' ) ;
310
+ expect ( r . body . message ) . to . equal ( '.response.creationDate format is invalid ' ) ;
311
311
} ) ) ;
312
312
313
313
/*
314
314
FIXME Manage format validation after serialize ? I can serialize using a working serialize method but that respond a bad format
315
315
it('should throw error 500 on an object that serialize to a bad string format', async () =>
316
-
316
+
317
317
request(app)
318
318
.get(`${app.basePath}/users/5fdefd13a6640bb5fb5fa925`)
319
319
.query({baddateresponse : 'functionBadFormat'})
@@ -322,7 +322,7 @@ describe('serdes serialize response components only', () => {
322
322
console.log(r.body);
323
323
expect(r.body.message).to.equal('Something saying that date is not date-time format');
324
324
}));
325
-
325
+
326
326
*/
327
327
328
328
} ) ;
You can’t perform that action at this time.
0 commit comments