-
Notifications
You must be signed in to change notification settings - Fork 35
Conversation
- The AST is in `validation-json-ast/shared/src/main/scala/Ast.scala` - This also and adds functions to do back and forth conversion with the play AST, and the native JavaScript AST - The vaW defined in the demo is now included in the lib - AstSpec cross compiles (which might be surprising)
)(User.apply, unlift(User.unapply)) | ||
} | ||
implicit val format: Format[js.Dynamic, js.Dynamic, User] = Format( | ||
Rule(j => User.format.validate(Ast.from(j))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Si tu as un meilleur idée pour ça je suis preneur.
- Change the build to publish-local validation, which will be required to compile the example until v2.0 is released
caf8de2
to
bd842d1
Compare
case JObject(value) => value.mapValues(to).toJSDictionary | ||
case JNumber(value) => | ||
val d = value.toDouble; if (d.isNaN || d.isInfinity) null else d | ||
}).asInstanceOf[js.Dynamic] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big fan of this cast. It seems to be avoidable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could model everything with js.Any
, but then we got into the problem than String !<: js.Any
, so we would have to cast anyways...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Equivalent code in circe, which goes through an input: Any
: https://github.com/travisbrown/circe/blob/master/scalajs/src/main/scala/io/circe/scalajs/package.scala
I agree this could be reworked to look a bit nicer
Just a little doc and we're good :) |
What do you think need documentation? Something like We can only cross compile our own custom JSON AST cuz ? On Fri, Jun 24, 2016 at 10:17 AM, Julien Tournay notifications@github.com
|
Yes :) |
This PR replaces json4s-ast with a custom AST
validation-json-ast/shared/src/main/scala/Ast.scala