Index: third_party/protobuf/src/google/protobuf/any.proto |
diff --git a/third_party/protobuf/src/google/protobuf/any.proto b/third_party/protobuf/src/google/protobuf/any.proto |
index e8a18bc35e0839cc2bdebb422e96d555b63176d8..45db6ede352bb2af940675b63476b15554309951 100644 |
--- a/third_party/protobuf/src/google/protobuf/any.proto |
+++ b/third_party/protobuf/src/google/protobuf/any.proto |
@@ -33,14 +33,43 @@ syntax = "proto3"; |
package google.protobuf; |
option csharp_namespace = "Google.Protobuf.WellKnownTypes"; |
+option go_package = "github.com/golang/protobuf/ptypes/any"; |
option java_package = "com.google.protobuf"; |
option java_outer_classname = "AnyProto"; |
option java_multiple_files = true; |
option java_generate_equals_and_hash = true; |
option objc_class_prefix = "GPB"; |
-// `Any` contains an arbitrary serialized message along with a URL |
-// that describes the type of the serialized message. |
+// `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); |
+// } |
+// |
+// 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 |
@@ -73,7 +102,7 @@ option objc_class_prefix = "GPB"; |
// |
message Any { |
// A URL/resource name whose content describes the type of the |
- // serialized message. |
+ // serialized protocol buffer message. |
// |
// For URLs which use the schema `http`, `https`, or no schema, the |
// following restrictions and interpretations apply: |
@@ -81,6 +110,8 @@ message Any { |
// * If no schema is provided, `https` is assumed. |
// * 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). |
// * 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 |
@@ -94,6 +125,6 @@ message Any { |
// |
string type_url = 1; |
- // Must be valid serialized data of the above specified type. |
+ // Must be a valid serialized protocol buffer of the above specified type. |
bytes value = 2; |
} |