An extensible F# validation library with built-in validators for primitive types and support for custom validators.
Validus is an extensible validation library for F# designed to be composable and functional. It provides a robust way to validate data from untrusted sources, such as form submissions, and is excellent for creating value objects (constrained primitives). The library includes built-in validators for primitive types and supports custom validators, with an applicative computation expression for accumulating validation errors.
F# developers building applications that require structured validation of user input, domain models, or API payloads, particularly those working in functional programming paradigms.
Developers choose Validus for its composable design, allowing complex validation rules to be built from simple, reusable parts, and its functional approach with error accumulation. Its support for value objects and custom validators makes it uniquely suited for domain-driven design in F#.
An extensible F# validation library.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Validators can be combined using ValidatorGroup or infix operators (<+>, >=>), enabling complex rules from simple parts, as shown in the email validator example.
Includes ready-to-use validators for strings, integers, dates, and collections with standard error messages, reducing boilerplate for common cases.
The applicative computation expression (validate { }) accumulates all validation errors across fields, not just the first, improving user feedback.
Facilitates creating domain-specific types like Email and E164 with private constructors and smart validators, enforcing invariants directly in the type system.
Limited to F# projects, making it unsuitable for mixed-language teams or those unfamiliar with functional programming concepts.
Customizing error messages requires using Check.WithMessage modules or manual Validator.create calls, which can be more verbose than attribute-based approaches.
Lacks built-in integration with common frameworks like ASP.NET Core, requiring additional code for model validation in web applications.
Assumes familiarity with F# and functional patterns like applicative functors, which may deter developers from imperative backgrounds.