Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buf version bump #3189

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ docker run -itv $(pwd):/grpc-gateway -w /grpc-gateway --entrypoint /bin/bash --r
bazel run :buildifier'
```

You may need to authenticate with GitHub to pull `ghcr.io/grpc-ecosystem/grpc-gateway/build-env`.
You can do this by following the steps on the [GitHub Package docs](https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages#authenticating-to-github-packages).
You may need to authenticate with GitHub to pull `docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env`.
You can do this by following the steps on the [GitHub Package docs](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry).

### Using Visual Studio Code dev containers

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ $(GENERATE_UNBOUND_METHODS_EXAMPLE_SRCS): $(GENERATE_UNBOUND_METHODS_EXAMPLE_SPE
$(EXAMPLE_CLIENT_DIR)/generateunboundmethods/git_push.sh

install:
go install github.com/bufbuild/buf/cmd/buf@v1.3.1
go install github.com/bufbuild/buf/cmd/buf@v1.14.0
go install \
./protoc-gen-openapiv2 \
./protoc-gen-grpc-gateway
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ Alternatively, see the section on remotely managed plugin versions below.
```yaml
version: v1
plugins:
- name: go
- plugin: go
out: gen/go
opt:
- paths=source_relative
- name: go-grpc
- plugin: go-grpc
out: gen/go
opt:
- paths=source_relative
Expand Down Expand Up @@ -189,15 +189,15 @@ Alternatively, see the section on remotely managed plugin versions below.
```yaml
version: v1
plugins:
- name: go
- plugin: go
out: gen/go
opt:
- paths=source_relative
- name: go-grpc
- plugin: go-grpc
out: gen/go
opt:
- paths=source_relative
- name: grpc-gateway
- plugin: grpc-gateway
out: gen/go
opt:
- paths=source_relative
Expand Down Expand Up @@ -264,15 +264,15 @@ Alternatively, see the section on remotely managed plugin versions below.
```yaml
version: v1
plugins:
- name: go
- plugin: go
out: gen/go
opt:
- paths=source_relative
- name: go-grpc
- plugin: go-grpc
out: gen/go
opt:
- paths=source_relative
- name: grpc-gateway
- plugin: grpc-gateway
out: gen/go
opt:
- paths=source_relative
Expand Down Expand Up @@ -314,15 +314,15 @@ Alternatively, see the section on remotely managed plugin versions below.
```yaml
version: v1
plugins:
- name: go
- plugin: go
out: gen/go
opt:
- paths=source_relative
- name: go-grpc
- plugin: go-grpc
out: gen/go
opt:
- paths=source_relative
- name: grpc-gateway
- plugin: grpc-gateway
out: gen/go
opt:
- paths=source_relative
Expand Down Expand Up @@ -400,19 +400,19 @@ Alternatively, see the section on remotely managed plugin versions below.
```yaml
version: v1
plugins:
- name: go
- plugin: go
out: gen/go
opt:
- paths=source_relative
- name: go-grpc
- plugin: go-grpc
out: gen/go
opt:
- paths=source_relative
- name: grpc-gateway
- plugin: grpc-gateway
out: gen/go
opt:
- paths=source_relative
- name: openapiv2
- plugin: openapiv2
out: gen/openapiv2
```

Expand Down Expand Up @@ -509,7 +509,7 @@ the `opt` field in your `buf.gen.yaml` file, for example:
```yaml
version: v1
plugins:
- name: grpc-gateway
- plugin: grpc-gateway
out: gen/go
opt:
- paths=source_relative
Expand Down
10 changes: 6 additions & 4 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
version: v1
plugins:
- remote: buf.build/library/plugins/go:v1.27.1-1
- plugin: buf.build/protocolbuffers/go:v1.28.1
revision: 4
out: .
opt:
- paths=source_relative
- remote: buf.build/library/plugins/go-grpc:v1.1.0-2
- plugin: buf.build/grpc/go:v1.2.0
revision: 4
out: .
opt:
- paths=source_relative
- require_unimplemented_servers=false
- name: grpc-gateway
- plugin: grpc-gateway
out: .
opt:
- paths=source_relative
- allow_repeated_fields_in_body=true
- name: openapiv2
- plugin: openapiv2
out: .
opt:
- allow_repeated_fields_in_body=true
6 changes: 3 additions & 3 deletions docs/docs/tutorials/adding_annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ We'll need to add the gRPC-Gateway generator to the generation configuration:
```yaml
version: v1
plugins:
- name: go
- plugin: go
out: proto
opt: paths=source_relative
- name: go-grpc
- plugin: go-grpc
out: proto
opt: paths=source_relative,require_unimplemented_servers=false
- name: grpc-gateway
- plugin: grpc-gateway
out: proto
opt: paths=source_relative
```
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/tutorials/generating_stubs/using_buf.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ To generate type and gRPC stubs for Go, create the file `buf.gen.yaml`:
```yaml
version: v1
plugins:
- name: go
- plugin: go
out: proto
opt: paths=source_relative
- name: go-grpc
- plugin: go-grpc
out: proto
opt: paths=source_relative
```
Expand Down
8 changes: 4 additions & 4 deletions examples/internal/clients/abe/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5323,17 +5323,17 @@ definitions:
\ ...\n if (any.UnpackTo(&foo)) {\n ...\n }\n\nExample 2: Pack\
\ and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n\
\ ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n\
\ }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n\
\ }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n\
\ any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n\
\ any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in\
\ any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in\
\ Go\n\n foo := &pb.Foo{...}\n any, err := anypb.New(foo)\n if err\
\ != nil {\n ...\n }\n ...\n foo := &pb.Foo{}\n if err\
\ := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods\
\ provided by protobuf library will by default use\n'type.googleapis.com/full.type.name'\
\ as the type URL and the unpack\nmethods only use the fully qualified type\
\ name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\"\
\ will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of\
\ an `Any` value uses the regular\nrepresentation of the deserialized, embedded\
\ will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an\
\ `Any` value uses the regular\nrepresentation of the deserialized, embedded\
\ message, with an\nadditional field `@type` which contains the type URL. Example:\n\
\n package google.profile;\n message Person {\n string first_name\
\ = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\"\
Expand Down
2 changes: 1 addition & 1 deletion examples/internal/clients/abe/model_protobuf_any.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

