I have a following function that takes in an input JSON and validates it against a given JSON-Schema using the "com.eclipsesource" %% "play-json-schema-validator" % "0.6.2"
. This whole setup is working great until I have started getting warnings about a deprecated library. As you can see, I am using Ok(Json.toJson(result)))
to convert result of type scala.List[BSONDocument]
to JSON. This is done using the import play.modules.reactivemongo.json.BSONFormats._
library. I really like the easiness and simplicity of this conversion however, I am getting the following warning:
object BSONDocumentFormat in trait BSONFormats is deprecated: 0.11.9
And, here's my actual function:
def getMessage(campaignID: String, revision: Int, transactionID: Int ) =
Action.async { implicit request =>
db.getDocument(campaignID, revision, transactionID)
.map(result =>
Ok(Json.toJson(result)))
.recover {case ex: IOException => InternalServerError("Please install MongoDB")}
}
Is there an alternate way to do this? Why would the library developer remove such a useful functionality?
As per @cchantep comments, I was able to resolve the issue by replacing:
import play.modules.reactivemongo.json.BSONFormats._
with:
import reactivemongo.play.json.BSONFormats._