All Projects → twilio → Sbt Guardrail

twilio / Sbt Guardrail

Licence: mit
Principled code generation for Scala services

Programming Languages

scala
5932 projects

sbt-guardrail

An SBT 1.x+ plugin for adding clients and servers generated by guardrail to your service.

Installation

project/plugins.sbt

addSbtPlugin("com.twilio" % "sbt-guardrail" % "<Please use the latest available release!>")

build.sbt

/* Available arguments:
    specPath: java.io.File
    pkg: String
    dto: String
    framework: String
    modules: List[String]
    tracing: Boolean
    imports: List[String]
    encodeOptionalAs: Option[CodingConfig]
    decodeOptionalAs: Option[CodingConfig]
*/
guardrailTasks in Compile := List(
  ScalaClient(file("petstore.yaml")),
  ScalaClient(file("github.yaml"), pkg="com.example.clients.github"),
  ScalaClient(file("github.yaml"), pkg="com.example.clients.github", 
              encodeOptionalAs = codingOptional,
              decodeOptionalAs = codingRequiredNullable),
  ScalaServer(file("myserver.yaml"), pkg="com.example.server", tracing=true),
  ScalaModels(file("myserver.yaml"), pkg="com.example.models"),
  JavaClient(file("github.yaml"), pkg="com.example.clients.github")
  ...
)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].