diff --git a/tools/src/main/scala/caliban/tools/ClientWriter.scala b/tools/src/main/scala/caliban/tools/ClientWriter.scala index cb3a1ef8f..96faa42b5 100644 --- a/tools/src/main/scala/caliban/tools/ClientWriter.scala +++ b/tools/src/main/scala/caliban/tools/ClientWriter.scala @@ -185,7 +185,7 @@ object ClientWriter { ( s"[$typeLetter]", s"(${unionTypes.map(t => s"""on${t.name}: Option[SelectionBuilder[${safeTypeName(t.name)}, $typeLetter]] = None""").mkString(", ")})", - s"Option[${writeType(field.ofType).replace(fieldType, typeLetter)}]", + s"${writeType(field.ofType).replace(fieldType, s"Option[$typeLetter]")}", writeTypeBuilder( field.ofType, s"ChoiceOf(Map(${unionTypes.map(t => s""""${t.name}" -> on${t.name}.fold[FieldBuilder[Option[A]]](NullField)(a => OptionOf(Obj(a)))""").mkString(", ")}))" @@ -214,7 +214,7 @@ object ClientWriter { ( s"[$typeLetter]", s"(${interfaceTypes.map(t => s"""on${t.name}: Option[SelectionBuilder[${safeTypeName(t.name)}, $typeLetter]] = None""").mkString(", ")})", - s"Option[${writeType(field.ofType).replace(fieldType, typeLetter)}]", + s"${writeType(field.ofType).replace(fieldType, s"Option[$typeLetter]")}", writeTypeBuilder( field.ofType, s"ChoiceOf(Map(${interfaceTypes.map(t => s""""${t.name}" -> on${t.name}.fold[FieldBuilder[Option[A]]](NullField)(a => OptionOf(Obj(a)))""").mkString(", ")}))" diff --git a/tools/src/test/scala/caliban/tools/ClientWriterSpec.scala b/tools/src/test/scala/caliban/tools/ClientWriterSpec.scala index d760a4c75..b8b0c144e 100644 --- a/tools/src/test/scala/caliban/tools/ClientWriterSpec.scala +++ b/tools/src/test/scala/caliban/tools/ClientWriterSpec.scala @@ -1,7 +1,7 @@ package caliban.tools import caliban.parsing.Parser -import zio.{ RIO, UIO } +import zio.RIO import zio.blocking.Blocking import zio.test.Assertion._ import zio.test._ @@ -948,7 +948,7 @@ object Client { def ordersOption[A]( onAscending: Option[SelectionBuilder[Ascending, A]] = None, onDescending: Option[SelectionBuilder[Descending, A]] = None - ): SelectionBuilder[Sort, Option[Option[List[Option[A]]]]] = _root_.caliban.client.SelectionBuilder.Field( + ): SelectionBuilder[Sort, Option[List[Option[Option[A]]]]] = _root_.caliban.client.SelectionBuilder.Field( "orders", OptionOf( ListOf(