Enhancing Form Field Validation with Machine readable responses - Rest API

posting here for wider audience:

This PR adds the FormFieldValidationException handling to the Camunda Rest API.

This was a messing feature in the API that resulted in uninformative errors when a form validation error was thrown.

This become even more apparent with the work in:

Thus the PR was crated to add the missing exception handling.

BUT it also became apparent that additional data should be returned in the API response for machine handling or errors:

Currently as discussed near the bottom of the PR, the Rest API does not provide a machine readable response. the api currently provides a canned Text response with a additional variable for the error message. But this is not parseable a client side library, and it is not very friendly for returning multiple error messages.
In client side, devs want to be able to return multiple server side errors with additional metadata. Standard stuff for any sort of Form Validation library that is used on the client side.

So the question is, what should the implementation be for supporting this additional json data response?
Originally as a easy fix i implemented a if condition that looked to see if the FormValidationException had a detail value of “json-response” and if it did, then the message is used as the sole value of the message node rather than the “could not submit task abc123: ${message}”.

You can see this original work here:

So opening for discussion on best implementation option.
IMO this overall change is very specific use-case: Form Validation Exceptions, which is a very narrow space of the Camunda API and overall configurations.