Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 92b652b

Browse files
naferxgmethvin
authored andcommitted
Remove deprecated code in JsError (playframework#6304)
1 parent 07decc9 commit 92b652b

3 files changed

Lines changed: 2 additions & 7 deletions

File tree

framework/src/play-integration-test/src/test/scala/play/it/http/parsing/JsonBodyParserSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ object JsonBodyParserSpec extends PlaySpecification {
7171
import scala.concurrent.ExecutionContext.Implicits.global
7272

7373
val fooParser = BodyParsers.parse.json.validate {
74-
_.validate[Foo].asEither.left.map(e => BadRequest(JsError.toFlatJson(e)))
74+
_.validate[Foo].asEither.left.map(e => BadRequest(JsError.toJson(e)))
7575
}
7676
parse("""{"a":1,"b":"bar"}""", Some("application/json"), "utf-8", fooParser) must beRight
7777
parse("""{"foo":"bar"}""", Some("application/json"), "utf-8", fooParser) must beLeft

framework/src/play-json/src/main/scala/play/api/libs/json/JsResult.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ object JsError {
4545
//def toJsonErrorsOnly: JsValue = original // TODO
4646
def toFlatForm(e: JsError): Seq[(String, Seq[ValidationError])] = e.errors.map { case (path, seq) => path.toJsonString -> seq }
4747

48-
@deprecated("Use toJson which include alternative message keys", "2.3")
49-
def toFlatJson(e: JsError): JsObject = toJson(e.errors, true)
50-
@deprecated("Use toJson which include alternative message keys", "2.3")
51-
def toFlatJson(errors: Seq[(JsPath, Seq[ValidationError])]): JsObject = toJson(errors, true)
52-
5348
private def toJson(errors: Seq[(JsPath, Seq[ValidationError])], flat: Boolean): JsObject = {
5449
val argsWrite = Writes.traversableWrites[Any](Writes.anyWrites)
5550
errors.foldLeft(Json.obj()) { (obj, error) =>

framework/src/play/src/main/scala/play/api/mvc/Action.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ trait BodyParser[+A] extends (RequestHeader => Accumulator[ByteString, Either[Re
198198
* Example:
199199
* {{{
200200
* def validateJson[A : Reads] = parse.json.validate(
201-
* _.validate[A].asEither.left.map(e => BadRequest(JsError.toFlatJson(e)))
201+
* _.validate[A].asEither.left.map(e => BadRequest(JsError.toJson(e)))
202202
* )
203203
* }}}
204204
*

0 commit comments

Comments
 (0)