On the branch fix-validation-errors you can see that I've added validation_errors to the fields in model-type-testing.yaml and updated tests in src/mapp/test.py to properly test the validation errors returned from the cli and server. Now I'd like to update the UI to display the error response from the server if any of the forms fail validation on the backend.
Example validation error json returned:
{
"error": {
"code": "VALIDATION_ERROR",
"message": "This model has failed validation",
"field_errors": {
"field_a": "message about why field a is invalid",
"field_b": "message about why field b is invalid"
}
}
}
If the server responds with status code 400 and error code VALIDATION_ERROR then we'll want to display message in the status area and also show the field_errors messages in the third column on the table displaying the form. It should display in red and bold text. If there are multiple field_errors we should show all of them, but there may not always be a message for each field in the form.
Let's also add some tests, they don't need to be exhaustive, covering every validation_error like python tests do, just one to confirm the error messages are displayed properly.
requirements
- update forms to show validation errors from server
- add test to ensure field errors are being displayed
On the branch
fix-validation-errorsyou can see that I've addedvalidation_errorsto the fields inmodel-type-testing.yamland updated tests insrc/mapp/test.pyto properly test the validation errors returned from the cli and server. Now I'd like to update the UI to display the error response from the server if any of the forms fail validation on the backend.Example validation error json returned:
{ "error": { "code": "VALIDATION_ERROR", "message": "This model has failed validation", "field_errors": { "field_a": "message about why field a is invalid", "field_b": "message about why field b is invalid" } } }If the server responds with status code
400and error codeVALIDATION_ERRORthen we'll want to displaymessagein the status area and also show thefield_errorsmessages in the third column on the table displaying the form. It should display in red and bold text. If there are multiplefield_errorswe should show all of them, but there may not always be a message for each field in the form.Let's also add some tests, they don't need to be exhaustive, covering every
validation_errorlike python tests do, just one to confirm the error messages are displayed properly.requirements