Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support "serialize" createField option #303

Open
3 of 6 tasks
kettanaito opened this issue Oct 16, 2018 · 0 comments
Open
3 of 6 tasks

Support "serialize" createField option #303

kettanaito opened this issue Oct 16, 2018 · 0 comments
Assignees
Labels
enhancement Enhances existing functionality. needs:testing
Milestone

Comments

@kettanaito
Copy link
Owner

kettanaito commented Oct 16, 2018

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

  1. A field may have a custom onSerialize property upon its creation in the options passed to createField high-order component.
  2. There is no serialize option set by default.
  3. Custom serialize has the highest priority, and is executed when serializing the fields.
  4. Whenever a form-wide Form.props.onSerialize and a field-wide serialize are present, the form's transformer accepts already transformed field serialized value.

How

  • Add the serialize property to the createField options
  • Grab the serialize from the field record upon dispatching fieldUtils.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 and Form.props.onSerialize complement each other
  • Update createField options documentation (+ example of usage)
@kettanaito kettanaito added enhancement Enhances existing functionality. needs:testing good first issue Good for newcomers. labels Oct 16, 2018
@kettanaito kettanaito added this to the 1.x milestone Oct 16, 2018
@kettanaito kettanaito mentioned this issue Oct 16, 2018
Merged
3 tasks
@kettanaito kettanaito self-assigned this Oct 26, 2018
@kettanaito kettanaito changed the title Support "onSerialize" on the field record Support "serialize" createField option Oct 26, 2018
@kettanaito kettanaito removed the good first issue Good for newcomers. label Oct 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhances existing functionality. needs:testing
Projects
None yet
Development

No branches or pull requests

1 participant