Details
-
New Feature
-
Status: Closed
-
TBD
-
Resolution: Fixed
-
None
-
None
-
None
-
Undetermined
Description
We'd like to make some changes in the webservices.rest module so that when you try to save something, and you get back Spring binding errors, the the client automatically sees a helpful field-by-field error result, with the correct 400 response status.
Inconveniently, in openmrs-core, the ValidateUtil.validate(Object) method manually combines error messages into a single string. See https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/validator/ValidateUtil.java#L83 . The correct thing to do would be to also pass along the Errors object as part of the ValidationException.
So, to make the change we need in webservices.rest, we need to either
(a) change openmrs-core so a ValidationException holds a Spring errors object, backport this as far as 1.8.x, and have the next webservices.rest release depend on to-be-released versions of OpenMRS core.
(b) duplicate the ValidationUtil.validate(Object) method in the webservices.rest module, with this small change; in the base DelegatingCrudResources class we will call this before calling save on an object (meaning that validation will happen twice for every create/update, once by webservices.rest, and again by core when we actually issue the service save call).
We should do the change in (a) anyway, regardless of whether it is backported or not.
Gliffy Diagrams
Attachments
Issue Links
- is related to
-
TRUNK-4296 ValidationException should contain the entire Errors object instead of just the error message text
-
- Closed
-
- relates to
-
TRUNK-4386 Fix loading messages in tests for modules
-
- Closed
-