Skip to content

Instantly share code, notes, and snippets.

@crakjie
Created September 30, 2015 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crakjie/92138a2c685fb544cc28 to your computer and use it in GitHub Desktop.
Save crakjie/92138a2c685fb544cc28 to your computer and use it in GitHub Desktop.
circe 0.2.0-SNAPSHOT derivation not working
//Build.sbt
import _root_.sbt.Credentials
import _root_.sbt.Keys._
import _root_.sbt.Resolver
name := "circe-case-class-test"
version := "1.0"
scalaVersion := "2.11.7"
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
libraryDependencies ++= {
//
Seq(
"io.circe" %% "circe-core" % "0.2.0-SNAPSHOT",
"io.circe" %% "circe-generic" % "0.2.0-SNAPSHOT",
"io.circe" %% "circe-jawn" % "0.2.0-SNAPSHOT"
)
}
//Test.scala
case class Test( a : String,
b : String,
c : String,
d : String,
e : String,
f : String,
g : String,
h: String,
i: String,
j: String,
k: String,
l: String,
m: Double,
o: Double,
p: Int,
q: Long,
r: Option[String],
s:String,
t:Option[String],
u:Option[String],
v:Option[String],
w:Option[String],
x:Option[String],
y:Option[String],
z:Option[String],
a_a:Option[String],
a_b:Option[String],
a_c:Option[String],
a_d : Option[String],
a_e: Option[String],
a_f: Option[String],
a_g: Option[String],
a_h: Option[String],
a_i: Option[String],
a_j: Option[String],
a_k: Option[String],
a_l: Option[String],
a_m: Option[String],
a_o: Option[String],
a_p: Option[String],
a_r: Option[String], //comment after this one it's work
a_s: Option[String], //comment after this one, just the decoder is not found
a_t: Option[String],
a_u: Option[String],
a_v: Option[String],
a_w: Option[String],
a_x: Option[String],
a_y : Option[String],
a_z : String,
b_a: Option[String],
b_b : Option[String],
b_c: String,
b_d: String,
b_e: String,
b_f: String,
b_g : String,
//b_h : Map[String,String],
b_i : Long,
b_j : Option[String],
b_k : Option[String]
)
object Test {
import io.circe._
import io.circe.syntax._
import io.circe.generic.auto._
implicit val jsonEncoder = Encoder[Test]
implicit val jsonDecoder = Decoder[Test]
}
/* The error message
~/Workspace/circe-case-class-test $ sbt clean compile
[info] Loading project definition from /Users/cx/Workspace/circe-case-class-test/project
[info] Set current project to circe-case-class-test (in build file:/Users/cx/Workspace/circe-case-class-test/)
[success] Total time: 0 s, completed 30 sept. 2015 10:15:45
[info] Updating {file:/Users/cx/Workspace/circe-case-class-test/}circe-case-class-test...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/cx/Workspace/circe-case-class-test/target/scala-2.11/classes...
[error] /Users/cx/Workspace/circe-case-class-test/src/main/scala/Test.scala:72: could not find implicit value for parameter e: io.circe.Encoder[Test]
[error] implicit val jsonEncoder = Encoder[Test]
[error] ^
[error] /Users/cx/Workspace/circe-case-class-test/src/main/scala/Test.scala:73: could not find implicit value for parameter d: io.circe.Decoder[Test]
[error] implicit val jsonDecoder = Decoder[Test]
[error] ^
[error] two errors found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 19 s, completed 30 sept. 2015 10:16:04
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment