{"id":30432868,"url":"https://github.com/jaqx0r/rules_oapi_codegen","last_synced_at":"2026-05-10T05:01:57.988Z","repository":{"id":311108467,"uuid":"1042495484","full_name":"jaqx0r/rules_oapi_codegen","owner":"jaqx0r","description":"Bazel rules for generating API service handlers with `oapi-codegen`.","archived":false,"fork":false,"pushed_at":"2025-08-22T07:17:59.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-22T07:28:12.768Z","etag":null,"topics":["bazel","oapi-codegen","openapi","rules","yaml"],"latest_commit_sha":null,"homepage":"","language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaqx0r.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-22T05:34:49.000Z","updated_at":"2025-08-22T07:18:02.000Z","dependencies_parsed_at":"2025-08-22T07:28:32.579Z","dependency_job_id":"25f6cede-79a9-4a48-8ae3-3dafe88aad97","html_url":"https://github.com/jaqx0r/rules_oapi_codegen","commit_stats":null,"previous_names":["jaqx0r/rules_oapi_codegen"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/jaqx0r/rules_oapi_codegen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaqx0r%2Frules_oapi_codegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaqx0r%2Frules_oapi_codegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaqx0r%2Frules_oapi_codegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaqx0r%2Frules_oapi_codegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaqx0r","download_url":"https://codeload.github.com/jaqx0r/rules_oapi_codegen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaqx0r%2Frules_oapi_codegen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271704296,"owners_count":24806536,"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","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bazel","oapi-codegen","openapi","rules","yaml"],"created_at":"2025-08-22T21:38:48.247Z","updated_at":"2026-05-10T05:01:52.935Z","avatar_url":"https://github.com/jaqx0r.png","language":"Starlark","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rules_oapi_codegen\n\nBazel rules for generating API service handlers from OpenAPI yaml with [`oapi-codegen`](https://github.com/oapi-codegen/oapi-codegen).\n\n## Rules\n\n### `oapi_codegen`\n\n```starlark\nload(\"@rules_oapi_codegen//:defs.bzl\", \"oapi_codegen\")\n\noapi_codegen(\n  name = \"generate_api_handler\",\n  src = \"api.yaml\",\n  generate = \"gin\", # your server framework of choice\n  out = \"api.go\",\n  strict = True,  # default is True\n  models = True,  # default is True\n)\n```\n\n`oapi_codegen` invokes the `oapi-codegen` binary on your source openapi yaml description, generating a service handler for that specification into the output file.\n\nThe generated file is not scanned for imports by `bazel run @rules_go//go -- mod tidy` nor `bazel run //:gazelle` so you will have to manually copy the imports from your generated file once:\n\n  1. ```shell\n     bazel build //:generate_api_handler\n     ```\n\n  2. Inspect the output in `bazel-bin/api.go`\n\n  3. Create an import-only file:\n     ```go\n     package api\n\n     import (\n       _ \"github.com/gin/gin-gonic\"\n       ... etc\n     )\n     ```\n\n  4. Add the import-only source file to your BUILD rule and run `mod tidy` and `gazelle`.\n\nThe bug this workaround addresses is tracked in https://github.com/bazel-contrib/bazel-gazelle/issues/1801\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaqx0r%2Frules_oapi_codegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaqx0r%2Frules_oapi_codegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaqx0r%2Frules_oapi_codegen/lists"}