Skip to content

Commit

Permalink
give test CaseClassInner two generic parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
charlibot committed May 11, 2022
1 parent 43eee84 commit bc8d44f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ final class GenericDerivationCodecSpec extends CodecBase {
}

it("should support case classes with nested generic case classes and include the types in the schema name") {
assertSchemaIs[CaseClassTypeParameterField[CaseClassInner[Int]]] {
"""{"type":"record","name":"CaseClassTypeParameterField__CaseClassInner__Int","namespace":"vulcan.generic.examples","fields":[{"name":"s","type":"string"},{"name":"value","type":{"type":"record","name":"CaseClassInner__Int","fields":[{"name":"inner","type":"int"}]}}]}"""
assertSchemaIs[CaseClassTypeParameterField[CaseClassInner[Int, Long]]] {
"""{"type":"record","name":"CaseClassTypeParameterField__CaseClassInner__Int_Long","namespace":"vulcan.generic.examples","fields":[{"name":"s","type":"string"},{"name":"value","type":{"type":"record","name":"CaseClassInner__Int_Long","fields":[{"name":"inner1","type":"int"},{"name":"inner2","type":"long"}]}}]}"""
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import vulcan.Codec
import vulcan.generic._

final case class CaseClassTypeParameterField[T](s: String, value: T)
final case class CaseClassInner[T](inner: T)
final case class CaseClassInner[T, S](inner1: T, inner2: S)

object CaseClassTypeParameterField {
implicit val configuration: Configuration = avro4s.avro4sGenericConfiguration
Expand All @@ -18,10 +18,10 @@ object CaseClassTypeParameterField {
implicit val longCodec: Codec[CaseClassTypeParameterField[Long]] =
Codec.derive

implicit val innerIntCodec: Codec[CaseClassInner[Int]] =
implicit val innerIntCodec: Codec[CaseClassInner[Int, Long]] =
Codec.derive

implicit val withInnerIntCodec: Codec[CaseClassTypeParameterField[CaseClassInner[Int]]] =
implicit val withInnerIntCodec: Codec[CaseClassTypeParameterField[CaseClassInner[Int, Long]]] =
Codec.derive

implicit val caseClassTypeParameterFieldArbitrary: Arbitrary[CaseClassTypeParameterField[Int]] =
Expand Down

0 comments on commit bc8d44f

Please sign in to comment.