webiny / webiny-js

Open-source serverless enterprise CMS. Includes a headless CMS, page builder, form builder, and file manager. Easy to customize and expand. Deploys to AWS.
https://www.webiny.com
Other
7.29k stars 601 forks source link

fix(api-headless-cms): skip invalid DZ values instead of throwing #4202

Closed Pavel910 closed 1 month ago

Pavel910 commented 1 month ago

Changes

This PR ensures that DZ field storage doesn't create a default [] value, because it will break subsequent partial draft saving. To make this possible, we had to reduce the amount of errors being thrown by DZ field transform plugin, and instead use reasonable fallbacks. If the incoming value is not valid for storage, we simply skip it. Doing it this way ensures data consistency in the database/opensearch, and also allows us to save partial entries, where a DZ field can be null or undefined.

How Has This Been Tested?

Manually, and Jest tests.