Skip to content

Commit

Permalink
Update the docs for BSR availability
Browse files Browse the repository at this point in the history
  • Loading branch information
johanbrandhorst committed Feb 15, 2021
1 parent fb4ecf8 commit 42d135c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
39 changes: 27 additions & 12 deletions docs/docs/tutorials/adding_annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,6 @@ See [a_bit_of_everything.proto](https://github.com/grpc-ecosystem/grpc-gateway/b

Now that we've got the gRPC-Gateway annotations added to the proto file, we need to use the gRPC-Gateway generator to generate the stubs.

Before we can do that, we need to copy some dependencies into our proto file structure. Copy the `third_party/googleapis` folder from the gRPC-Gateway repository to your local proto file structure. It should look like this afterwards:

```
proto
├── google
│ └── api
│ ├── annotations.proto
│ └── http.proto
└── helloworld
└── hello_world.proto
```

### Using buf

We'll need to add the gRPC-Gateway generator to the generation configuration:
Expand All @@ -78,6 +66,20 @@ plugins:
opt: paths=source_relative
```
We'll also need to add the `googleapis` dependency to our `buf.yaml` file:

```yaml
version: v1beta1
name: buf.build/myuser/myrepo
deps:
- buf.build/beta/googleapis
build:
roots:
- proto
```

Then we need to run `buf beta mod update` to select a version of the dependency to use.

And that's it! Now if you run:

```sh
Expand All @@ -88,6 +90,19 @@ It should produce a `*.gw.pb.go` file.

### Using `protoc`

Before we can generate the stubs with `protoc`, we need to copy some dependencies into our proto file structure. Copy a subset of the `googleapis`
from the [official repository](https://github.com/googleapis/googleapis) to your local proto file structure. It should look like this afterwards:

```
proto
├── google
│ └── api
│ ├── annotations.proto
│ └── http.proto
└── helloworld
└── hello_world.proto
```

Now we need to add the gRPC-Gateway generator to the `protoc` invocation:

```sh
Expand Down
1 change: 1 addition & 0 deletions docs/docs/tutorials/generating_stubs/using_buf.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The following is an example of a valid configuration, assuming you have your `.p

```yaml
version: v1beta1
name: buf.build/myuser/myrepo
build:
roots:
- proto
Expand Down

0 comments on commit 42d135c

Please sign in to comment.