Skip to content

Instantly share code, notes, and snippets.

View TylerPachal's full-sized avatar

Tyler Pachal TylerPachal

View GitHub Profile
@TylerPachal
TylerPachal / Main.scala
Last active April 19, 2017 19:52
Play! Json validation that considers more than one field
/* This is a small example of how to use Play! Json to validate a JsValue, when you need to consider a combination
* of fields. In this example, I have ContactInfo, where either a phone number or an email address have to provided
* (or both). Each field is represented as a simple String, when in reality you may want to do further validation
* on each field to make sure it is a valid phone number and/or email.
*/
import play.api.libs.json._
object Main {