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

Reform 3.0 #484

Open
apotonick opened this issue Aug 14, 2019 · 1 comment
Open

Reform 3.0 #484

apotonick opened this issue Aug 14, 2019 · 1 comment
Milestone

Comments

@apotonick
Copy link
Member

apotonick commented Aug 14, 2019

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.

@apotonick
Copy link
Member Author

apotonick commented Dec 24, 2020

Allow dynamic collection :sources do ... end s where each source item can have different propertys depending on the underlying item model. Allow that also for the incoming input hash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants