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: 1,418,615
Programming language: Ruby
License: MIT License
Latest version: v1.9.0

dry-validation alternatives and similar gems

Based on the "Validation" category.
Alternatively, view dry-validation alternatives based on common mentions on social networks and blogs.

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

Add another 'Validation' Gem


<!--- this file is synced from dry-rb/template-gem project -->

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

Gem Version CI Status Codacy Badge Codacy Badge Inline docs


Supported Ruby versions

This library officially supports the following Ruby versions:

  • MRI >= 2.7.0
  • jruby >= 9.3 (postponed until 2.7 is supported)


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.