dry-validation is a data validation library that provides a powerful DSL for defining schemas and validation rules.

Validations are expressed through contract objects. A contract specifies a schema with basic type checks and any additional rules that should be applied. Contract rules are applied only once the values they rely on have been succesfully verified by the schema.

Unique features

There are a couple of unique features that make dry-validation stand out from the crowd:

Strict, explicit data schemas are separated from the domain validation logic - this allows you define validation rules that are type safe and focus exclusively on validation logic. This in turn makes rule code much simpler and easier to understand Schemas are powered by dry-schema which sanitizes, coerces and type-checks the input for you Contracts support defining macros, which can significantly reduce code duplication in your rules Plays nice with dependency injection, using either option API or automated approach via dry-auto_inject

Code Quality Rank: L5
Monthly Downloads: 364,268
Programming language: Ruby
License: MIT License

dry-validation alternatives and similar gems

Based on the "Validation" category

Do you think we are missing an alternative of dry-validation or a related project?

Add another 'Validation' Gem


dry-validation Join the chat at https://dry-rb.zulipchat.com

Gem Version Build Status Code Climate Test Coverage Inline docs

Supported Ruby versions

This library officially supports following Ruby versions:

  • MRI >= 2.4
  • jruby >= 9.2


See LICENSE file.

*Note that all licence references and agreements mentioned in the dry-validation README section above are relevant to that project's source code only.