Skip to content

Commit

Permalink
all: upgrade buf/grpc/protobuf versions
Browse files Browse the repository at this point in the history
  • Loading branch information
johanbrandhorst committed Oct 12, 2024
1 parent 9dddd35 commit efcd3ad
Show file tree
Hide file tree
Showing 85 changed files with 1,999 additions and 3,488 deletions.
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.14.0
go install github.com/bufbuild/buf/cmd/buf@v1.45.0
go install \
./protoc-gen-openapiv2 \
./protoc-gen-grpc-gateway
Expand Down
12 changes: 5 additions & 7 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
version: v1
version: v2
plugins:
- plugin: buf.build/protocolbuffers/go:v1.28.1
revision: 4
- remote: buf.build/protocolbuffers/go:v1.35.1
out: .
opt:
- paths=source_relative
- plugin: buf.build/grpc/go:v1.2.0
revision: 4
- remote: buf.build/grpc/go:v1.5.1
out: .
opt:
- paths=source_relative
- require_unimplemented_servers=false
- plugin: grpc-gateway
- local: protoc-gen-grpc-gateway
out: .
opt:
- paths=source_relative
- allow_repeated_fields_in_body=true
- plugin: openapiv2
- local: protoc-gen-openapiv2
out: .
opt:
- allow_repeated_fields_in_body=true
37 changes: 20 additions & 17 deletions examples/internal/clients/abe/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6083,9 +6083,10 @@ definitions:
\ Therefore, binary compatibility needs to be preserved\n on changes to\
\ types. (Use versioned type names to manage\n breaking changes.)\n\nNote:\
\ this functionality is not currently available in the official\nprotobuf\
\ release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\
\nSchemes other than `http`, `https` (or the empty scheme) might be\nused\
\ with implementation specific semantics."
\ release, and it is not used for type URLs beginning with\ntype.googleapis.com.\
\ As of May 2023, there are no widely used type server\nimplementations\
\ and no plans to implement one.\n\nSchemes other than `http`, `https` (or\
\ the empty scheme) might be\nused with implementation specific semantics."
description: "`Any` contains an arbitrary serialized protocol buffer message along\
\ with a\nURL that describes the type of the serialized message.\n\nProtobuf\
\ library provides support to pack/unpack Any values in the form\nof utility\
Expand All @@ -6094,20 +6095,22 @@ 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\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\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\
\ 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\"\
\ }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n\
\ foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 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 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\n\
name \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses\
\ the regular\nrepresentation of the deserialized, embedded message, with an\n\
additional 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\"\
,\n \"firstName\": <string>,\n \"lastName\": <string>\n }\n\nIf\
\ the embedded message type is well-known and has a custom JSON\nrepresentation,\
\ that representation will be embedded adding a field\n`value` which holds the\
Expand Down
4 changes: 2 additions & 2 deletions examples/internal/clients/abe/model_protobuf_any.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

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); } // or ... if (any.isSameTypeAs(Foo.getDefaultInstance())) { foo = any.unpack(Foo.getDefaultInstance()); } 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.
// 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. As of May 2023, there are no widely used type server implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics.
Type_ string `json:"@type,omitempty"`
}
39 changes: 21 additions & 18 deletions examples/internal/clients/echo/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1076,9 +1076,10 @@ definitions:
\ Therefore, binary compatibility needs to be preserved\n on changes to\
\ types. (Use versioned type names to manage\n breaking changes.)\n\nNote:\
\ this functionality is not currently available in the official\nprotobuf\
\ release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\
\nSchemes other than `http`, `https` (or the empty scheme) might be\nused\
\ with implementation specific semantics."
\ release, and it is not used for type URLs beginning with\ntype.googleapis.com.\
\ As of May 2023, there are no widely used type server\nimplementations\
\ and no plans to implement one.\n\nSchemes other than `http`, `https` (or\
\ the empty scheme) might be\nused with implementation specific semantics."
description: "`Any` contains an arbitrary serialized protocol buffer message along\
\ with a\nURL that describes the type of the serialized message.\n\nProtobuf\
\ library provides support to pack/unpack Any values in the form\nof utility\
Expand All @@ -1087,20 +1088,22 @@ 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\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\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\
\ 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\"\
\ }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n\
\ foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 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 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\n\
name \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses\
\ the regular\nrepresentation of the deserialized, embedded message, with an\n\
additional 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\"\
,\n \"firstName\": <string>,\n \"lastName\": <string>\n }\n\nIf\
\ the embedded message type is well-known and has a custom JSON\nrepresentation,\
\ that representation will be embedded adding a field\n`value` which holds the\
Expand All @@ -1111,7 +1114,7 @@ definitions:
protobufNullValue:
type: "string"
description: "`NullValue` is a singleton enumeration to represent the null value\
\ for the\n`Value` type union.\n\n The JSON representation for `NullValue` is\
\ for the\n`Value` type union.\n\nThe JSON representation for `NullValue` is\
\ JSON `null`.\n\n - NULL_VALUE: Null value."
enum:
- "NULL_VALUE"
Expand Down
Loading

0 comments on commit efcd3ad

Please sign in to comment.