Skip to content

Commit caa0928

Browse files
committed
Documentation updates
1 parent 9fd14ec commit caa0928

File tree

6 files changed

+87
-2
lines changed

6 files changed

+87
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![CI Workflow](https://github.com/Silicon-Ally/rules_oapi_codegen/actions/workflows/build.yml/badge.svg)](https://github.com/Silicon-Ally/rules_oapi_codegen/actions?query=branch%3Amain)
44

5-
`rules_oapi_codegen` provides [Bazel](https://bazel.build) rules for generating Go code from OpenAPI 3.0 definitions. It uses github.com/deepmap/oapi-codegen to provide this functionality.
5+
`rules_oapi_codegen` provides [Bazel](https://bazel.build) rules for generating Go code from OpenAPI 3.0 definitions. It uses [deepmap/oapi-codegen](https://github.com/deepmap/oapi-codegen) to provide this functionality.
66

77
## Usage
88

@@ -23,7 +23,7 @@ oapi_codegen_go(
2323

2424
## Example
2525

26-
The `example` directory provides [the standard Petstore example](https://github.com/OAI/OpenAPI-Specification/blob/main/examples/vv3.0/petstore.yaml), see [the example/ README](/example/README.md) for more details.
26+
The `example` directory provides [the standard OpenAPI Petstore example](https://github.com/OAI/OpenAPI-Specification/blob/main/examples/vv3.0/petstore.yaml), see [the example/ README](/example/README.md) for more details.
2727

2828
## Contributing
2929

docs/BUILD.bazel

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")
2+
3+
stardoc(
4+
name = "oapi_codegen",
5+
out = "oapi_codegen.md",
6+
input = "//oapi_codegen:def.bzl",
7+
deps = [
8+
"@io_bazel_rules_go//go:def",
9+
],
10+
)

docs/oapi_codegen.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
2+
3+
4+
5+
<a id="oapi_codegen_go"></a>
6+
7+
## oapi_codegen_go
8+
9+
<pre>
10+
oapi_codegen_go(<a href="#oapi_codegen_go-name">name</a>, <a href="#oapi_codegen_go-spec">spec</a>, <a href="#oapi_codegen_go-importpath">importpath</a>, <a href="#oapi_codegen_go-visibility">visibility</a>, <a href="#oapi_codegen_go-kwargs">kwargs</a>)
11+
</pre>
12+
13+
Generates Go bindings for an OpenAPI 3.0 spec.
14+
15+
This rule runs [oapi-codegen](https://github.com/deepmap/oapi-codegen) to
16+
produce a generated Go library providing, among other things, a strictly
17+
typed API stub interface to implement your API against.
18+
19+
20+
**PARAMETERS**
21+
22+
23+
| Name | Description | Default Value |
24+
| :------------- | :------------- | :------------- |
25+
| <a id="oapi_codegen_go-name"></a>name | A unique name for this rule. | none |
26+
| <a id="oapi_codegen_go-spec"></a>spec | The OpenAPI 3.0 YAML specification for your API, must be self-contained. | none |
27+
| <a id="oapi_codegen_go-importpath"></a>importpath | The importpath of the directory the rule is defined in, like 'github.com/&lt;org&gt;/&lt;repo&gt;/path/to/dir/api'. This is the import path of the generated Go library | none |
28+
| <a id="oapi_codegen_go-visibility"></a>visibility | The visibility of the generated go_library target. | none |
29+
| <a id="oapi_codegen_go-kwargs"></a>kwargs | <p align="center"> - </p> | none |
30+
31+

docs/release.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Cutting a new release
2+
3+
1. Submit all the code you want to be in the release.
4+
2. Create a new tag for the release with `git tag vX.Y.Z`
5+
- You can get the current latest tag with `git describe --tags --abbrev=0`
6+
3. Push the tag with `git push origin vX.Y.Z`
7+
4. Create an archive with `git archive --output=rules_oapi_codegen-vX.Y.Z.zip vX.Y.Z`
8+
5. Create the release with `gh release create vX.Y.Z rules_oapi_codegen-vX.Y.Z.zip --generate-notes`
9+
6. Get a SHA256 digest of the archive with `sha256sum rules_oapi_codegen-vX.Y.Z.zip`
10+
7. Update the description of the release, prepending the usage instructions.
11+
- They should look something like:
12+
````markdown
13+
# `WORKSPACE` code
14+
15+
```bazel
16+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
17+
18+
http_archive(
19+
name = "com_siliconally_rules_oapi_codegen",
20+
sha256 = "<sha256sum output>",
21+
urls = [
22+
"https://github.com/Silicon-Ally/rules_oapi_codegen/releases/download/vX.Y.Z/rules_oapi_codegen-vX.Y.Z.zip",
23+
],
24+
)
25+
```
26+
````
27+
28+
You're done! Congrats on the successful release.

oapi_codegen/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exports_files(["def.bzl"])

oapi_codegen/def.bzl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
load("@io_bazel_rules_go//go:def.bzl", "go_library")
22

33
def oapi_codegen_go(name, spec, importpath, visibility, **kwargs):
4+
"""Generates Go bindings for an OpenAPI 3.0 spec.
5+
6+
This rule runs [oapi-codegen](https://github.com/deepmap/oapi-codegen) to
7+
produce a generated Go library providing, among other things, a strictly
8+
typed API stub interface to implement your API against.
9+
10+
Args:
11+
name: A unique name for this rule.
12+
spec: The OpenAPI 3.0 YAML specification for your API, must be self-contained.
13+
importpath: The importpath of the directory the rule is defined in, like
14+
'github.com/<org>/<repo>/path/to/dir/api'. This is the import path of
15+
the generated Go library
16+
visibility: The visibility of the generated go_library target.
17+
"""
18+
419
codegen_args = {
520
"name": name,
621
"spec": spec,

0 commit comments

Comments
 (0)