Skip to content

Commit fe2bb8f

Browse files
committed
Updated to protobuf 5.0.0 and regenerate the code.
1 parent 6a61cc2 commit fe2bb8f

35 files changed

Lines changed: 4767 additions & 5105 deletions

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.1
2+
3+
* Updated to protobuf 5.0.0 and regenerate the code.
4+
15
## 1.0.0
26

37
* First version.

lib/src/protobuf/any.pb.dart

Lines changed: 162 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,197 @@
1-
///
2-
// Generated code. Do not modify.
3-
// source: google/protobuf/any.proto
1+
// This is a generated file - do not edit.
42
//
5-
// @dart = 2.12
6-
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields, implementation_imports
3+
// Generated from google/protobuf/any.proto.
4+
5+
// @dart = 3.3
6+
7+
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
8+
// ignore_for_file: constant_identifier_names
9+
// ignore_for_file: curly_braces_in_flow_control_structures
10+
// ignore_for_file: deprecated_member_use_from_same_package
11+
// ignore_for_file: implementation_imports, library_prefixes
12+
// ignore_for_file: non_constant_identifier_names
713

814
import 'dart:core' as $core;
915

1016
import 'package:protobuf/protobuf.dart' as $pb;
11-
1217
import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin;
1318

14-
class Any extends $pb.GeneratedMessage with $mixin.AnyMixin {
15-
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
16-
const $core.bool.fromEnvironment('protobuf.omit_message_names')
17-
? ''
18-
: 'Any',
19-
package: const $pb.PackageName(
20-
const $core.bool.fromEnvironment('protobuf.omit_message_names')
21-
? ''
22-
: 'google.protobuf'),
23-
createEmptyInstance: create,
24-
toProto3Json: $mixin.AnyMixin.toProto3JsonHelper,
25-
fromProto3Json: $mixin.AnyMixin.fromProto3JsonHelper)
26-
..aOS(
27-
1,
28-
const $core.bool.fromEnvironment('protobuf.omit_field_names')
29-
? ''
30-
: 'typeUrl')
31-
..a<$core.List<$core.int>>(
32-
2,
33-
const $core.bool.fromEnvironment('protobuf.omit_field_names')
34-
? ''
35-
: 'value',
36-
$pb.PbFieldType.OY)
37-
..hasRequiredFields = false;
19+
export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions;
3820

