trailblazer / reform

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

Revert all non-backwards compatible 2.3 changes to create 2.2.5 #490

Closed samstickland closed 4 years ago

samstickland commented 5 years ago

NOTE: This PR is currently raised against trailblazer/reform master, but obviously it should not be merged to master, but instead to a 2.25 branch

This downgrades the version to 2.2.5 and reverts the following commits:

e1c94c9 Merge pull request #446 from herwinw/readme_fix 55d6b34 Fixed image in README 0753ac2 add gitter link 74f2715 releasing 2.3.0.rc1. d18a0fb more docs. cbf4dd9 don't include index in the full_errors, making it completely senseless for collection, but compatible with rails. go figure. 2788e35 do not rely on Hash#fetch. this makes the traversal compatible with AMV. d2a4e20 make Form#errors return an empty Errors object when #validate hasn't been called. reform 3 will clean up with this. 47fd7c7 add populator test with kw args. 9980009 more cleanups and fixes with hint. 0b5437c implement Result#hints. clean up Result. 3111b47 more tests for custom schema. 79cdcf5 simplify Errors. e77e14e errors.messages now calls dry's messages instead of errors. full_messages work. fb968dd fixing tests. hope i didn't break anything. cb2f636 better dry tests. f99672c move Errors to separate file. start properly test dry. 618cb75 test errors(locale: :de). fixes #391. dfad442 introduce Form#to_result as an intermediate API until we have established Form#call which returns a real Result object. 143f4d8 Form#errors now always returns the Errors object. Form#call will return a proper result object with #errors, etc. 7d64b20 remove useless test. 6972db0 provide dotted errors even though Reform core thinks it's not a good idea. this is an optional feature, but available via Form#errors to provide backward-compat. 9c802d8 move Result and Errors to reform/result.rb. ec20157 fix Result. add Errors as a deprecating API. 3592633 remove Errors until we need it back. b319152 make Pointer work. 45af117 start introducing a new, optional API for errors. 7016596 remove Errors::Merge as we don't need it for now. 0132cfc traversing works. 2ea8263 cleanup Pointer. e60bbb6 advance. 1fd6a76 better test. f2eb312 more cleanups. bc107f8 start cleaning up. seems to be working, though. 5ab3402 allow many pointers. a6f438c playing with a Pointer class. 7c417df start simplifying by having every form simply store the result. b312b17 before refactoring. 12ec81a simplify the validation. 29bac03 instead of implicitly merging errors into nested forms in Group.call, introduce validate!(injected_errors) that allows to pass errors from the outside. 44bbb20 almost working. [ci skip] 53c0a1f why do we need this nested merge? f87446a encapsulate writing in Dry to nested forms. i am picturing this to be completely gone in reform 3, where the nested result structure "is" the presentable form. this will reduce a lot of confusion and wrong order calling of methods, etc. 5f38ad0 make Dry more readable. 8482896 remove useless check. 86fcbc1 move all Errors logic out of Groups::Result into Validate. now, any knowledge about merging is only there. 346a265 when validate!'ing nested collections, pass their index into the prefix array. this avoids having this weird double check in Errors#merge!. speaking of, Errors#merge! is now Errors::Merge.merge! (will be renamed soon). [ci skip] 98d8833 remove all "array"/"hash" methods for Errors. this can be done via Errors#to_h or something at a later point. there's no guarantee that Errors is anything close to a hash or array. 2c5ba27 we don't need Errors#to_s. 0ba41aa more cleanups. 62da021 it's Errors#success? now, to be compliant with TRB and DRY.rb interfaces. 7d0882a remove redundant Errors#size. ehm. 6ea9e80 rename #evaluate_if to evaluate?. e6dd946 remove old comment. 741366c more tests for collection. 3a13d2c document. 26daa43 simplify merge!. 8aa69fa document Errors#raw requirement. 94afb08 make Groups#call return all errors instead of passing them into the method. 357522b all tests pass. 332e801 remove prefixes. f342924 simplify #validate! by simply returning the errors instead of writing to this weird errors object on the go. 4499895 simplify and break. 229b504 simplify Contract::Errors. 8685d33 remove Form#valid? this is an ugly survivor of the AMV era.

emaglio commented 5 years ago

marked ready for review so Travis can run - IT'S NOT READY FOR REVIEW!

emaglio commented 4 years ago

@samstickland closing this since we fixed current v2.3.0.rc2 branch :+1: