agrestio / agrest

Server-side Java REST Framework for easy access to data graphs from various backends
https://agrest.io
Apache License 2.0
80 stars 34 forks source link

Extend response with extra information in case of error #551

Open alevshunov opened 2 years ago

alevshunov commented 2 years ago

When we are saving/updating an entity via agrest using POST/PUT methods and the model is not valid by some rules, the response is looks like: "validation failed, 3 errors". But we have no any extra information about what kind of errors are.

So, it will be nice to have extended error response, something like:

{ 
   success: false, 
   message: "...: validation failed, 3 errors", 
   errors: [
     { field: 'firstName', message: 'firstName is re'}, 
     ... 
   ],
   ...
}