Try to convert the data at Path
to type O
Try to convert the data at Path
to type O
val json = Json.parse("""{ "informations": { "label": "test" } }""") implicit val infoValidated = From[JsValue]{ __ => (__ \ "label").read[String] } val v = From[JsValue]{ __ => (__ \ "informations").read[Informations]) } v.validate(json) == Valid("test")
a lookup function. This function finds data in a structure of type I, and coerce it to type O
A Rule validating the existence and validity of data at path
.
When applied, the rule will lookup for data at the given path, and apply the sub
Rule on it
When applied, the rule will lookup for data at the given path, and apply the sub
Rule on it
val json = Json.parse("""{ "informations": { "label": "test" } }""") val infoValidated = From[JsValue]{ __ => (__ \ "label").read(nonEmptyText) } val v = From[JsValue]{ __ => (__ \ "informations").read(infoValidated)) } v.validate(json) == Valid("test")
the constraint to apply on the subdata
A Rule validating the existence and validity of data at path