Releases: hakimjonas/valar
Releases · hakimjonas/valar
v0.6.0
Version 0.6.0 Release notes
Breaking Changes
- Pass-through validators: Built-in validators for
Int,String,Float,Doublenow accept all values - Constraints are opt-in via
ValidationHelpers:nonNegativeInt,nonEmpty,finiteFloat,finiteDouble - See MIGRATION.md for upgrade instructions
Internal Improvements
- Eliminated
Validator/AsyncValidatorcode duplication with internalF[_]abstraction - Upgraded to Scala 3.7.4 with modern inline metaprogramming
- Added
ValidationConfigfor collection size limits (DoS protection)
Documentation
- Added migration guide for v0.5.0 → v0.6.0
- Added design.md and
examples.md - Updated README with pass-through validator documentation
Installation
libraryDependencies += "net.ghoula" %%% "valar-core" % "0.6.0"v0.5.0 - Advanced Features
We are excited to announce the release of Valar v0.5.0. This is a significant update that introduces powerful new capabilities for modern, real-world validation scenarios, along with major performance and extensibility improvements.
New Features in this Release:
- Async Validation Support: The
AsyncValidatortypeclass has been introduced to support validators that return aFuture, allowing for non-blocking, I/O-bound validations. - Internationalization (i18n): A new
valar-translatormodule provides a mechanism for translatingValidationErrormessages into different languages. - Core Extensibility with
ValidationObserver: A foundational, zero-overhead pattern has been added for integrating cross-cutting concerns like logging and metrics via theValidationObservertypeclass. - JVM Performance & Benchmarking Suite: A JMH benchmark suite has been created to measure and guard against performance regressions on the JVM. This suite will be expanded to include Scala Native in a future release.
- Cross-Platform Support (JVM + Native): The initial work to build and deploy validations consistently across both JVM and Scala Native platforms has been completed.
- Unified Testing with
valar-munit: The newvalar-munitextension provides a premier, assertion-driven testing experience.
Major Enhancements:
- Improved Macro-Derivation Engine: The existing macro for deriving validators has been completely rewritten for significantly improved performance and faster compilation times. This new engine (
Validator.deriveandAsyncValidator.derive) automatically populates errors with rich contextual details like field paths and types. - Expanded Type Support: Native validation for complex data structures like
union typeshas been added. - Public
ErrorAccumulatorAPI: The powerfulErrorAccumulatortypeclass is now a public, core feature, allowing developers to implement custom error-handling strategies.
v0.3.0 - Scala 3.7 Support
Valar 0.3.0 - Scala 3.7 Support
This release adds full support for Scala 3.7, focusing on two key enhancements:
Named Tuples Support
Valar now supports Scala 3.7's named tuples, providing field-aware error messages that significantly improve debugging:
- Error messages include actual field names instead of generic positional indices
- Zero runtime overhead with compile-time field name extraction
- Complete backward compatibility with regular tuples
Example:
// Define a named tuple type with meaningful field names
type PersonTuple = (name: String, age: Int, email: String)
// Validation works with improved error messages
val invalidPerson: PersonTuple = (name = "", age = -10, email = "bad-email")
val result = summon[Validator[PersonTuple]].validate(invalidPerson)
// Error messages now include actual field names:
// Field: name
// Error: Invalid field: name, field type: String: Name must not be empty
// Field: age
// Error: Invalid field: age, field type: Int: Age must be non-negative, got -10
## Givens Prioritization Handling
This release addresses breaking changes in Scala 3.7's givens prioritization algorithm:
Added safeguards to ensure consistent validator resolution
Updated documentation with guidance on handling potential conflicts
Maintains backward compatibility with existing code
Compatibility
Requires Scala 3.7+
Zero external dependencies
## Installation
```scala
libraryDependencies += "net.ghoula" %% "valar" % "0.3.0"v.0.2.6
We start at 0.2.6 because I still have lots to learn about CI and publishing. But the library is I believe ready for field testing.
A change log does not make much sense at this point. So take this as a first release.