This repository was archived by the owner on Jan 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -22,11 +22,11 @@ This package changes the `message` to be an object with field names as keys:
2222 "error" : " Bad Request" ,
2323 "message" : [
2424 {
25- "path " : " email" ,
25+ "field " : " email" ,
2626 "errors" : [" email must be an email" ]
2727 },
2828 {
29- "path " : " phone" ,
29+ "field " : " phone" ,
3030 "errors" : [" phone should not be empty" ]
3131 }
3232 ]
@@ -37,7 +37,7 @@ It also works with [nested validations](https://github.com/typestack/class-valid
3737
3838``` json
3939{
40- "path " : " nestedObject.name" ,
40+ "field " : " nestedObject.name" ,
4141 "errors" : [" name should not be empty" ]
4242}
4343```
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ export class ValidationPipe extends OriginalValidationPipe {
1212 . filter ( item => ! ! item . constraints )
1313 . map ( item => ( {
1414 errors : Object . values ( item . constraints || { } ) ,
15- path : ( item as any ) . path || item . property ,
15+ field : ( item as any ) . field || item . property ,
1616 } ) )
1717 . filter ( errorObject => errorObject . errors . length > 0 )
1818 . flatten ( )
@@ -24,7 +24,7 @@ export class ValidationPipe extends OriginalValidationPipe {
2424 error : ValidationError
2525 ) : ValidationError {
2626 return ( {
27- path : `${ parentPath } .${ error . property } ` ,
27+ field : `${ parentPath } .${ error . property } ` ,
2828 ...super . prependConstraintsWithParentProp ( parentPath , error ) ,
2929 } as unknown ) as ValidationError ;
3030 }
You can’t perform that action at this time.
0 commit comments