Validation library inspired by Scala forms. Based on cats validation interface.
My goal was to create library with similar syntax like Scala forms together with type checking on compilation level, but for various source of
data. For now I created codecs for circe and Map[String, Any]
sources.
Lib is not handling multi complex structures (like class in class).
import pl.onewebpro.validation._
import pl.onewebpro.validation.basic.codec.MapCodec._
case class TestClass(name: String, age: Option[Int])
val validationSchema = schema(
"name" -> nonEmptyString,
"age" -> optional(of[Int])
)(TestClass.apply)(TestClass.unapply)
val data = Map("name" -> "Frank", "age" -> 18)
validationSchema.validate(data)
- Multi structures (class inside class etc.)
- Better handling of scala collections (now only Iterable is support)
- Better source interface design for extracting data
- Better type mapping for results