plone.restapi icon indicating copy to clipboard operation
plone.restapi copied to clipboard

Deserializer could include the value of a field with validation error within the error message

Open zopyx opened this issue 3 years ago • 0 comments

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?

zopyx avatar Apr 19 '22 16:04 zopyx