Principled code generation from OpenAPI specifications. https://guardrail.dev/
github-actions[bot] on scala-akka-http-v0.74.0
github-actions[bot] on scala-http4s-v0.74.0
github-actions[bot] on scala-support-v0.74.0
blast-hardcheese on master
Fixup to the last PR, refined w… Temporarily removing Build.scal… Merge pull request #1509 from b… (compare)
blast-hardcheese on master
refined types Removing extraneous validation … a separate module for circe-ref… and 3 more (compare)
<modules><module><name>http4s</name><clientClass>dev.guardrail.generators.ScalaGenerator.Http4sClientGenerator.ClientTermInterp</clientClass>...
where the fqcn's are able to be specified (with sensible defaults) in the pom.xml, and so long as the codegen phase has those dependencies on the classpath everything comes together
circe-java8
could be spun out without just hanging on in the core forever
+val myCustomHttp4sThing = modules.http4s.client.copy(
+ newGetExtraImports={ tracingEnabled =>
+ import scala.meta._
+ dev.guardrail.Target.pure(List(q"import dev.guardrail.example"))
+ }
+)
lazy val exampleClient = (project in file("example-client"))
.settings(commonSettings)
.settings(
- Compile / guardrailTasks += ScalaClient(file("server.yaml"), pkg="example.client", framework="http4s"),
+ Compile / guardrailTasks += ScalaClient(file("server.yaml"), pkg="example.client", framework="http4s").modules(myCustomHttp4sThing, _.circe.json),
libraryDependencies ++= commonDependencies
)
So i'm working on upgrading an older service onto the latest version of guardrail. One of the generated clients in particular seems to trip up the compiler complaining about unused imports for AkkaHttpImplicits.scala and Implicits.scala, but when compared to a seemingly similar client with the same code-gen created for those file. There aren't any warnings.
I know i could just surpress the warnings, but i'm more confused as to how one client is fine, but the other triggers warnings
x-jvm-type: ...
, since it gives the capability to use absolutely anything that's supported either by guardrail internally or by your own extensions, so there's no guarantee which imports would be used or not.
scalacOptions ++= Seq(
"-Wconf:src=src_managed/.*:silent",
)
<arg>-Xlint:-unused,_</arg>
-Wconf:src
, since we actually know exactly which directories we generated into
-Xlint:-unused,_
for -Wconf:src:...
, that would be a step in the right direction