dry-validation v1.0.0.beta2 Release Notes

Release Date: 2019-04-04 // about 5 years ago
  • โž• Added

    • ๐Ÿ‘Œ Support for arbitrary meta-data in failures, ie:
      class NewUserContract < Dry::Validation::Contract
        params do
          required(:login).filled(:string)
        end
    
        rule(:login) do
          key.failure(text: 'is taken', code: 123) unless db.unique?(values[:login])
        end
      end
    

    Now your error hash will include { login: [{ text: 'is taken', code: 123 }] } (solnic + flash-gordon)

    ๐Ÿ”„ Changed

    • [BREAKING] Error was renamed to Message as it is a more generic concept (solnic)
    • [BREAKING] ErrorSet was renamed to MessageSet for consistency (solnic)
    • [BREAKING] :monads extension wraps entire result objects in Success or Failure (flash-gordon)

    Compare v1.0.0.beta1...v1.0.0.beta2