Skip to content

JSON Reads max and min combinators should work on any Numeric#1363

Merged
jroper merged 2 commits intoplayframework:masterfrom
mariussoutier:master
Jul 26, 2013
Merged

JSON Reads max and min combinators should work on any Numeric#1363
jroper merged 2 commits intoplayframework:masterfrom
mariussoutier:master

Conversation

@mariussoutier
Copy link
Contributor

The Reads.min and Reads.max combinators in play-json currently only work on Int, but there's no reason it shouldn't work any any Numeric.

@cloudbees-pull-request-builder

play2-master-PRs #392 SUCCESS
This pull request looks good

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not using the word "size", it's more about the value, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you're right, fixed it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no you can commit on your branch and the PR is updated!

On Fri, Jul 19, 2013 at 3:10 PM, Marius Soutier notifications@github.comwrote:

In
framework/src/play-json/src/main/scala/play/api/libs/json/JsConstraints.scala:

@@ -112,11 +112,19 @@ trait ConstraintReads {
def seq[A](implicit reads: Reads[A]): Reads[Seq[A]] = Reads.traversableReads[Seq, A]
def map[A](implicit reads: Reads[A]): Reads[collection.immutable.Map[String, A]] = Reads.mapReads[A]

  • def min(m: Int)(implicit reads: Reads[Int]) =
  • filterNot[Int](ValidationError%28"error.min", m%29)(_ < m)(reads)
  • /**
  • * Defines a minimum size for a numeric Reads. Combine with max using or, e.g.

Yes you're right... I guess I have to close this PR and submit a new one?


Reply to this email directly or view it on GitHubhttps://github.com//pull/1363/files#r5291461
.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, see below. value was just the word I was looking for but then I resorted to size.

@mandubian
Copy link
Contributor

Seems OK ;)

@cloudbees-pull-request-builder

play2-master-PRs #393 SUCCESS
This pull request looks good

jroper added a commit that referenced this pull request Jul 26, 2013
JSON Reads max and min combinators should work on any Numeric
@jroper jroper merged commit a7d8fed into playframework:master Jul 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants