Return List of ValidationErrors from Barbican API
Barbican API should return list of 'ValidationErrors' if the request schema contains invalid fields. Instead of returning one ValidationError at a time, returning all ValidationErrors will help clients see all invalid fields at once and also help in the future if we want to build a management UI for Barbican.
Response schema should contain list of invalid field names, with detailed validation message for each invalid field.
Blueprint information
- Status:
- Complete
- Approver:
- Jarret Raim
- Priority:
- Low
- Drafter:
- None
- Direction:
- Approved
- Assignee:
- None
- Definition:
- Obsolete
- Series goal:
- None
- Implementation:
- Not started
- Milestone target:
- None
- Started by
- Completed by
- Douglas Mendizábal
Related branches
Related bugs
Sprints
Whiteboard
Questions
1. Is there any bug logged related to this ?
I created this as an improvement to Barbican API so there's no bug associated with this bp.
2. If request has invalid fields, then why not ignore them. go with whatever is good as per validation schema?
Not sure if I understood your question. We can't simply ignore the invalid fields.
3. I think code throws an error when it founds very first invalidity in request JSON entity, it wd not go further. In that case we can only inform one. Do you want to iterate over all the fields?
Yes, that would be the ideal solution. That way user would see all of the errors instead of seeing them one buy one with each request.