trailblazer / reform

Form objects decoupled from models.
https://trailblazer.to/2.1/docs/reform.html
MIT License
2.49k stars 184 forks source link

Reform 3.0 #484

Open apotonick opened 5 years ago

apotonick commented 5 years ago

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

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 :woman_facepalming:. 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 commented 3 years ago

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