Skip to content

Commit 576e364

Browse files
author
Roman Janusz
committed
GenCodec for Either declares size as 1
1 parent 4b7fc47 commit 576e364

File tree

1 file changed

+6
-3
lines changed
  • commons-core/src/main/scala/com/avsystem/commons/serialization

1 file changed

+6
-3
lines changed

commons-core/src/main/scala/com/avsystem/commons/serialization/GenCodec.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -622,9 +622,12 @@ object GenCodec extends RecursiveAutoCodecs with TupleGenCodecs {
622622
case name => throw new ReadFailure(s"Expected field 'Left' or 'Right', got $name")
623623
}
624624
},
625-
(oo, v) => v match {
626-
case Left(a) => write[A](oo.writeField("Left"), a)
627-
case Right(b) => write[B](oo.writeField("Right"), b)
625+
(oo, v) => {
626+
oo.declareSize(1)
627+
v match {
628+
case Left(a) => write[A](oo.writeField("Left"), a)
629+
case Right(b) => write[B](oo.writeField("Right"), b)
630+
}
628631
}
629632
)
630633

0 commit comments

Comments
 (0)