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

DX DeserializeFromJson hides/specific validation errors.

Open fredvd opened this issue 3 years ago • 0 comments

The deserializer for Dexterity content removes the specifics of a validation error in this piece of code, which is probably fine for consumption in the Frontend over restapi.

https://github.com/plone/plone.restapi/blob/b96f3dfcde7fd60880a117ee03555de52cd5ac7d/src/plone/restapi/deserializer/dxcontent.py#L54-L59

However we are also using this Deserializer in collective.exportimport to recreate content items from stored json:

https://github.com/collective/collective.exportimport/blob/762e0f0834448372a2dae54f84dac9cd151c234e/src/collective/exportimport/import_content.py#L249-L251

I had to patch my plone.restapi instance locally to disable this code to debug an import issue. Only then I found out a validation for effective date < expiration date was the cause, but all I got before was 'ValidationError'.

For 'backend' use cases this reraising should be configurable so collective.export and other tools can disable it.

FYI @pbauer

fredvd avatar Sep 01 '21 15:09 fredvd