case class with dashes incorrectly deserialized
I'm actually not sure what is going on here yet, but it appears as though vals with matching prefixes get deserialized in an incorrect order.
scala> case class Foo(bar: String, dummy: String, `bar-extension`: String)
defined class Foo
scala> implicit val fooFormat: JsonFormat[Foo] = jsonFormat3(Foo)
fooFormat: spray.json.JsonFormat[Foo] = spray.json.ProductFormatsInstances$$anon$3@3e219936
scala> val fooString = """{"bar": "param1", "dummy": "param2", "bar-extension": "param3"}"""
fooString: String = {"bar": "param1", "dummy": "param2", "bar-extension": "param3"}
scala> fooString.parseJson.convertTo[Foo]
res7: Foo = Foo(param1,param3,param2)
Whoops, that looks like a bad bug! Thanks for reporting! We will have to look into this.
This seems to be a scala bug.
case class Data(a: String, b: String, `a-some`: String)
val m = Data("1", "2", "3")
assert(m.productIterator.mkString(", ") == "1, 2, 3")
Result: "1, [3, 2]" did not equal "1, [2, 3]"
@SimonAdameit interesting find. Have you looked for it at http://issues.scala-lang.org?
Thanks, @SimonAdameit for raising this on the Scala mailing. FTR here is the Scala issue and the ML post:
https://issues.scala-lang.org/browse/SI-8831 https://groups.google.com/d/topic/scala-language/vDhcDEF2Rtw/discussion