-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Labels
Milestone
Description
What
Support serialize
property on the field record.
Why
To have a field-specific custom serialization transformer. To deprive the necessity to carry around Form.props.onSerialize
for the fields that are meant to have the same serialization transformer.
Specification
- A field may have a custom
onSerialize
property upon its creation in the options passed tocreateField
high-order component. - There is no
serialize
option set by default. - Custom
serialize
has the highest priority, and is executed when serializing the fields. - Whenever a form-wide
Form.props.onSerialize
and a field-wideserialize
are present, the form's transformer accepts already transformed field serialized value.
How
- Add the
serialize
property to thecreateField
options - Grab the
serialize
from the field record upon dispatchingfieldUtils.serializeFields
- Add unit test that custom
serialize
transformer gets propagated to the field record upon creation - Add integration test to assert custom
serialize
transformer is dispatched when a form is serialized - Add integration test to assert that custom
serialize
andForm.props.onSerialize
complement each other - Update
createField
options documentation (+ example of usage)