Deserializer could include the value of a field with validation error within the error message
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 109
- Forks
- 107
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 4
Description
collective.exportimport uses this code
deserializer = getMultiAdapter((new, self.request), IDeserializeFromJson)
which sometimes produces a validation error like (from some field value not matching the field constraints)
BadRequest([{'message': 'The specified URI is not valid.', 'field': 'url', 'error': 'ValidationError'}])
I would be often super useful having direct access to the offending value.
Perhaps one could include the string representation together with the BadRequest exception?
Problem might be large data, overlong strings or so.
Thoughts?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the collective.exportimport call to getMultiAdapter((new, self.request), IDeserializeFromJson) and trace how its validation errors become BadRequest responses. Define how the offending field value should be represented and bounded, then verify that validation errors expose it without producing unwieldy messages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100