Skip to content

Commit ba05454

Browse files
committed
Merge pull request #290 from xfxyjwf/wkt
Include all well-known type protos.
2 parents 4e63b52 + ca9d1a0 commit ba05454

File tree

8 files changed

+425
-21
lines changed

8 files changed

+425
-21
lines changed

src/google/protobuf/any.proto

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ option java_package = "com.google.protobuf";
4040
// `Any` contains an arbitrary serialized message along with a URL
4141
// that describes the type of the serialized message.
4242
//
43-
//
43+
// The proto runtimes and/or compiler will eventually
44+
// provide utilities to pack/unpack Any values (projected Q1/15).
4445
//
4546
// # JSON
4647
// The JSON representation of an `Any` value uses the regular
@@ -76,21 +77,24 @@ message Any {
7677
// For URLs which use the schema `http`, `https`, or no schema, the
7778
// following restrictions and interpretations apply:
7879
//
79-
// * If no schema is provided, https is assumed.
80+
// * If no schema is provided, `https` is assumed.
8081
// * The last segment of the URL's path must represent the fully
8182
// qualified name of the type (as in `path/google.protobuf.Duration`).
8283
// * An HTTP GET on the URL must yield a [google.protobuf.Type][google.protobuf.Type]
8384
// value in binary format, or produce an error.
8485
// * Applications are allowed to cache lookup results based on the
8586
// URL, or have them precompiled into a binary to avoid any
86-
// lookup. Therefore, binary compatibility need to be preserved
87+
// lookup. Therefore, binary compatibility needs to be preserved
8788
// on changes to types. (Use versioned type names to manage
8889
// breaking changes.)
8990
//
9091
// Schemas other than `http`, `https` (or the empty schema) might be
9192
// used with implementation specific semantics.
9293
//
93-
//
94+
// Types originating from the `google.*` package
95+
// namespace should use `type.googleapis.com/full.type.name` (without
96+
// schema and path). A type service will eventually become available which
97+
// serves those URLs (projected Q2/15).
9498
string type_url = 1;
9599

96100
// Must be valid serialized data of the above specified type.

src/google/protobuf/api.proto

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
// Protocol Buffers - Google's data interchange format
2+
// Copyright 2008 Google Inc. All rights reserved.
3+
// https://developers.google.com/protocol-buffers/
4+
//
5+
// Redistribution and use in source and binary forms, with or without
6+
// modification, are permitted provided that the following conditions are
7+
// met:
8+
//
9+
// * Redistributions of source code must retain the above copyright
10+
// notice, this list of conditions and the following disclaimer.
11+
// * Redistributions in binary form must reproduce the above
12+
// copyright notice, this list of conditions and the following disclaimer
13+
// in the documentation and/or other materials provided with the
14+
// distribution.
15+
// * Neither the name of Google Inc. nor the names of its
16+
// contributors may be used to endorse or promote products derived from
17+
// this software without specific prior written permission.
18+
//
19+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
syntax = "proto3";
31+
32+
package google.protobuf;
33+
34+
import "google/protobuf/source_context.proto";
35+
import "google/protobuf/type.proto";
36+
37+
option java_multiple_files = true;
38+
option java_outer_classname = "ApiProto";
39+
option java_package = "com.google.protobuf";
40+
41+
42+
// Api is a light-weight descriptor for a protocol buffer service.
43+
message Api {
44+
// The fully qualified name of this api, including package name
45+
// followed by the api's simple name.
46+
string name = 1;
47+
48+
// The methods of this api, in unspecified order.
49+
repeated Method methods = 2;
50+
51+
// Any metadata attached to the API.
52+
repeated Option options = 3;
53+
54+
// A version string for this api. If specified, must have the form
55+
// `major-version.minor-version`, as in `1.10`. If the minor version
56+
// is omitted, it defaults to zero. If the entire version field is
57+
// empty, the major version is derived from the package name, as
58+
// outlined below. If the field is not empty, the version in the
59+
// package name will be verified to be consistent with what is
60+
// provided here.
61+
//
62+
// The versioning schema uses [semantic
63+
// versioning](http://semver.org) where the major version number
64+
// indicates a breaking change and the minor version an additive,
65+
// non-breaking change. Both version numbers are signals to users
66+
// what to expect from different versions, and should be carefully
67+
// chosen based on the product plan.
68+
//
69+
// The major version is also reflected in the package name of the
70+
// API, which must end in `v<major-version>`, as in
71+
// `google.feature.v1`. For major versions 0 and 1, the suffix can
72+
// be omitted. Zero major versions must only be used for
73+
// experimental, none-GA apis.
74+
//
75+
// See also: [design doc](http://go/api-versioning).
76+
//
77+
//
78+
string version = 4;
79+
80+
// Source context for the protocol buffer service represented by this
81+
// message.
82+
SourceContext source_context = 5;
83+
}
84+
85+
// Method represents a method of an api.
86+
message Method {
87+
// The simple name of this method.
88+
string name = 1;
89+
90+
// A URL of the input message type.
91+
string request_type_url = 2;
92+
93+
// If true, the request is streamed.
94+
bool request_streaming = 3;
95+
96+
// The URL of the output message type.
97+
string response_type_url = 4;
98+
99+
// If true, the response is streamed.
100+
bool response_streaming = 5;
101+
102+
// Any metadata attached to the method.
103+
repeated Option options = 6;
104+
}

src/google/protobuf/duration.proto

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ option java_package = "com.google.protobuf";
4444
// two Timestamp values is a Duration and it can be added or subtracted
4545
// from a Timestamp. Range is approximately +-10,000 years.
4646
//
47-
// Example 1: compute Duration from two Timestamps in pseudo code.
47+
// Example 1: Compute Duration from two Timestamps in pseudo code.
4848
//
4949
// Timestamp start = ...;
5050
// Timestamp end = ...;
@@ -61,7 +61,7 @@ option java_package = "com.google.protobuf";
6161
// duration.nanos += 1000000000;
6262
// }
6363
//
64-
// Example 2: compute Timestamp from Timestamp + Duration in pseudo code.
64+
// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
6565
//
6666
// Timestamp start = ...;
6767
// Duration duration = ...;
@@ -85,9 +85,9 @@ message Duration {
8585

8686
// Signed fractions of a second at nanosecond resolution of the span
8787
// of time. Durations less than one second are represented with a 0
88-
// seconds field and a positive or negative nanos field. For durations
89-
// of one second or more, a non-zero value for the nanos field must be
90-
// of the same sign as the seconds field. Must be from -999,999,999
88+
// `seconds` field and a positive or negative `nanos` field. For durations
89+
// of one second or more, a non-zero value for the `nanos` field must be
90+
// of the same sign as the `seconds` field. Must be from -999,999,999
9191
// to +999,999,999 inclusive.
9292
int32 nanos = 2;
9393
}

src/google/protobuf/empty.proto

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Protocol Buffers - Google's data interchange format
2+
// Copyright 2008 Google Inc. All rights reserved.
3+
// https://developers.google.com/protocol-buffers/
4+
//
5+
// Redistribution and use in source and binary forms, with or without
6+
// modification, are permitted provided that the following conditions are
7+
// met:
8+
//
9+
// * Redistributions of source code must retain the above copyright
10+
// notice, this list of conditions and the following disclaimer.
11+
// * Redistributions in binary form must reproduce the above
12+
// copyright notice, this list of conditions and the following disclaimer
13+
// in the documentation and/or other materials provided with the
14+
// distribution.
15+
// * Neither the name of Google Inc. nor the names of its
16+
// contributors may be used to endorse or promote products derived from
17+
// this software without specific prior written permission.
18+
//
19+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
syntax = "proto3";
31+
32+
package google.protobuf;
33+
34+
option java_multiple_files = true;
35+
option java_outer_classname = "EmptyProto";
36+
option java_package = "com.google.protobuf";
37+
38+
39+
// A generic empty message that you can re-use to avoid defining duplicated
40+
// empty messages in your APIs. A typical example is to use it as the request
41+
// or the response type of an API method. For instance:
42+
//
43+
// service Foo {
44+
// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
45+
// }
46+
//
47+
message Empty {
48+
49+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Protocol Buffers - Google's data interchange format
2+
// Copyright 2008 Google Inc. All rights reserved.
3+
// https://developers.google.com/protocol-buffers/
4+
//
5+
// Redistribution and use in source and binary forms, with or without
6+
// modification, are permitted provided that the following conditions are
7+
// met:
8+
//
9+
// * Redistributions of source code must retain the above copyright
10+
// notice, this list of conditions and the following disclaimer.
11+
// * Redistributions in binary form must reproduce the above
12+
// copyright notice, this list of conditions and the following disclaimer
13+
// in the documentation and/or other materials provided with the
14+
// distribution.
15+
// * Neither the name of Google Inc. nor the names of its
16+
// contributors may be used to endorse or promote products derived from
17+
// this software without specific prior written permission.
18+
//
19+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
syntax = "proto3";
31+
32+
package google.protobuf;
33+
34+
option java_multiple_files = true;
35+
option java_outer_classname = "SourceContextProto";
36+
option java_package = "com.google.protobuf";
37+
38+
39+
// `SourceContext` represents information about the source of a
40+
// protobuf element, like the file in which it is defined.
41+
message SourceContext {
42+
// The path-qualified name of the .proto file that contained the associated
43+
// protobuf element. For example: `"google/protobuf/source.proto"`.
44+
string file_name = 1;
45+
}

src/google/protobuf/struct.proto

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,33 @@ message Value {
5656
oneof kind {
5757
// Represents a null value.
5858
NullValue null_value = 1;
59+
5960
// Represents a double value.
6061
double number_value = 2;
62+
6163
// Represents a string value.
6264
string string_value = 3;
65+
6366
// Represents a boolean value.
6467
bool bool_value = 4;
68+
6569
// Represents a structured value.
6670
Struct struct_value = 5;
71+
6772
// Represents a repeated `Value`.
6873
ListValue list_value = 6;
6974
}
7075
}
7176

77+
// `ListValue` is a wrapper around a repeated field of values.
78+
message ListValue {
79+
// Repeated field of dynamically typed values.
80+
repeated Value values = 1;
81+
}
82+
7283
// `NullValue` is a singleton enumeration to represent the null
7384
// value for the `Value` type union.
7485
enum NullValue {
7586
// Null value.
7687
NULL_VALUE = 0;
7788
}
78-
79-
// `ListValue` is a wrapper around a repeated field of values.
80-
message ListValue {
81-
// Repeated field of dynamically typed values.
82-
repeated Value values = 1;
83-
}

src/google/protobuf/timestamp.proto

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,16 @@ option java_package = "com.google.protobuf";
4646
// table is needed for interpretation. Range is from
4747
// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
4848
// By restricting to that range, we ensure that we can convert to
49-
// and from RFC 3339 date strings. (See https://www.ietf.org/rfc/rfc3339.txt.)
49+
// and from RFC 3339 date strings.
50+
// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
5051
//
51-
// Example 1: compute Timestamp from POSIX `time()`.
52+
// Example 1: Compute Timestamp from POSIX `time()`.
5253
//
5354
// Timestamp timestamp;
5455
// timestamp.set_seconds(time(NULL));
5556
// timestamp.set_nanos(0);
5657
//
57-
// Example 2: compute Timestamp from POSIX `gettimeofday()`.
58+
// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
5859
//
5960
// struct timeval tv;
6061
// gettimeofday(&tv, NULL);
@@ -63,7 +64,7 @@ option java_package = "com.google.protobuf";
6364
// timestamp.set_seconds(tv.tv_sec);
6465
// timestamp.set_nanos(tv.tv_usec * 1000);
6566
//
66-
// Example 3: compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
67+
// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
6768
//
6869
// FILETIME ft;
6970
// GetSystemTimeAsFileTime(&ft);
@@ -75,14 +76,14 @@ option java_package = "com.google.protobuf";
7576
// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
7677
// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
7778
//
78-
// Example 4: compute Timestamp from Java `System.currentTimeMillis()`.
79+
// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
7980
//
8081
// long millis = System.currentTimeMillis();
8182
//
8283
// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
8384
// .setNanos((int) ((millis % 1000) * 1000000)).build();
8485
//
85-
// Example 5: compute Timestamp from Python `datetime.datetime`.
86+
// Example 5: Compute Timestamp from Python `datetime.datetime`.
8687
//
8788
// now = datetime.datetime.utcnow()
8889
// seconds = int(time.mktime(now.timetuple()))

0 commit comments

Comments
 (0)