Improve validation error messages
The current jsonschema-derived error messages on schema validations does not specify the exact field name that is in error, but rather only the value that is in error. This blueprint tries to add this field name info to the response error back to the user.
[Per Huseyin Gedikli]
Just confirmed invalid fields can be retrieved by calling iter_errors on the validation object, or schema_path attribute returns the invalid field from the JSON. Since error messages is most likely to change with the requirements, my recommendation would be creating a new blueprint to update all test code which depends on the error messages.
InvalidObject exception should contain a list of name of the invalid attributes (which are less likely to change) and all test code should be checking to see if the list contains the validated attribute after the validation.
---> So my take away is that we could pull the list of error fields from the validation exception, and then add this info to the returned error message for display to the user. We could also add this fields list to the InvalidObject exception to support unit testing.
[Brute force way, in case the above doesn't work out]
I think the easiest way is to add a method to barbican/
Blueprint information
- Status:
- Complete
- Approver:
- None
- Priority:
- Medium
- Drafter:
- John Wood
- Direction:
- Approved
- Assignee:
- Huseyin Gedikli
- Definition:
- Approved
- Series goal:
- Accepted for icehouse
- Implementation:
-
Implemented
- Milestone target:
-
icehouse-2
- Started by
- John Wood
- Completed by
- John Wood
Related branches
Related bugs
Sprints
Whiteboard
Gerrit topic: https:/
Addressed by: https:/
Adding invalid_property attr to support test code