rest - how to customize grails restful controller error response -
how customize grails restfulcontroller error response? illustration 1 of restful controller returning next response default on error while trying save object.
{ "errors": [ { "object": "com.test.task", "field": "description", "rejected-value": null, "message": "property [description] of class [class com.test.task] cannot null" } ] }
i customize response bellow.
{ "errors" : { "message": "property [description] of class [class com.test.task] cannot be" }, { "message": "this going 2nd message" }, ..... }
use internationalization
feature described here. add together next resource bundle messages.properties
.
task.description.nullable = message
or
com.test.task.description.nullable = message
rest grails grails-controller
No comments:
Post a Comment