Skip to content

Commit

Permalink
Fix #794 by updating zio-json to v0.7.6 (#795)
Browse files Browse the repository at this point in the history
  • Loading branch information
plokhotnyuk authored Jan 24, 2025
1 parent f8ec0dd commit 57b2059
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion project/BuildHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object BuildHelper {
val Scala3: String = versions("3.3")

val zioVersion = "2.1.14"
val zioJsonVersion = "0.7.5"
val zioJsonVersion = "0.7.6"
val zioPreludeVersion = "1.0.0-RC37"
val zioOpticsVersion = "0.2.2"
val zioBsonVersion = "1.0.6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,37 @@ object JsonCodecSpec extends ZIOSpecDefault {
charSequenceToByteChunk("""{"amount":1000, "type":"onetime"}""")
)
},
test("case name aliases - type in the last place and the content with an escaped string") {
@discriminatorName("type")
sealed trait Example {
type Content
def content: Content
}

object Example {
@caseName("JSON")
final case class JsonInput(content: String) extends Example {
override type Content = String
}

implicit val schema: Schema[Example] = DeriveSchema.gen
}

assertDecodes(
Example.schema,
Example.JsonInput(
""""{\n \"name\": \"John\",\"location\":\"Sydney\",\n \"email\": \"[email protected]\"\n}""""
),
charSequenceToByteChunk(
"""
|{
| "content": "\"{\\n \\\"name\\\": \\\"John\\\",\\\"location\\\":\\\"Sydney\\\",\\n \\\"email\\\": \\\"[email protected]\\\"\\n}\"",
| "type": "JSON"
|}
|""".stripMargin.trim
)
)
},
test("case name - illegal discriminator value") {
assertDecodesToError(
Subscription.schema,
Expand Down

0 comments on commit 57b2059

Please sign in to comment.