ptypes: regen and remove transforms from regen.sh
diff --git a/ptypes/any/any.pb.go b/ptypes/any/any.pb.go index c341065..72490da 100644 --- a/ptypes/any/any.pb.go +++ b/ptypes/any/any.pb.go
@@ -28,8 +28,36 @@ // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package -// `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 @@ -62,7 +90,7 @@ // type Any struct { // 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: @@ -70,6 +98,8 @@ // * 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 @@ -82,7 +112,7 @@ // used with implementation specific semantics. // TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl" json:"type_url,omitempty"` - // Must be valid serialized data of the above specified type. + // Must be a valid serialized protocol buffer of the above specified type. Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` }
diff --git a/ptypes/any/any.proto b/ptypes/any/any.proto index 9b90756..45db6ed 100644 --- a/ptypes/any/any.proto +++ b/ptypes/any/any.proto
@@ -31,17 +31,45 @@ syntax = "proto3"; package google.protobuf; -option go_package = "github.com/golang/protobuf/ptypes/any"; 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 @@ -74,7 +102,7 @@ // 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: @@ -82,6 +110,8 @@ // * 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 @@ -95,6 +125,6 @@ // 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; }
diff --git a/ptypes/duration/duration.pb.go b/ptypes/duration/duration.pb.go index cdfccbe..ee7d8b8 100644 --- a/ptypes/duration/duration.pb.go +++ b/ptypes/duration/duration.pb.go
@@ -69,6 +69,7 @@ // end.nanos -= 1000000000; // } // +// type Duration struct { // Signed seconds of the span of time. Must be from -315,576,000,000 // to +315,576,000,000 inclusive.
diff --git a/ptypes/duration/duration.proto b/ptypes/duration/duration.proto index 9be52f6..96c1796 100644 --- a/ptypes/duration/duration.proto +++ b/ptypes/duration/duration.proto
@@ -31,9 +31,9 @@ syntax = "proto3"; package google.protobuf; -option go_package = "github.com/golang/protobuf/ptypes/duration"; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "github.com/golang/protobuf/ptypes/duration"; option java_package = "com.google.protobuf"; option java_outer_classname = "DurationProto"; option java_multiple_files = true; @@ -81,6 +81,7 @@ // end.nanos -= 1000000000; // } // +// message Duration { // Signed seconds of the span of time. Must be from -315,576,000,000
diff --git a/ptypes/empty/empty.proto b/ptypes/empty/empty.proto index 0c0d262..37f4cd1 100644 --- a/ptypes/empty/empty.proto +++ b/ptypes/empty/empty.proto
@@ -31,9 +31,9 @@ syntax = "proto3"; package google.protobuf; -option go_package = "github.com/golang/protobuf/ptypes/empty"; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "github.com/golang/protobuf/ptypes/empty"; option java_package = "com.google.protobuf"; option java_outer_classname = "EmptyProto"; option java_multiple_files = true;
diff --git a/ptypes/regen.sh b/ptypes/regen.sh index 48e7cff..2a5b4e8 100755 --- a/ptypes/regen.sh +++ b/ptypes/regen.sh
@@ -51,17 +51,11 @@ fi filename_map[$up]=$f done -# Pass 2: copy files, making necessary adjustments. +# Pass 2: copy files for up in "${!filename_map[@]}"; do f=${filename_map[$up]} shortname=$(basename $f | sed 's,\.proto$,,') - cat $tmpdir/$UPSTREAM_SUBDIR/$up | - # Adjust proto package. - # TODO(dsymonds): Remove when the right go_package options are upstream. - sed '/^package /a option go_package = "github.com\/golang\/protobuf\/ptypes\/'${shortname}'";' | - # Unfortunately "package struct" and "package type" don't work. - sed '/option go_package/s,struct",struct;structpb",' | - cat > $PKG/$f + cp $tmpdir/$UPSTREAM_SUBDIR/$up $PKG/$f done # Run protoc once per package.
diff --git a/ptypes/struct/struct.pb.go b/ptypes/struct/struct.pb.go index 196b856..0b28e47 100644 --- a/ptypes/struct/struct.pb.go +++ b/ptypes/struct/struct.pb.go
@@ -63,7 +63,7 @@ // // The JSON representation for `Struct` is JSON object. type Struct struct { - // Map of dynamically typed values. + // Unordered map of dynamically typed values. Fields map[string]*Value `protobuf:"bytes,1,rep,name=fields" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` }
diff --git a/ptypes/struct/struct.proto b/ptypes/struct/struct.proto index 764be03..beeba81 100644 --- a/ptypes/struct/struct.proto +++ b/ptypes/struct/struct.proto
@@ -31,9 +31,9 @@ syntax = "proto3"; package google.protobuf; -option go_package = "github.com/golang/protobuf/ptypes/struct;structpb"; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "github.com/golang/protobuf/ptypes/struct;structpb"; option java_package = "com.google.protobuf"; option java_outer_classname = "StructProto"; option java_multiple_files = true; @@ -50,7 +50,7 @@ // // The JSON representation for `Struct` is JSON object. message Struct { - // Map of dynamically typed values. + // Unordered map of dynamically typed values. map<string, Value> fields = 1; }
diff --git a/ptypes/timestamp/timestamp.proto b/ptypes/timestamp/timestamp.proto index f02178e..7992a85 100644 --- a/ptypes/timestamp/timestamp.proto +++ b/ptypes/timestamp/timestamp.proto
@@ -31,10 +31,10 @@ syntax = "proto3"; package google.protobuf; -option go_package = "github.com/golang/protobuf/ptypes/timestamp"; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option cc_enable_arenas = true; +option go_package = "github.com/golang/protobuf/ptypes/timestamp"; option java_package = "com.google.protobuf"; option java_outer_classname = "TimestampProto"; option java_multiple_files = true;
diff --git a/ptypes/wrappers/wrappers.proto b/ptypes/wrappers/wrappers.proto index f035adc..4828ad9 100644 --- a/ptypes/wrappers/wrappers.proto +++ b/ptypes/wrappers/wrappers.proto
@@ -36,10 +36,10 @@ syntax = "proto3"; package google.protobuf; -option go_package = "github.com/golang/protobuf/ptypes/wrappers"; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option cc_enable_arenas = true; +option go_package = "github.com/golang/protobuf/ptypes/wrappers"; option java_package = "com.google.protobuf"; option java_outer_classname = "WrappersProto"; option java_multiple_files = true;