Skip to content

Instantly share code, notes, and snippets.

@dgouyette
Created May 11, 2017 17:00
Show Gist options
  • Save dgouyette/672107d2f2c0554210417e08805177af to your computer and use it in GitHub Desktop.
Save dgouyette/672107d2f2c0554210417e08805177af to your computer and use it in GitHub Desktop.
import jto.validation._
import jto.validation.From
import jto.validation.xml.Rules._
import scala.xml.Node
val rule: Rule[Node, Option[String]] = From[Node] { __ => (__ \ "MyPath" ).read[Option[String]] }
case class Foo(
v1: Option[String],v2: Option[String],
v3: Option[String],v4: Option[String],
v5: Option[String],v6: Option[String],
v7: Option[String],v8: Option[String],
v9: Option[String],v10: Option[String],
v11: Option[String],v12: Option[String],
v13: Option[String],v14: Option[String],
v15: Option[String],v16: Option[String],
v17: Option[String],v18: Option[String],
v19: Option[String],v20: Option[String],
v21: Option[String],v22: Option[String],
v23: Option[String]
)
val fromXmlRule: Rule[Node, Foo] = (
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule ~
rule
) (Foo.apply)
@dgouyette
Copy link
Author

dgouyette commented May 11, 2017

Error:(47, 11) value ~ is not a member of jto.validation.FunctorSyntax[[β$5$]jto.validation.Rule[scala.xml.Node,β$5$]]#FunctorSyntax22[Option[String],Option[String],Option[String],Option[String],Option[String],Option[String],Option[String],Option[String],Option[String],Option[String],Option[String],Option[String],Option[String],Option[String],Option[String],Option[String],Option[String],Option[String],Option[String],Option[String],Option[String],Option[String]]
possible cause: maybe a semicolon is missing before `value ~'?
    rule ~
         ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment