Description
I think that message
attribute could also be a part of fail
just as it is with error
.
As you describe it, FAIL is:
There was a problem with the data submitted, or some pre-condition of the API call wasn't satisfied
So in case of the former, the "problem with the data submitted" current structure makes perfect sense.
However for "some pre-condition of the API call wasn't satisfied" it does not quite work, and a "message" describing the problem seems to be much more logical. Because this pre-condition may not depend on what data user submitted, but on other conditions outside of it. For example maybe this request only works on certain days of the week?
It also allows to handle both fail
and error
responses in the same way, by showing an error or warning and message
response from the server.