{"id":19834479,"url":"https://github.com/guardrail-dev/sbt-guardrail","last_synced_at":"2026-03-08T08:33:58.863Z","repository":{"id":38353828,"uuid":"128263049","full_name":"guardrail-dev/sbt-guardrail","owner":"guardrail-dev","description":"Principled code generation from OpenAPI specifications","archived":false,"fork":false,"pushed_at":"2024-04-17T15:27:51.000Z","size":404,"stargazers_count":25,"open_issues_count":9,"forks_count":14,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-05-07T18:27:52.833Z","etag":null,"topics":["akka-http","codegen","dropwizard","guardrail","http4s","openapi","sbt-plugin","swagger"],"latest_commit_sha":null,"homepage":"https://guardrail.dev","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guardrail-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-04-05T20:53:07.000Z","updated_at":"2023-11-13T14:08:24.000Z","dependencies_parsed_at":"2023-02-19T10:00:30.015Z","dependency_job_id":"b5a1b489-9a44-47b3-8c93-3fac46b1c7da","html_url":"https://github.com/guardrail-dev/sbt-guardrail","commit_stats":null,"previous_names":[],"tags_count":93,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guardrail-dev%2Fsbt-guardrail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guardrail-dev%2Fsbt-guardrail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guardrail-dev%2Fsbt-guardrail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guardrail-dev%2Fsbt-guardrail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guardrail-dev","download_url":"https://codeload.github.com/guardrail-dev/sbt-guardrail/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224270309,"owners_count":17283649,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["akka-http","codegen","dropwizard","guardrail","http4s","openapi","sbt-plugin","swagger"],"created_at":"2024-11-12T12:04:52.846Z","updated_at":"2026-03-08T08:33:58.857Z","avatar_url":"https://github.com/guardrail-dev.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"sbt-guardrail [![sbt-guardrail](https://maven-badges.herokuapp.com/maven-central/dev.guardrail/sbt-guardrail/badge.svg)](https://search.maven.org/search?q=g:dev.guardrail%20a:sbt-guardrail) | [![Join the chat at https://gitter.im/guardrail-dev/guardrail](https://badges.gitter.im/guardrail-dev/guardrail.svg)](https://gitter.im/guardrail-dev/guardrail?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n=============\n\n\nAn SBT plugin for adding clients and servers generated by [guardrail](https://github.com/guardrail-dev/guardrail) to your service.\n\nInstallation\n------------\n\nCheck out the [docs](https://github.com/guardrail-dev/guardrail/blob/master/docs/plugins/sbt.md)\n\n### `project/plugins.sbt`\n```\naddSbtPlugin(\"dev.guardrail\" % \"sbt-guardrail\" % \"\u003cPlease use the latest available release!\u003e\")\n```\n\n### `build.sbt`\n```scala\n/* Available arguments:\n    specPath: java.io.File\n    pkg: String\n    dto: String\n    framework: String\n    modules: List[String]\n    tracing: Boolean\n    imports: List[String]\n    encodeOptionalAs: Option[CodingConfig]\n    decodeOptionalAs: Option[CodingConfig]\n*/\nguardrailTasks in Compile := List(\n  ScalaClient(file(\"petstore.yaml\")),\n  ScalaClient(file(\"github.yaml\"), pkg=\"com.example.clients.github\"),\n  ScalaClient(file(\"github.yaml\"), pkg=\"com.example.clients.github\", \n              encodeOptionalAs = codingOptional,\n              decodeOptionalAs = codingRequiredNullable),\n  ScalaServer(file(\"myserver.yaml\"), pkg=\"com.example.server\", tracing=true),\n  ScalaModels(file(\"myserver.yaml\"), pkg=\"com.example.models\"),\n  JavaClient(file(\"github.yaml\"), pkg=\"com.example.clients.github\")\n  ...\n)\n```\nAlternatively use the `guardrailDiscoveredOpenApiFiles` setting to automatically discover OpenAPI spec files under `src/main/openapi` or `src/test/openapi` (see the [test for full example](src/sbt-test/sbt-guardrail/scala-client-codegen-app/build.sbt)):\n```scala\nCompile / guardrailTasks := (Compile / guardrailDiscoveredOpenApiFiles).value.flatMap { openApiFile =\u003e\n  List(          \n    ScalaClient(openApiFile.file, pkg = openApiFile.pkg, framework = \"http4s\"),\n    ScalaServer(openApiFile.file, pkg = openApiFile.pkg, framework = \"http4s\")\n  )\n}\n```\nFormatting generated sources with scalafmt:\n```\nCompile / scalafmt / unmanagedSources ++= (Compile / guardrail).value\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguardrail-dev%2Fsbt-guardrail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguardrail-dev%2Fsbt-guardrail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguardrail-dev%2Fsbt-guardrail/lists"}