Skip to content

Reform 3.0 #484

Description

@apotonick

We will start writing Reform 3 once the Trailblazer 2.1 release along with the new website and PRO launch is out. This issue is in a state of flux, defining the planned API.

For a discussion about why I really want to abandon Reform 2.x, here's a talk that summarizes it: https://www.youtube.com/watch?v=6eXDAQpaUV8

Design keys

  • Immutability: never again will we make that mistake and provide an API that allows changing an object once it's created.
  • Reduced internal complexity: we probably won't need Representable for parsing anymore.
  • Coercion/typing: use Dry::Structs that are orchestrated via a simplified twin.

validate

result = Form.validate(form, params)

Fills out the form, and runs the validations. The filled-out form is somehow in result.

Fill-out

We used to have pre-populators to fill-out a form before its validation. Some people even used Form#validate multiple times 🤦‍♀️. The problem here was that this will also run coercion, which is often not wanted and wrong! (e.g. when you serialized the already validated data and then want to display a "correct me" form).

Form.fill_out(form, data)

This bypasses validation and coercion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions