Skip to content

Commit

Permalink
Don't write null for empty option fields of generic records (#728)
Browse files Browse the repository at this point in the history
  • Loading branch information
987Nabil authored Aug 14, 2024
1 parent ce3a315 commit ce8cca1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ object JsonCodec {

val isEmptyCollection = value match {
case _: Iterable[_] => value.asInstanceOf[Iterable[_]].isEmpty
case None => true
case _ => false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ object JsonCodecSpec extends ZIOSpecDefault {
RecordExample.schema.annotate(rejectExtraFields()),
RecordExample(f1 = Some("test"), f3 = Some("transient")),
charSequenceToByteChunk(
"""{"$f1":"test","f2":null,"f4":null,"f5":null,"f6":null,"f7":null,"f8":null,"f9":null,"f10":null,"f11":null,"f12":null,"f13":null,"f14":null,"f15":null,"f16":null,"f17":null,"f18":null,"f19":null,"f20":null,"f21":null,"f22":null,"$f23":null}""".stripMargin
"""{"$f1":"test"}""".stripMargin
)
)
}
Expand Down

0 comments on commit ce8cca1

Please sign in to comment.