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

case class with dashes incorrectly deserialized #139

Open
maspwr opened this issue Feb 9, 2015 · 4 comments
Open

case class with dashes incorrectly deserialized #139

maspwr opened this issue Feb 9, 2015 · 4 comments
Labels

Comments

@maspwr
Copy link

maspwr commented Feb 9, 2015

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)
@sirthias sirthias added the Bug label Feb 10, 2015
@sirthias
Copy link
Member

Whoops, that looks like a bad bug!
Thanks for reporting! We will have to look into this.

@acceleratesage
Copy link

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]"

@jrudolph
Copy link
Member

@SimonAdameit interesting find. Have you looked for it at http://issues.scala-lang.org?

@jrudolph
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants