aboutsummaryrefslogtreecommitdiff
path: root/shared/src/test/scala/CoproductTypeFormatTests.scala
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2018-08-02 15:42:22 -0700
committerJakob Odersky <jakob@odersky.com>2018-08-02 16:04:39 -0700
commit37ad3c66baa2df36594277022dcf68fa8d4fff26 (patch)
tree7cc7c80f0c94a67b5c6078cbe8bdb1759d57e472 /shared/src/test/scala/CoproductTypeFormatTests.scala
parent20afa757f499688b56cbd6b8571014b75d6d4dce (diff)
downloadspray-json-derivation-37ad3c66baa2df36594277022dcf68fa8d4fff26.tar.gz
spray-json-derivation-37ad3c66baa2df36594277022dcf68fa8d4fff26.tar.bz2
spray-json-derivation-37ad3c66baa2df36594277022dcf68fa8d4fff26.zip
Rename default type field to '@type'
Diffstat (limited to 'shared/src/test/scala/CoproductTypeFormatTests.scala')
-rw-r--r--shared/src/test/scala/CoproductTypeFormatTests.scala16
1 files changed, 8 insertions, 8 deletions
diff --git a/shared/src/test/scala/CoproductTypeFormatTests.scala b/shared/src/test/scala/CoproductTypeFormatTests.scala
index 7da2041..5e88856 100644
--- a/shared/src/test/scala/CoproductTypeFormatTests.scala
+++ b/shared/src/test/scala/CoproductTypeFormatTests.scala
@@ -18,33 +18,33 @@ class CoproductTypeFormatTests
"No-parameter case class child" should behave like checkRoundtrip[Expr](
Zero(),
- """{"type":"Zero"}"""
+ """{"@type":"Zero"}"""
)
"Simple parameter case class child" should behave like checkRoundtrip[Expr](
Value(42),
- """{"type":"Value","x":42}"""
+ """{"@type":"Value","x":42}"""
)
"Nested parameter case class child" should behave like checkRoundtrip[Expr](
Plus(Value(42), One),
- """{"type":"Plus","lhs":{"type":"Value","x":42},"rhs":{"type":"One"}}"""
+ """{"@type":"Plus","lhs":{"@type":"Value","x":42},"rhs":{"@type":"One"}}"""
)
"Case object child" should behave like checkRoundtrip[Expr](
One,
- """{"type": "One"}"""
+ """{"@type": "One"}"""
)
@adt("kind")
- sealed abstract class Keyword(`type`: String)
- case class If(`type`: String) extends Keyword(`type`)
+ sealed abstract class Keyword(`@type`: String)
+ case class If(`@type`: String) extends Keyword(`@type`)
implicit val keywordFormat: RootJsonFormat[Keyword] = jsonFormat[Keyword]
"ADT with type field alias" should behave like checkRoundtrip[Keyword](
If("class"),
- """{"kind":"If","type":"class"}"""
+ """{"kind":"If","@type":"class"}"""
)
@adt("""_`crazy type!`"""")
@@ -68,7 +68,7 @@ class CoproductTypeFormatTests
"Enum" should behave like checkRoundtrip[List[Enum]](
A :: B :: Nil,
- """[{"type":"A"}, {"type":"B"}]"""
+ """[{"@type":"A"}, {"@type":"B"}]"""
)
"Serializing as sealed trait and deserializing as child" should "work" in {