Skip to content

Commit 7515c54

Browse files
committed
added buf package
current errors: example/bookstore/v1/bookstore.proto:5:8:import "aep/api/operation.proto": file does not exist
1 parent cc8cf06 commit 7515c54

8 files changed

Lines changed: 566 additions & 443 deletions

File tree

buf.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ plugins:
99
- plugin: buf-plugin-aep
1010
deps:
1111
- buf.build/googleapis/googleapis:28151c0d0a1641bf938a7672c500e01d
12+
- buf.build/aep/api:2fc44491c62940f1b59218fb450701b5

example/bookstore/v1/bookstore.pb.go

Lines changed: 410 additions & 406 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/bookstore/v1/bookstore.proto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ syntax = "proto3";
22

33
package example.bookstore.v1;
44

5+
import "aep/api/operation.proto";
6+
57
import "google/api/annotations.proto";
68

79
import "google/api/client.proto";
@@ -68,7 +70,7 @@ service Bookstore {
6870
}
6971

7072
// archive a book.
71-
rpc archiveBook ( ArchiveBookRequest ) returns ( ArchiveBookResponse ) {
73+
rpc archiveBook ( ArchiveBookRequest ) returns ( aep.api.Operation ) {
7274
option (google.api.http) = {
7375
post: "/{path=publishers/*/books/*}:archive",
7476
body: "*"

example/bookstore/v1/bookstore.swagger.json

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@
841841
"200": {
842842
"description": "A successful response.",
843843
"schema": {
844-
"$ref": "#/definitions/v1ArchiveBookResponse"
844+
"$ref": "#/definitions/longrunningOperation"
845845
}
846846
},
847847
"default": {
@@ -891,43 +891,65 @@
891891
},
892892
"description": "A Author."
893893
},
894+
"longrunningOperation": {
895+
"type": "object",
896+
"properties": {
897+
"name": {
898+
"type": "string",
899+
"description": "The server-assigned name, which is only unique within the same service that\noriginally returns it. If you use the default HTTP mapping, the\n`name` should be a resource name ending with `operations/{unique_id}`."
900+
},
901+
"metadata": {
902+
"$ref": "#/definitions/protobufAny",
903+
"description": "Service-specific metadata associated with the operation. It typically\ncontains progress information and common metadata such as create time.\nSome services might not provide such metadata. Any method that returns a\nlong-running operation should document the metadata type, if any."
904+
},
905+
"done": {
906+
"type": "boolean",
907+
"description": "If the value is `false`, it means the operation is still in progress.\nIf `true`, the operation is completed, and either `error` or `response` is\navailable."
908+
},
909+
"error": {
910+
"$ref": "#/definitions/rpcStatus",
911+
"description": "The error result of the operation in case of failure or cancellation."
912+
},
913+
"response": {
914+
"$ref": "#/definitions/protobufAny",
915+
"description": "The normal response of the operation in case of success. If the original\nmethod returns no data on success, such as `Delete`, the response is\n`google.protobuf.Empty`. If the original method is standard\n`Get`/`Create`/`Update`, the response should be the resource. For other\nmethods, the response should have the type `XxxResponse`, where `Xxx`\nis the original method name. For example, if the original method name\nis `TakeSnapshot()`, the inferred response type is\n`TakeSnapshotResponse`."
916+
}
917+
},
918+
"description": "This resource represents a long-running operation that is the result of a\nnetwork API call."
919+
},
894920
"protobufAny": {
895921
"type": "object",
896922
"properties": {
897923
"@type": {
898-
"type": "string"
924+
"type": "string",
925+
"description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. 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. 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."
899926
}
900927
},
901-
"additionalProperties": {}
928+
"additionalProperties": {},
929+
"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 functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\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 // 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 := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.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\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 \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\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 custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }"
902930
},
903931
"rpcStatus": {
904932
"type": "object",
905933
"properties": {
906934
"code": {
907935
"type": "integer",
908-
"format": "int32"
936+
"format": "int32",
937+
"description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]."
909938
},
910939
"message": {
911-
"type": "string"
940+
"type": "string",
941+
"description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client."
912942
},
913943
"details": {
914944
"type": "array",
915945
"items": {
916946
"type": "object",
917947
"$ref": "#/definitions/protobufAny"
918-
}
919-
}
920-
}
921-
},
922-
"v1ArchiveBookResponse": {
923-
"type": "object",
924-
"properties": {
925-
"success": {
926-
"type": "boolean",
927-
"description": "Field for success."
948+
},
949+
"description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use."
928950
}
929951
},
930-
"title": "Response message for the archive method"
952+
"description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)."
931953
},
932954
"v1Book": {
933955
"type": "object",

example/bookstore/v1/bookstore_grpc.pb.go

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,20 @@ require (
1010
github.com/jhump/protoreflect v1.17.0
1111
github.com/rs/cors v1.11.1
1212
github.com/spf13/cobra v1.7.0
13-
google.golang.org/genproto/googleapis/api v0.0.0-20250212204824-5a70512c5d8b
14-
google.golang.org/grpc v1.70.0
15-
google.golang.org/protobuf v1.36.5
13+
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb
14+
google.golang.org/grpc v1.71.0
15+
google.golang.org/protobuf v1.36.6
1616
)
1717

1818
require (
19-
cel.dev/expr v0.19.0 // indirect
20-
cloud.google.com/go/longrunning v0.6.4 // indirect
19+
buf.build/gen/go/aep/api/protocolbuffers/go v1.36.6-20250324194021-2fc44491c629.1 // indirect
20+
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20240221180331-f05a6f4403ce.1 // indirect
21+
cel.dev/expr v0.19.1 // indirect
22+
cloud.google.com/go v0.118.3 // indirect
23+
cloud.google.com/go/auth v0.15.0 // indirect
24+
cloud.google.com/go/auth/oauth2adapt v0.2.7 // indirect
25+
cloud.google.com/go/compute/metadata v0.6.0 // indirect
26+
cloud.google.com/go/longrunning v0.6.6 // indirect
2127
github.com/DataDog/datadog-go v2.2.0+incompatible // indirect
2228
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect
2329
github.com/PuerkitoBio/purell v1.1.0 // indirect
@@ -33,6 +39,9 @@ require (
3339
github.com/cockscomb/cel2sql v0.0.0-20211204123659-c803dfd5c44c // indirect
3440
github.com/dikhan/http_goclient v0.0.0-20181010015730-b9de9b5ee7b6 // indirect
3541
github.com/fatih/color v1.16.0 // indirect
42+
github.com/felixge/httpsnoop v1.0.4 // indirect
43+
github.com/go-logr/logr v1.4.2 // indirect
44+
github.com/go-logr/stdr v1.2.2 // indirect
3645
github.com/go-openapi/analysis v0.0.0-20171215055114-2bbaa248df98 // indirect
3746
github.com/go-openapi/errors v0.0.0-20170426151106-03cfca65330d // indirect
3847
github.com/go-openapi/jsonpointer v0.17.0 // indirect
@@ -43,6 +52,9 @@ require (
4352
github.com/go-openapi/swag v0.17.0 // indirect
4453
github.com/golang/protobuf v1.5.4 // indirect
4554
github.com/google/cel-go v0.22.1 // indirect
55+
github.com/google/s2a-go v0.1.9 // indirect
56+
github.com/googleapis/enterprise-certificate-proxy v0.3.5 // indirect
57+
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
4658
github.com/hashicorp/errwrap v1.0.0 // indirect
4759
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
4860
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
@@ -78,29 +90,38 @@ require (
7890
github.com/mitchellh/reflectwalk v1.0.2 // indirect
7991
github.com/oklog/run v1.0.0 // indirect
8092
github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 // indirect
81-
github.com/rogpeppe/go-internal v1.9.0 // indirect
93+
github.com/rogpeppe/go-internal v1.13.1 // indirect
8294
github.com/spf13/pflag v1.0.5 // indirect
8395
github.com/stoewer/go-strcase v1.2.0 // indirect
8496
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
8597
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
8698
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
8799
github.com/zclconf/go-cty v1.15.0 // indirect
88-
golang.org/x/crypto v0.32.0 // indirect
100+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
101+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.59.0 // indirect
102+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 // indirect
103+
go.opentelemetry.io/otel v1.34.0 // indirect
104+
go.opentelemetry.io/otel/metric v1.34.0 // indirect
105+
go.opentelemetry.io/otel/trace v1.34.0 // indirect
106+
golang.org/x/crypto v0.36.0 // indirect
89107
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
90108
golang.org/x/mod v0.21.0 // indirect
91-
golang.org/x/net v0.34.0 // indirect
92-
golang.org/x/sync v0.10.0 // indirect
109+
golang.org/x/net v0.37.0 // indirect
110+
golang.org/x/oauth2 v0.27.0 // indirect
111+
golang.org/x/sync v0.12.0 // indirect
112+
golang.org/x/time v0.10.0 // indirect
93113
golang.org/x/tools v0.26.0 // indirect
114+
google.golang.org/api v0.224.0 // indirect
94115
google.golang.org/appengine v1.6.8 // indirect
95-
google.golang.org/genproto v0.0.0-20250219182151-9fdb1cabc7b2 // indirect
96-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250212204824-5a70512c5d8b // indirect
116+
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb // indirect
117+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
97118
gopkg.in/mgo.v2 v2.0.0-20160818020120-3f83fa500528 // indirect
98119
gopkg.in/yaml.v2 v2.4.0 // indirect
99120
)
100121

101122
require (
102123
github.com/ghodss/yaml v1.0.0
103-
github.com/google/go-cmp v0.6.0
104-
golang.org/x/sys v0.30.0 // indirect
105-
golang.org/x/text v0.21.0
124+
github.com/google/go-cmp v0.7.0
125+
golang.org/x/sys v0.31.0 // indirect
126+
golang.org/x/text v0.23.0
106127
)

0 commit comments

Comments
 (0)