Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to org.playframework #927

Merged
merged 3 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![OpenCollective](https://img.shields.io/opencollective/all/playframework?label=financial%20contributors&logo=open-collective)](https://opencollective.com/playframework)

[![Build Status](https://github.com/playframework/play-json/actions/workflows/build-test.yml/badge.svg)](https://github.com/playframework/play-json/actions/workflows/build-test.yml)
[![Maven](https://img.shields.io/maven-central/v/com.typesafe.play/play-json_2.13.svg?logo=apache-maven)](https://mvnrepository.com/artifact/com.typesafe.play/play-json_2.13)
[![Maven](https://img.shields.io/maven-central/v/org.playframework/play-json_2.13.svg?logo=apache-maven)](https://mvnrepository.com/artifact/org.playframework/play-json_2.13)
[![Repository size](https://img.shields.io/github/repo-size/playframework/play-json.svg?logo=git)](https://github.com/playframework/play-json)
[![Scala Steward badge](https://img.shields.io/badge/Scala_Steward-helping-blue.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAMAAAARSr4IAAAAVFBMVEUAAACHjojlOy5NWlrKzcYRKjGFjIbp293YycuLa3pYY2LSqql4f3pCUFTgSjNodYRmcXUsPD/NTTbjRS+2jomhgnzNc223cGvZS0HaSD0XLjbaSjElhIr+AAAAAXRSTlMAQObYZgAAAHlJREFUCNdNyosOwyAIhWHAQS1Vt7a77/3fcxxdmv0xwmckutAR1nkm4ggbyEcg/wWmlGLDAA3oL50xi6fk5ffZ3E2E3QfZDCcCN2YtbEWZt+Drc6u6rlqv7Uk0LdKqqr5rk2UCRXOk0vmQKGfc94nOJyQjouF9H/wCc9gECEYfONoAAAAASUVORK5CYII=)](https://scala-steward.org)
[![Mergify Status](https://img.shields.io/endpoint.svg?url=https://api.mergify.com/v1/badges/playframework/play-json&style=flat)](https://mergify.com)
Expand All @@ -24,16 +24,16 @@ To get started, you can add play-json as a dependency in your project:

* sbt
```scala
libraryDependencies += "com.typesafe.play" %% "play-json" % -version-
libraryDependencies += "org.playframework" %% "play-json" % -version-
```
* Gradle
```
compile group: 'com.typesafe.play', name: 'play-json_2.13', version: -version-
compile group: 'org.playframework', name: 'play-json_2.13', version: -version-
```
* Maven
```xml
<dependency>
<groupId>com.typesafe.play</groupId>
<groupId>org.playframework</groupId>
<artifactId>play-json_2.13</artifactId>
<version>-version-</version>
</dependency>
Expand Down
5 changes: 1 addition & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ val joda = Seq(

// Do not check for previous JS artifacts for upgrade to Scala.js 1.0 because no sjs1 artifacts exist
def playJsonMimaSettings = Seq(
mimaPreviousArtifacts := Set(
organization.value %%% name.value % previousStableVersion.value
.getOrElse(throw new Error("Unable to determine previous version"))
),
mimaPreviousArtifacts := Set(), // TODO: revert
mimaBinaryIssueFilters ++= Seq(
),
)
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/working/scalaGuide/main/json/ScalaJson.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The [`play.api.libs.json`](api/scala/play/api/libs/json/index.html) package cont
- [[Automatic conversion|ScalaJsonAutomated]] to and from case classes with minimal boilerplate. If you want to get up and running quickly with minimal code, this is probably the place to start.
- [[Custom validation|ScalaJsonCombinators#Validation-with-Reads]] while parsing.
- [[Automatic parsing|ScalaBodyParsers#The-default-body-parser]] of JSON in request bodies, with auto-generated errors if content isn't parseable or incorrect Content-type headers are supplied.
- Can be used outside of a Play application as a standalone library. Just add `libraryDependencies += "com.typesafe.play" %% "play-json" % playVersion` to your `build.sbt` file.
- Can be used outside of a Play application as a standalone library. Just add `libraryDependencies += "org.playframework" %% "play-json" % playVersion` to your `build.sbt` file.
- Highly customizable.

The package provides the following types:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ object ScalaJsonAutomatedSpec {
)
val sampleJson3 = Json.parse(
"""{
"lightbend_name": "Schmitt",
"lightbend_firstName": "Christian",
"lightbend_userAge": 26
"opencollective_name": "Schmitt",
"opencollective_firstName": "Christian",
"opencollective_userAge": 26
}"""
)
val sampleData2 = PlayUser("Schmitt", "Christian", 26)
Expand Down Expand Up @@ -150,11 +150,11 @@ class ScalaJsonAutomatedSpec extends Specification {
//#auto-custom-naming-format
import play.api.libs.json._

object Lightbend extends JsonNaming {
override def apply(property: String): String = s"lightbend_$property"
object OpenCollective extends JsonNaming {
override def apply(property: String): String = s"opencollective_$property"
}

implicit val config: JsonConfiguration = JsonConfiguration(Lightbend)
implicit val config: JsonConfiguration = JsonConfiguration(OpenCollective)

implicit val customWrites: OFormat[PlayUser] = Json.format[PlayUser]
//#auto-custom-naming-format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ object UserProfile {
def json1 = Json.obj("first_name" -> "Christian", "last_name" -> "Schmitt", "home_city" -> "Kenzingen")
def json2 =
Json.obj(
"lightbend_firstName" -> "Christian",
"lightbend_lastName" -> "Schmitt",
"lightbend__homeCity" -> "Kenzingen"
"opencollective_firstName" -> "Christian",
"opencollective_lastName" -> "Schmitt",
"opencollective__homeCity" -> "Kenzingen"
)
def json3 = Json.obj("FirstName" -> "Christian", "LastName" -> "Schmitt", "_homeCity" -> "Kenzingen")
}
Expand Down Expand Up @@ -682,11 +682,11 @@ class JsonExtensionSpec extends AnyWordSpec with Matchers {
"create a writes[UserProfile] with CustomNaming" in {
import play.api.libs.json.Json

object LightbendJsonNaming extends JsonNaming {
override def apply(property: String): String = s"lightbend_$property"
object OpenCollectiveJsonNaming extends JsonNaming {
override def apply(property: String): String = s"opencollective_$property"
}

implicit val jsonConfiguration: JsonConfiguration = JsonConfiguration(LightbendJsonNaming)
implicit val jsonConfiguration: JsonConfiguration = JsonConfiguration(OpenCollectiveJsonNaming)
implicit val writes: OWrites[UserProfile] = Json.writes[UserProfile]

Json.toJson(UserProfile.obj1).mustEqual(UserProfile.json2)
Expand All @@ -695,11 +695,11 @@ class JsonExtensionSpec extends AnyWordSpec with Matchers {
"create a reads[UserProfile] with CustomNaming" in {
import play.api.libs.json.Json

object LightbendJsonNaming extends JsonNaming {
override def apply(property: String): String = s"lightbend_$property"
object OpenCollectiveJsonNaming extends JsonNaming {
override def apply(property: String): String = s"opencollective_$property"
}

implicit val jsonConfiguration: JsonConfiguration = JsonConfiguration(LightbendJsonNaming)
implicit val jsonConfiguration: JsonConfiguration = JsonConfiguration(OpenCollectiveJsonNaming)
implicit val reads: Reads[UserProfile] = Json.reads[UserProfile]

Json.fromJson(UserProfile.json2).mustEqual(JsSuccess(UserProfile.obj1))
Expand All @@ -708,11 +708,11 @@ class JsonExtensionSpec extends AnyWordSpec with Matchers {
"create a format[UserProfile] with CustomNaming" in {
import play.api.libs.json.Json

object LightbendJsonNaming extends JsonNaming {
override def apply(property: String): String = s"lightbend_$property"
object OpenCollectiveJsonNaming extends JsonNaming {
override def apply(property: String): String = s"opencollective_$property"
}

implicit val jsonConfiguration: JsonConfiguration = JsonConfiguration(LightbendJsonNaming)
implicit val jsonConfiguration: JsonConfiguration = JsonConfiguration(OpenCollectiveJsonNaming)
implicit val format: OFormat[UserProfile] = Json.format[UserProfile]

Json.fromJson(UserProfile.json2).mustEqual(JsSuccess(UserProfile.obj1))
Expand Down
2 changes: 1 addition & 1 deletion project/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object Common extends AutoPlugin {

override def globalSettings =
Seq(
organization := "com.typesafe.play",
organization := "org.playframework",
organizationName := "The Play Framework Project",
organizationHomepage := Some(url("https://playframework.com/")),
homepage := Some(url(s"https://github.com/playframework/${repoName}")),
Expand Down
3 changes: 1 addition & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
*/

resolvers ++= DefaultOptions.resolvers(snapshot = true)
resolvers += Resolver.typesafeRepo("releases")

addSbtPlugin("com.typesafe.play" % "play-docs-sbt-plugin" % sys.props.getOrElse("play.version", "2.9.0-RC2"))
addSbtPlugin("org.playframework" % "play-docs-sbt-plugin" % sys.props.getOrElse("play.version", "3.0.0-M1"))

addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6")

Expand Down