Schema definitions

You can create validation schema using composition or using implicits

import pl.muninn.simple.validation._

 case class Field(name:String, otherField:String)

 val compositionSchema:ValidationSchema[Field] = createSchema { context =>
   context.field(_.name).is(notEmptyString and minimalLengthString(8)) +
     context.field(_.otherField).is(notEmptyString)
 }
// compositionSchema: ValidationSchema[Field] = <function1>

 compositionSchema.validate(Field("",""))
// res0: ValidationResult = Invalid(
//   e = Append(
//     leftNE = Append(
//       leftNE = Singleton(a = EmptyField(field = "name")),
//       rightNE = Singleton(
//         a = MinimalLength(field = "name", expected = 8, value = 0)
//       )
//     ),
//     rightNE = Singleton(a = EmptyField(field = "otherField"))
//   )
// )

 val implicitSchema:ValidationSchema[Field] = createSchema { context =>
   (context.field(_.name).notEmpty and minimalLengthString(8)) +
     context.field(_.otherField).notEmpty
 }
// implicitSchema: ValidationSchema[Field] = <function1>

 implicitSchema.validate(Field("",""))
// res1: ValidationResult = Invalid(
//   e = Append(
//     leftNE = Append(
//       leftNE = Singleton(a = EmptyField(field = "name")),
//       rightNE = Singleton(
//         a = MinimalLength(field = "name", expected = 8, value = 0)
//       )
//     ),
//     rightNE = Singleton(a = EmptyField(field = "otherField"))
//   )
// )