Skip to content

Commit

Permalink
Merge pull request #229 from circe/upgrade-circe-version
Browse files Browse the repository at this point in the history
Upgrade circe version, change gitignore
  • Loading branch information
zarthross authored May 25, 2022
2 parents 36d8941 + 70b55a4 commit 7bc60e2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ target/
tmp/
docs/src/main/tut/contributing.md
.bsp/
.bloop/
.metals/
.vscode/
**/metals.sbt
13 changes: 9 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ val compilerOptions = Seq(
val scala212 = "2.12.15"
val scala213 = "2.13.7"

val circeVersion = "0.14.1"
val circeVersion = "0.14.2"
val paradiseVersion = "2.1.1"

val jawnVersion = "1.3.2"
val munitVersion = "0.7.29"
val disciplineMunitVersion = "1.0.9"

val previousCirceGenericExtrasVersion = "0.13.0"
val previousCirceGenericExtrasVersions = Set("0.14.0", "0.14.1")

def priorTo2_13(scalaVersion: String): Boolean =
CrossVersion.partialVersion(scalaVersion) match {
Expand Down Expand Up @@ -78,7 +78,12 @@ val allSettings = baseSettings ++ publishSettings
val docMappingsApiDir = settingKey[String]("Subdirectory in site target directory for API docs")

lazy val root =
project.in(file(".")).settings(allSettings).settings(noPublishSettings).aggregate(genericExtrasJVM, genericExtrasJS)
project
.in(file("."))
.settings(allSettings)
.settings(noPublishSettings)
.aggregate(genericExtrasJVM, genericExtrasJS)
.disablePlugins(MimaPlugin)

lazy val genericExtras = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
Expand All @@ -87,7 +92,7 @@ lazy val genericExtras = crossProject(JSPlatform, JVMPlatform)
.settings(allSettings)
.settings(
moduleName := "circe-generic-extras",
mimaPreviousArtifacts := Set("io.circe" %% "circe-generic-extras" % previousCirceGenericExtrasVersion),
mimaPreviousArtifacts := previousCirceGenericExtrasVersions.map("io.circe" %% "circe-generic-extras" % _),
libraryDependencies ++= Seq(
"io.circe" %%% "circe-generic" % circeVersion,
"io.circe" %%% "circe-literal" % circeVersion % Test,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,16 @@ class ConfiguredAutoDerivedSuite extends CirceSuite {

test("Field with default should fail to decode it type in json is not correct") {
val json = json"""{"b": 1}"""
assert(Decoder[FooWithDefault].decodeJson(json) === Left(DecodingFailure("String", List(DownField("b")))))
assert(
Decoder[FooWithDefault].decodeAccumulating(json.hcursor) === Validated.invalidNel(
DecodingFailure("String", List(DownField("b")))
assertEquals(
Decoder[FooWithDefault].decodeJson(json),
Left(
DecodingFailure(DecodingFailure.Reason.WrongTypeExpectation("string", Json.fromInt(1)), List(DownField("b")))
)
)
assertEquals(
Decoder[FooWithDefault].decodeAccumulating(json.hcursor),
Validated.invalidNel(
DecodingFailure(DecodingFailure.Reason.WrongTypeExpectation("string", Json.fromInt(1)), List(DownField("b")))
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ class UnwrappedSemiautoDerivedSuite extends CirceSuite {
property("it should fail decoding incompatible JSON") {
forAll { (i: Int, s: String) =>
val json = Json.fromInt(i)
val expected = Left(DecodingFailure("String", List()))
val expected = Left(DecodingFailure(DecodingFailure.Reason.WrongTypeExpectation("string", json), List()))

assert(Decoder[Foo].decodeJson(json) === expected)
assertEquals(Decoder[Foo].decodeJson(json), expected)
}
}
}
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.0.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.2")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
Expand Down

0 comments on commit 7bc60e2

Please sign in to comment.