39-
Any._() : super();
21+
/// `Any` contains an arbitrary serialized protocol buffer message along with a
22+
/// URL that describes the type of the serialized message.
23+
///
24+
/// Protobuf library provides support to pack/unpack Any values in the form
25+
/// of utility functions or additional generated methods of the Any type.
26+
///
27+
/// Example 1: Pack and unpack a message in C++.
28+
///
29+
/// Foo foo = ...;
30+
/// Any any;
31+
/// any.PackFrom(foo);
32+
/// ...
33+
/// if (any.UnpackTo(&foo)) {
34+
/// ...
35+
/// }
36+
///
37+
/// Example 2: Pack and unpack a message in Java.
38+
///
39+
/// Foo foo = ...;
40+
/// Any any = Any.pack(foo);
41+
/// ...
42+
/// if (any.is(Foo.class)) {
43+
/// foo = any.unpack(Foo.class);
44+
/// }
45+
///
46+
/// Example 3: Pack and unpack a message in Python.
47+
///
48+
/// foo = Foo(...)
49+
/// any = Any()
50+
/// any.Pack(foo)
51+
/// ...
52+
/// if any.Is(Foo.DESCRIPTOR):
53+
/// any.Unpack(foo)
54+
/// ...
55+
///
56+
/// Example 4: Pack and unpack a message in Go
57+
///
58+
/// foo := &pb.Foo{...}
59+
/// any, err := ptypes.MarshalAny(foo)
60+
/// ...
61+
/// foo := &pb.Foo{}
62+
/// if err := ptypes.UnmarshalAny(any, foo); err != nil {
63+
/// ...
64+
/// }
65+
///
66+
/// The pack methods provided by protobuf library will by default use
67+
/// 'type.googleapis.com/full.type.name' as the type URL and the unpack
68+
/// methods only use the fully qualified type name after the last '/'
69+
/// in the type URL, for example "foo.bar.com/x/y.z" will yield type
70+
/// name "y.z".
71+
///
72+
///
73+
/// JSON
74+
/// ====
75+
/// The JSON representation of an `Any` value uses the regular
76+
/// representation of the deserialized, embedded message, with an
77+
/// additional field `@type` which contains the type URL. Example:
78+
///
79+
/// package google.profile;
80+
/// message Person {
81+
/// string first_name = 1;
82+
/// string last_name = 2;
83+
/// }
84+
///
85+
/// {
86+
/// "@type": "type.googleapis.com/google.profile.Person",
87+
/// "firstName": <string>,
88+
/// "lastName": <string>
89+
/// }
90+
///
91+
/// If the embedded message type is well-known and has a custom JSON
92+
/// representation, that representation will be embedded adding a field
93+
/// `value` which holds the custom JSON in addition to the `@type`
94+
/// field. Example (for message [google.protobuf.Duration][]):
95+
///
96+
/// {
97+
/// "@type": "type.googleapis.com/google.protobuf.Duration",
98+
/// "value": "1.212s"
99+
/// }
100+
class Any extends $pb.GeneratedMessage with $mixin.AnyMixin {
40101
factory Any({
41102
$core.String? typeUrl,
42103
$core.List<$core.int>? value,
43104
}) {
44-
final _result = create();
45-
if (typeUrl != null) {
46-
_result.typeUrl = typeUrl;
47-
}
48-
if (value != null) {
49-
_result.value = value;
50-
}
51-
return _result;
105+
final result = create();
106+
if (typeUrl != null) result.typeUrl = typeUrl;
107+
if (value != null) result.value = value;
108+
return result;
52109
}
53-
factory Any.fromBuffer($core.List<$core.int> i,
54-
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
55-
create()..mergeFromBuffer(i, r);
56-
factory Any.fromJson($core.String i,
57-
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
58-
create()..mergeFromJson(i, r);
59-
@$core.Deprecated('Using this can add significant overhead to your binary. '
60-
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
61-
'Will be removed in next major version')
62-
Any clone() => Any()..mergeFromMessage(this);
63-
@$core.Deprecated('Using this can add significant overhead to your binary. '
64-
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
65-
'Will be removed in next major version')
110+
111+
Any._();
112+
113+
factory Any.fromBuffer($core.List<$core.int> data,
114+
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
115+
create()..mergeFromBuffer(data, registry);
116+
factory Any.fromJson($core.String json,
117+
[$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
118+
create()..mergeFromJson(json, registry);
119+
120+
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
121+
_omitMessageNames ? '' : 'Any',
122+
package:
123+
const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'),
124+
createEmptyInstance: create,
125+
wellKnownType: $mixin.WellKnownType.any)
126+
..aOS(1, _omitFieldNames ? '' : 'typeUrl')
127+
..a<$core.List<$core.int>>(
128+
2, _omitFieldNames ? '' : 'value', $pb.PbFieldType.OY)
129+
..hasRequiredFields = false;
130+
131+
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
132+
Any clone() => deepCopy();
133+
@$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
66134
Any copyWith(void Function(Any) updates) =>
67-
super.copyWith((message) => updates(message as Any))
68-
as Any; // ignore: deprecated_member_use
135+
super.copyWith((message) => updates(message as Any)) as Any;
136+
137+
@$core.override
69138
$pb.BuilderInfo get info_ => _i;
139+
70140
@$core.pragma('dart2js:noInline')
71141
static Any create() => Any._();
142+
@$core.override
72143
Any createEmptyInstance() => create();
73144
static $pb.PbList<Any> createRepeated() => $pb.PbList<Any>();
74145
@$core.pragma('dart2js:noInline')
75146
static Any getDefault() =>
76147
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Any>(create);
77148
static Any? _defaultInstance;
78149

150+
/// A URL/resource name that uniquely identifies the type of the serialized
151+
/// protocol buffer message. This string must contain at least
152+
/// one "/" character. The last segment of the URL's path must represent
153+
/// the fully qualified name of the type (as in
154+
/// `path/google.protobuf.Duration`). The name should be in a canonical form
155+
/// (e.g., leading "." is not accepted).
156+
///
157+
/// In practice, teams usually precompile into the binary all types that they
158+
/// expect it to use in the context of Any. However, for URLs which use the
159+
/// scheme `http`, `https`, or no scheme, one can optionally set up a type
160+
/// server that maps type URLs to message definitions as follows:
161+
///
162+
/// * If no scheme is provided, `https` is assumed.
163+
/// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
164+
/// value in binary format, or produce an error.
165+
/// * Applications are allowed to cache lookup results based on the
166+
/// URL, or have them precompiled into a binary to avoid any
167+
/// lookup. Therefore, binary compatibility needs to be preserved
168+
/// on changes to types. (Use versioned type names to manage
169+
/// breaking changes.)
170+
///
171+
/// Note: this functionality is not currently available in the official
172+
/// protobuf release, and it is not used for type URLs beginning with
173+
/// type.googleapis.com.
174+
///
175+
/// Schemes other than `http`, `https` (or the empty scheme) might be
176+
/// used with implementation specific semantics.
79177
@$pb.TagNumber(1)
80178
$core.String get typeUrl => $_getSZ(0);
81179
@$pb.TagNumber(1)
82-
set typeUrl($core.String v) {
83-
$_setString(0, v);
84-
}
85-
180+
set typeUrl($core.String value) => $_setString(0, value);
86181
@$pb.TagNumber(1)
87182
$core.bool hasTypeUrl() => $_has(0);
88183
@$pb.TagNumber(1)
89-
void clearTypeUrl() => clearField(1);
184+
void clearTypeUrl() => $_clearField(1);
90185

186+
/// Must be a valid serialized protocol buffer of the above specified type.
91187
@$pb.TagNumber(2)
92188
$core.List<$core.int> get value => $_getN(1);
93189
@$pb.TagNumber(2)
94-
set value($core.List<$core.int> v) {
95-
$_setBytes(1, v);
96-
}
97-
190+
set value($core.List<$core.int> value) => $_setBytes(1, value);
98191
@$pb.TagNumber(2)
99192
$core.bool hasValue() => $_has(1);
100193
@$pb.TagNumber(2)
101-
void clearValue() => clearField(2);
194+
void clearValue() => $_clearField(2);
102195

103196
/// Creates a new [Any] encoding [message].
104197
///
@@ -111,3 +204,8 @@ class Any extends $pb.GeneratedMessage with $mixin.AnyMixin {
111204
return result;
112205
}
113206
}
207+
208+
const $core.bool _omitFieldNames =
209+
$core.bool.fromEnvironment('protobuf.omit_field_names');
210+
const $core.bool _omitMessageNames =
211+
$core.bool.fromEnvironment('protobuf.omit_message_names');

lib/src/protobuf/any.pbenum.dart

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
///
2-
// Generated code. Do not modify.
3-
// source: google/protobuf/any.proto
1+
// This is a generated file - do not edit.
42
//
5-
// @dart = 2.12
6-
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
3+
// Generated from google/protobuf/any.proto.
4+
5+
// @dart = 3.3
6+
7+
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
8+
// ignore_for_file: constant_identifier_names
9+
// ignore_for_file: curly_braces_in_flow_control_structures
10+
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
11+
// ignore_for_file: non_constant_identifier_names

lib/src/protobuf/any.pbjson.dart

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1-
///
2-
// Generated code. Do not modify.
3-
// source: google/protobuf/any.proto
1+
// This is a generated file - do not edit.
42
//
5-
// @dart = 2.12
6-
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package, constant_identifier_names
3+
// Generated from google/protobuf/any.proto.
4+
5+
// @dart = 3.3
6+
7+
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
8+
// ignore_for_file: constant_identifier_names
9+
// ignore_for_file: curly_braces_in_flow_control_structures
10+
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
11+
// ignore_for_file: non_constant_identifier_names, unused_import
712

8-
import 'dart:core' as $core;
913
import 'dart:convert' as $convert;
14+
import 'dart:core' as $core;
1015
import 'dart:typed_data' as $typed_data;
1116

1217
@$core.Deprecated('Use anyDescriptor instead')
13-
const Any$json = const {
18+
const Any$json = {
1419
'1': 'Any',
15-
'2': const [
16-
const {'1': 'type_url', '3': 1, '4': 1, '5': 9, '10': 'typeUrl'},
17-
const {'1': 'value', '3': 2, '4': 1, '5': 12, '10': 'value'},
20+
'2': [
21+
{'1': 'type_url', '3': 1, '4': 1, '5': 9, '10': 'typeUrl'},
22+
{'1': 'value', '3': 2, '4': 1, '5': 12, '10': 'value'},
1823
],
1924
};
2025

0 commit comments

Comments
 (0)