Skip to content

Commit

Permalink
Merge pull request #57 from commercetools/cut-1279-fix-method-too-large
Browse files Browse the repository at this point in the history
Using lazy val to prevent method too large errors
  • Loading branch information
martinw-ct authored Jul 16, 2024
2 parents df86985 + 3da7713 commit 5bbb9b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/scraml/libs/TapirSupport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ final class TapirSupport(endpointsObjectName: String) extends LibrarySupport {

val endpointValueDef: Defn.Val =
q"""
val ${Pat.Var(Term.Name(resourceMethodName))} = $endpointWithErrorOut
lazy val ${Pat.Var(Term.Name(resourceMethodName))} = $endpointWithErrorOut
"""

List(
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/scraml/libs/TapirSupportSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ final class TapirSupportSpec
| object Endpoints {
| object Greeting {
| final case class GetGreetingParams(enum_type: SomeEnum, name: Option[String] = None)
| val getGreeting = endpoint.get.in("greeting").in(query[SomeEnum]("enum_type") and query[Option[String]]("name")).mapInTo[GetGreetingParams].out(jsonBody[DataType])
| lazy val getGreeting = endpoint.get.in("greeting").in(query[SomeEnum]("enum_type") and query[Option[String]]("name")).mapInTo[GetGreetingParams].out(jsonBody[DataType])
| }
| }
|}""".stripMargin
Expand Down Expand Up @@ -193,7 +193,7 @@ final class TapirSupportSpec
| object Endpoints {
| object Greeting {
| final case class GetGreetingByPreambleAndDelayParams(preamble: Preamble, delay: Int, name: Option[String] = None, repeat: Option[Int] = None, uppercase: Option[Boolean] = None)
| val getGreetingByPreambleAndDelay = endpoint.get.in("greeting" / path[Preamble]("preamble") / path[Int]("delay")).in(query[Option[String]]("name") and query[Option[Int]]("repeat") and query[Option[Boolean]]("uppercase")).mapInTo[GetGreetingByPreambleAndDelayParams].out(jsonBody[DataType])
| lazy val getGreetingByPreambleAndDelay = endpoint.get.in("greeting" / path[Preamble]("preamble") / path[Int]("delay")).in(query[Option[String]]("name") and query[Option[Int]]("repeat") and query[Option[Boolean]]("uppercase")).mapInTo[GetGreetingByPreambleAndDelayParams].out(jsonBody[DataType])
| }
| }
|}""".stripMargin.stripTrailingSpaces
Expand Down

0 comments on commit 5bbb9b2

Please sign in to comment.