package abe

// `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type. Example 1: Pack and unpack a message in C++. Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... } Example 2: Pack and unpack a message in Java. Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ... Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) if err != nil { ... } ... foo := &pb.Foo{} if err := any.UnmarshalTo(foo); err != nil { ... } The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example \"foo.bar.com/x/y.z\" will yield type name \"y.z\". JSON ==== The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example: package google.profile; message Person { string first_name = 1; string last_name = 2; } { \"@type\": \"type.googleapis.com/google.profile.Person\", \"firstName\": <string>, \"lastName\": <string> } If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { \"@type\": \"type.googleapis.com/google.protobuf.Duration\", \"value\": \"1.212s\" }
// `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type. Example 1: Pack and unpack a message in C++. Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... } Example 2: Pack and unpack a message in Java. Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ... Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) if err != nil { ... } ... foo := &pb.Foo{} if err := any.UnmarshalTo(foo); err != nil { ... } The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example \"foo.bar.com/x/y.z\" will yield type name \"y.z\". JSON The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example: package google.profile; message Person { string first_name = 1; string last_name = 2; } { \"@type\": \"type.googleapis.com/google.profile.Person\", \"firstName\": <string>, \"lastName\": <string> } If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { \"@type\": \"type.googleapis.com/google.protobuf.Duration\", \"value\": \"1.212s\" }
type ProtobufAny struct {
// A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics.
Type_ string `json:"@type,omitempty"`
Expand Down
8 changes: 4 additions & 4 deletions examples/internal/clients/echo/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -958,17 +958,17 @@ definitions:
\ ...\n if (any.UnpackTo(&foo)) {\n ...\n }\n\nExample 2: Pack\
\ and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n\
\ ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n\
\ }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n\
\ }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n\
\ any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n\
\ any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in\
\ any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in\
\ Go\n\n foo := &pb.Foo{...}\n any, err := anypb.New(foo)\n if err\
\ != nil {\n ...\n }\n ...\n foo := &pb.Foo{}\n if err\
\ := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods\
\ provided by protobuf library will by default use\n'type.googleapis.com/full.type.name'\
\ as the type URL and the unpack\nmethods only use the fully qualified type\
\ name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\"\
\ will yield type\nname \"y.z\".\n\n\nJSON\n====\nThe JSON representation of\
\ an `Any` value uses the regular\nrepresentation of the deserialized, embedded\
\ will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an\
\ `Any` value uses the regular\nrepresentation of the deserialized, embedded\
\ message, with an\nadditional field `@type` which contains the type URL. Example:\n\
\n package google.profile;\n message Person {\n string first_name\
\ = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\"\
Expand Down
2 changes: 1 addition & 1 deletion examples/internal/clients/echo/model_protobuf_any.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

package echo

// `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type. Example 1: Pack and unpack a message in C++. Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... } Example 2: Pack and unpack a message in Java. Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ... Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) if err != nil { ... } ... foo := &pb.Foo{} if err := any.UnmarshalTo(foo); err != nil { ... } The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example \"foo.bar.com/x/y.z\" will yield type name \"y.z\". JSON ==== The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example: package google.profile; message Person { string first_name = 1; string last_name = 2; } { \"@type\": \"type.googleapis.com/google.profile.Person\", \"firstName\": <string>, \"lastName\": <string> } If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { \"@type\": \"type.googleapis.com/google.protobuf.Duration\", \"value\": \"1.212s\" }
// `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type. Example 1: Pack and unpack a message in C++. Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... } Example 2: Pack and unpack a message in Java. Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ... Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) if err != nil { ... } ... foo := &pb.Foo{} if err := any.UnmarshalTo(foo); err != nil { ... } The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example \"foo.bar.com/x/y.z\" will yield type name \"y.z\". JSON The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example: package google.profile; message Person { string first_name = 1; string last_name = 2; } { \"@type\": \"type.googleapis.com/google.profile.Person\", \"firstName\": <string>, \"lastName\": <string> } If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { \"@type\": \"type.googleapis.com/google.protobuf.Duration\", \"value\": \"1.212s\" }
type ProtobufAny struct {
// A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics.
Type_ string `json:"@type,omitempty"`
Expand Down
Loading