Skip to content

Latest commit

 

History

History
22 lines (17 loc) · 1.38 KB

sbt.md

File metadata and controls

22 lines (17 loc) · 1.38 KB

SBT

The guardrail-dev/sbt-guardrail plugin installation instructions can be found in that project's README.

By putting the following in your build.sbt, generated classes for petstore and github clients and myserver server routes are available the next time the compile or guardrail tasks are run. The motivation for generating servers in your test sources is to facilitate generating "real" mock downstream servers.

Compile / guardrailTasks := List(
  ScalaClient(file("petstore.yaml")),
  ScalaClient(file("github.yaml"), pkg="com.example.clients.github"),
  ScalaServer(file("myserver.yaml"), pkg="com.example.server", tracing=true)
)

Test / guardrailTasks := List(
  ScalaServer(file("petstore.yaml")),
  ScalaServer(file("github.yaml"), pkg="com.example.tests.github"),
  ScalaClient(file("myserver.yaml"), pkg="com.example.tests.server", tracing=true)
)

For the curious, generated sources end up in target/scala-2.12/src_managed/. These will be overwritten every time compile runs, so modification is not possible. If you find the generated source does not fit your needs, please see the section on guardrail-specific extensions in the documentation.