Skip to content

Commit 57b2059

Browse files
authored
Fix #794 by updating zio-json to v0.7.6 (#795)
1 parent f8ec0dd commit 57b2059

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

project/BuildHelper.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ object BuildHelper {
3434
val Scala3: String = versions("3.3")
3535

3636
val zioVersion = "2.1.14"
37-
val zioJsonVersion = "0.7.5"
37+
val zioJsonVersion = "0.7.6"
3838
val zioPreludeVersion = "1.0.0-RC37"
3939
val zioOpticsVersion = "0.2.2"
4040
val zioBsonVersion = "1.0.6"

zio-schema-json/shared/src/test/scala/zio/schema/codec/JsonCodecSpec.scala

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,37 @@ object JsonCodecSpec extends ZIOSpecDefault {
11431143
charSequenceToByteChunk("""{"amount":1000, "type":"onetime"}""")
11441144
)
11451145
},
1146+
test("case name aliases - type in the last place and the content with an escaped string") {
1147+
@discriminatorName("type")
1148+
sealed trait Example {
1149+
type Content
1150+
def content: Content
1151+
}
1152+
1153+
object Example {
1154+
@caseName("JSON")
1155+
final case class JsonInput(content: String) extends Example {
1156+
override type Content = String
1157+
}
1158+
1159+
implicit val schema: Schema[Example] = DeriveSchema.gen
1160+
}
1161+
1162+
assertDecodes(
1163+
Example.schema,
1164+
Example.JsonInput(
1165+
""""{\n \"name\": \"John\",\"location\":\"Sydney\",\n \"email\": \"[email protected]\"\n}""""
1166+
),
1167+
charSequenceToByteChunk(
1168+
"""
1169+
|{
1170+
| "content": "\"{\\n \\\"name\\\": \\\"John\\\",\\\"location\\\":\\\"Sydney\\\",\\n \\\"email\\\": \\\"[email protected]\\\"\\n}\"",
1171+
| "type": "JSON"
1172+
|}
1173+
|""".stripMargin.trim
1174+
)
1175+
)
1176+
},
11461177
test("case name - illegal discriminator value") {
11471178
assertDecodesToError(
11481179
Subscription.schema,

0 commit comments

Comments
 (0)