rules_oapi_codegen
provides Bazel rules for generating Go code from OpenAPI 3.0 definitions. It uses deepmap/oapi-codegen to provide this functionality.
Look at the Releases page for instructions on how to update your Bazel WORKSPACE
.
# In a BUILD.bazel file
load("@rules_oapi_codegen//oapi_codegen:def.bzl", "oapi_codegen_go")
oapi_codegen_go(
name = "api",
importpath = "<your import path>",
spec = "<your OpenAPI YAML file>",
visibility = ["//visibility:public"],
)
The example
directory provides the standard OpenAPI Petstore example, see the example/ README for more details.
Contribution guidelines can be found on our website.