Reform v2.3.0 Release Notes

  • โฌ†๏ธ You can upgrade from 2.2.0 without worries.

    • โœ‚ Require Representable 3.0.0 and removed Representable 2.4 deprecation code.
    • ๐Ÿ”€ Require Disposable 0.4.0 which fixes issues with nil field values, sync {} and dry-validation.
    • ๐Ÿ›  Fix boolean coercion.
    • ๐Ÿ‘ Allow using :populator classes marked with Uber::Callable.
    • ๐Ÿ“œ Introduce parse: false as a shortcut for deserialzer: { writeable: false}. Thanks to @pabloh for insisting on this handy change.
    • ๐Ÿ“ Memoize the deserializer instance on the class level via ::deserializer. This saves the inferal of a deserializing representer and speeds up following calls by 130%.
    • ๐Ÿ—„ Deprecated positional arguments for validation :default, options: {}. New API: validation name: :default, **.
    • ๐Ÿ”ง Reform now maintains a generic Dry::Schema class for global schema configuration. Can be overridden via ::validation.
    • When validating with dry-validation, we now pass a symbolized hash. We also replaced Dry::Validation::Form with Schema which won't coerce values where it shouldn't.
    • [private] Group#call API now is: call(form, errors).
    • Modify Form#valid? - simply calls validate({}).
    • In :if for validation groups, you now get a hash of result objects, not just true/false.
    • ๐Ÿ‘ Allow adding a custom error AFTER validate has been already called

    Compatibility with dry-validation with 1.x:

    • ๐Ÿ‘€ [CHANGE] seems like "custom" predicate are not supported by dry-schema anymore or better the same result is reached using the rule method: Something like this:

      validation do
      def a_song?(value)
         value == :really_cool_song
      end
      
      required(:songs).filled(:a_song?)
      end
      

      will be something like:

      validation do
      required(:songs).filled
      
      rule(:songs) do
        key.failure(:a_song?) unless value == :really_cool_song
      end
      end
      
    • ๐Ÿ‘ [BREAKING] inheriting/merging/overriding schema/rules is not supported by dry-v so the inherit: option is NOT SUPPORTED for now. Also extend a schema: option using a block is NOT SUPPORTED for now. Possible workaround is to use reform module to compose different validations but this won't override existing validations but just merge them