You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've been using this library in combination with require to constrain our domain objects, but still get nice JsErrors back.
Unfortunately this does not work with Jsonx.formatInline
case class PositiveInteger(i: Int) {
require(i >= 1, "Number must be a positive integer")
}
import play.api.libs.json.Json
// JsError(ValidationError("Number must be a positive integer"))
Jsonx.formatCaseClass[PositiveInteger].reads(Json.parse("""{ "i": -1 }""")))
// IllegalArgumentException("Number must be a positive integer") gets thrown
Jsonx.formatInline[PositiveInteger].reads(Json.parse("-1")))
I might be able to create a PR for this friday if this is wanted
The text was updated successfully, but these errors were encountered:
We've been using this library in combination with
require
to constrain our domain objects, but still get niceJsError
s back.Unfortunately this does not work with
Jsonx.formatInline
I might be able to create a PR for this friday if this is wanted
The text was updated successfully, but these errors were encountered: