Skip to content

Validation Error Handling #125

@b-rad-c

Description

@b-rad-c

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions