Skip to content

Commit

Permalink
Maybe fix codegen-sbt
Browse files Browse the repository at this point in the history
  • Loading branch information
jeejeeone committed Mar 21, 2024
1 parent 77ca4c2 commit 6999c9d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ sealed trait CalibanSettings {
final def preserveInputNames(value: Boolean): Self = withSettings(_.preserveInputNames(value))
final def addDerives(value: Boolean): Self = withSettings(_.addDerives(value))
final def envForDerives(value: String): Self = withSettings(_.envForDerives(value))
final def excludeDeprecated(value: Boolean): Self = withSettings(_.excludeDeprecated(value))
}

final case class CalibanFileSettings(file: File, settings: CalibanCommonSettings) extends CalibanSettings {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ object OptionsParser {
preserveInputNames: Option[Boolean],
supportIsRepeatable: Option[Boolean],
addDerives: Option[Boolean],
envForDerives: Option[String]
envForDerives: Option[String],
excludeDeprecated: Option[Boolean]
)

private object DescriptorUtils {
Expand Down Expand Up @@ -74,7 +75,8 @@ object OptionsParser {
rawOpts.preserveInputNames,
rawOpts.supportIsRepeatable,
rawOpts.addDerives,
rawOpts.envForDerives
rawOpts.envForDerives,
rawOpts.excludeDeprecated
)
}.option
case _ => ZIO.none
Expand Down
44 changes: 44 additions & 0 deletions codegen-sbt/src/test/scala/caliban/codegen/OptionsParserSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ object OptionsParserSpec extends ZIOSpecDefault {
None,
None,
None,
None,
None
)
)
Expand Down Expand Up @@ -59,6 +60,7 @@ object OptionsParserSpec extends ZIOSpecDefault {
None,
None,
None,
None,
None
)
)
Expand Down Expand Up @@ -89,6 +91,7 @@ object OptionsParserSpec extends ZIOSpecDefault {
None,
None,
None,
None,
None
)
)
Expand Down Expand Up @@ -137,6 +140,7 @@ object OptionsParserSpec extends ZIOSpecDefault {
None,
None,
None,
None,
None
)
)
Expand Down Expand Up @@ -167,6 +171,7 @@ object OptionsParserSpec extends ZIOSpecDefault {
None,
None,
None,
None,
None
)
)
Expand Down Expand Up @@ -197,6 +202,7 @@ object OptionsParserSpec extends ZIOSpecDefault {
None,
None,
None,
None,
None
)
)
Expand Down Expand Up @@ -227,6 +233,7 @@ object OptionsParserSpec extends ZIOSpecDefault {
None,
None,
None,
None,
None
)
)
Expand Down Expand Up @@ -257,6 +264,7 @@ object OptionsParserSpec extends ZIOSpecDefault {
None,
None,
None,
None,
None
)
)
Expand Down Expand Up @@ -287,6 +295,7 @@ object OptionsParserSpec extends ZIOSpecDefault {
None,
None,
None,
None,
None
)
)
Expand Down Expand Up @@ -317,6 +326,7 @@ object OptionsParserSpec extends ZIOSpecDefault {
None,
None,
None,
None,
None
)
)
Expand Down Expand Up @@ -347,6 +357,7 @@ object OptionsParserSpec extends ZIOSpecDefault {
None,
None,
None,
None,
None
)
)
Expand Down Expand Up @@ -377,6 +388,7 @@ object OptionsParserSpec extends ZIOSpecDefault {
Some(true),
None,
None,
None,
None
)
)
Expand Down Expand Up @@ -407,11 +419,43 @@ object OptionsParserSpec extends ZIOSpecDefault {
None,
None,
None,
None,
None
)
)
)
}
},
test("provide excludeDeprecated") {
val input = List("schema", "output", "--excludeDeprecated", "true")
OptionsParser.fromArgs(input).map { result =>
assertTrue(
result ==
Some(
Options(
"schema",
"output",
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Some(true)
)
)
)
}
}
)
}

0 comments on commit 6999c9d

Please sign in to comment.