All Downloads are FREE. Search and download functionalities are using the official Maven repository.

inputvalidator.MapValidator.scala Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package inputvalidator

case class MapValidator(map: Map[String, Any] = Map(), override val results: Results = Results(Nil)) extends ValidatorLike {

  def apply(inputs: NotYet*): MapValidator = {
    val newResults = Results(results.toSeq ++ inputs.map {
      case NotYet(k: KeyInput, validations) =>
        validations.apply(KeyValueInput(k.key, extractValue(map.get(k.key))))
      case NotYet(kv: KeyValueInput, validations) =>
        validations.apply(KeyValueInput(kv.key, extractValue(kv.value)))
      case done => done
    })
    MapValidator(newResults.inputs.toMap(), newResults)
  }

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy