protobug_well_known_protos 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,133 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Code generated by protoc-gen-protobug. DO NOT EDIT.
4
+
5
+ # source: google/protobuf/duration.proto
6
+ # syntax: proto3
7
+ # package: google.protobuf
8
+ # options:
9
+ # java_package: "com.google.protobuf"
10
+ # java_outer_classname: "DurationProto"
11
+ # java_multiple_files: true
12
+ # go_package: "google.golang.org/protobuf/types/known/durationpb"
13
+ # cc_enable_arenas: true
14
+ # objc_class_prefix: "GPB"
15
+ # csharp_namespace: "Google.Protobuf.WellKnownTypes"
16
+
17
+ # Protocol Buffers - Google's data interchange format
18
+ # Copyright 2008 Google Inc. All rights reserved.
19
+ # https://developers.google.com/protocol-buffers/
20
+ #
21
+ # Redistribution and use in source and binary forms, with or without
22
+ # modification, are permitted provided that the following conditions are
23
+ # met:
24
+ #
25
+ # * Redistributions of source code must retain the above copyright
26
+ # notice, this list of conditions and the following disclaimer.
27
+ # * Redistributions in binary form must reproduce the above
28
+ # copyright notice, this list of conditions and the following disclaimer
29
+ # in the documentation and/or other materials provided with the
30
+ # distribution.
31
+ # * Neither the name of Google Inc. nor the names of its
32
+ # contributors may be used to endorse or promote products derived from
33
+ # this software without specific prior written permission.
34
+ #
35
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46
+
47
+ require "protobug"
48
+
49
+ module Google
50
+ module Protobuf
51
+ # A Duration represents a signed, fixed-length span of time represented
52
+ # as a count of seconds and fractions of seconds at nanosecond
53
+ # resolution. It is independent of any calendar and concepts like "day"
54
+ # or "month". It is related to Timestamp in that the difference between
55
+ # two Timestamp values is a Duration and it can be added or subtracted
56
+ # from a Timestamp. Range is approximately +-10,000 years.
57
+ #
58
+ # # Examples
59
+ #
60
+ # Example 1: Compute Duration from two Timestamps in pseudo code.
61
+ #
62
+ # Timestamp start = ...;
63
+ # Timestamp end = ...;
64
+ # Duration duration = ...;
65
+ #
66
+ # duration.seconds = end.seconds - start.seconds;
67
+ # duration.nanos = end.nanos - start.nanos;
68
+ #
69
+ # if (duration.seconds < 0 && duration.nanos > 0) {
70
+ # duration.seconds += 1;
71
+ # duration.nanos -= 1000000000;
72
+ # } else if (duration.seconds > 0 && duration.nanos < 0) {
73
+ # duration.seconds -= 1;
74
+ # duration.nanos += 1000000000;
75
+ # }
76
+ #
77
+ # Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
78
+ #
79
+ # Timestamp start = ...;
80
+ # Duration duration = ...;
81
+ # Timestamp end = ...;
82
+ #
83
+ # end.seconds = start.seconds + duration.seconds;
84
+ # end.nanos = start.nanos + duration.nanos;
85
+ #
86
+ # if (end.nanos < 0) {
87
+ # end.seconds -= 1;
88
+ # end.nanos += 1000000000;
89
+ # } else if (end.nanos >= 1000000000) {
90
+ # end.seconds += 1;
91
+ # end.nanos -= 1000000000;
92
+ # }
93
+ #
94
+ # Example 3: Compute Duration from datetime.timedelta in Python.
95
+ #
96
+ # td = datetime.timedelta(days=3, minutes=10)
97
+ # duration = Duration()
98
+ # duration.FromTimedelta(td)
99
+ #
100
+ # # JSON Mapping
101
+ #
102
+ # In JSON format, the Duration type is encoded as a string rather than an
103
+ # object, where the string ends in the suffix "s" (indicating seconds) and
104
+ # is preceded by the number of seconds, with nanoseconds expressed as
105
+ # fractional seconds. For example, 3 seconds with 0 nanoseconds should be
106
+ # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
107
+ # be expressed in JSON format as "3.000000001s", and 3 seconds and 1
108
+ # microsecond should be expressed in JSON format as "3.000001s".
109
+ class Duration
110
+ extend Protobug::Message
111
+
112
+ self.full_name = "google.protobuf.Duration"
113
+
114
+ # Signed seconds of the span of time. Must be from -315,576,000,000
115
+ # to +315,576,000,000 inclusive. Note: these bounds are computed from:
116
+ # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
117
+ optional(1, "seconds", type: :int64, proto3_optional: false)
118
+ # Signed fractions of a second at nanosecond resolution of the span
119
+ # of time. Durations less than one second are represented with a 0
120
+ # `seconds` field and a positive or negative `nanos` field. For durations
121
+ # of one second or more, a non-zero value for the `nanos` field must be
122
+ # of the same sign as the `seconds` field. Must be from -999,999,999
123
+ # to +999,999,999 inclusive.
124
+ optional(2, "nanos", type: :int32, proto3_optional: false)
125
+ end
126
+
127
+ def self.register_duration_protos(registry)
128
+ registry.register(Google::Protobuf::Duration)
129
+ end
130
+ end
131
+ end
132
+
133
+ require_relative "duration_well_known"
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ Google::Protobuf::Duration.class_eval do
4
+ # Returns the number of seconds represented by this Duration
5
+ def to_f
6
+ seconds + (nanos.to_f / 1_000_000_000)
7
+ end
8
+
9
+ def self.decode_json_hash(json, registry:, ignore_unknown_fields: false)
10
+ return Protobug::UNSET if json.nil?
11
+ raise Protobug::DecodeError, "expected string for #{full_name}, got #{json.inspect}" unless json.is_a? String
12
+
13
+ unless /\A(-)?(\d+)(?:\.(\d+))?s\z/ =~ json
14
+ raise Protobug::DecodeError, "expected string for #{full_name}, got #{json.inspect}"
15
+ end
16
+
17
+ sign = Regexp.last_match(1) ? -1 : 1
18
+ seconds = Regexp.last_match(2).to_i
19
+ nanos = Regexp.last_match(3)&.ljust(9, "0").to_i
20
+ validate_json_range(Protobug::DecodeError, seconds, nanos)
21
+ json = {
22
+ "seconds" => sign * seconds,
23
+ "nanos" => sign * nanos
24
+ }
25
+ super
26
+ end
27
+
28
+ def as_json(print_unknown_fields: false) # rubocop:disable Lint/UnusedMethodArgument
29
+ seconds = self.seconds
30
+ nanos = self.nanos
31
+
32
+ self.class.validate_json_range(Protobug::EncodeError, seconds, nanos)
33
+
34
+ sign = seconds.negative? ? "-" : ""
35
+ sign = "-" if seconds.zero? && nanos.negative?
36
+ seconds = seconds.abs
37
+ nanos = nanos.abs
38
+ if nanos.nonzero?
39
+ nanos_s = ".#{nanos.to_s.rjust(9, "0")}"
40
+ nil while nanos_s.delete_suffix!("000")
41
+ end
42
+ "#{sign}#{seconds}#{nanos_s}s"
43
+ end
44
+
45
+ def self.validate_json_range(err, seconds, nanos)
46
+ if seconds != 0 && nanos != 0 && (seconds.negative? ^ nanos.negative?)
47
+ raise err, "seconds and nanos must have the same sign"
48
+ end
49
+
50
+ raise err, "seconds out of range for json duration" if seconds < -315_576_000_000 || seconds > +315_576_000_000
51
+ end
52
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Code generated by protoc-gen-protobug. DO NOT EDIT.
4
+
5
+ # source: google/protobuf/empty.proto
6
+ # syntax: proto3
7
+ # package: google.protobuf
8
+ # options:
9
+ # java_package: "com.google.protobuf"
10
+ # java_outer_classname: "EmptyProto"
11
+ # java_multiple_files: true
12
+ # go_package: "google.golang.org/protobuf/types/known/emptypb"
13
+ # cc_enable_arenas: true
14
+ # objc_class_prefix: "GPB"
15
+ # csharp_namespace: "Google.Protobuf.WellKnownTypes"
16
+
17
+ # Protocol Buffers - Google's data interchange format
18
+ # Copyright 2008 Google Inc. All rights reserved.
19
+ # https://developers.google.com/protocol-buffers/
20
+ #
21
+ # Redistribution and use in source and binary forms, with or without
22
+ # modification, are permitted provided that the following conditions are
23
+ # met:
24
+ #
25
+ # * Redistributions of source code must retain the above copyright
26
+ # notice, this list of conditions and the following disclaimer.
27
+ # * Redistributions in binary form must reproduce the above
28
+ # copyright notice, this list of conditions and the following disclaimer
29
+ # in the documentation and/or other materials provided with the
30
+ # distribution.
31
+ # * Neither the name of Google Inc. nor the names of its
32
+ # contributors may be used to endorse or promote products derived from
33
+ # this software without specific prior written permission.
34
+ #
35
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46
+
47
+ require "protobug"
48
+
49
+ module Google
50
+ module Protobuf
51
+ # A generic empty message that you can re-use to avoid defining duplicated
52
+ # empty messages in your APIs. A typical example is to use it as the request
53
+ # or the response type of an API method. For instance:
54
+ #
55
+ # service Foo {
56
+ # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
57
+ # }
58
+ class Empty
59
+ extend Protobug::Message
60
+
61
+ self.full_name = "google.protobuf.Empty"
62
+ end
63
+
64
+ def self.register_empty_protos(registry)
65
+ registry.register(Google::Protobuf::Empty)
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,265 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Code generated by protoc-gen-protobug. DO NOT EDIT.
4
+
5
+ # source: google/protobuf/field_mask.proto
6
+ # syntax: proto3
7
+ # package: google.protobuf
8
+ # options:
9
+ # java_package: "com.google.protobuf"
10
+ # java_outer_classname: "FieldMaskProto"
11
+ # java_multiple_files: true
12
+ # go_package: "google.golang.org/protobuf/types/known/fieldmaskpb"
13
+ # cc_enable_arenas: true
14
+ # objc_class_prefix: "GPB"
15
+ # csharp_namespace: "Google.Protobuf.WellKnownTypes"
16
+
17
+ # Protocol Buffers - Google's data interchange format
18
+ # Copyright 2008 Google Inc. All rights reserved.
19
+ # https://developers.google.com/protocol-buffers/
20
+ #
21
+ # Redistribution and use in source and binary forms, with or without
22
+ # modification, are permitted provided that the following conditions are
23
+ # met:
24
+ #
25
+ # * Redistributions of source code must retain the above copyright
26
+ # notice, this list of conditions and the following disclaimer.
27
+ # * Redistributions in binary form must reproduce the above
28
+ # copyright notice, this list of conditions and the following disclaimer
29
+ # in the documentation and/or other materials provided with the
30
+ # distribution.
31
+ # * Neither the name of Google Inc. nor the names of its
32
+ # contributors may be used to endorse or promote products derived from
33
+ # this software without specific prior written permission.
34
+ #
35
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46
+
47
+ require "protobug"
48
+
49
+ module Google
50
+ module Protobuf
51
+ # `FieldMask` represents a set of symbolic field paths, for example:
52
+ #
53
+ # paths: "f.a"
54
+ # paths: "f.b.d"
55
+ #
56
+ # Here `f` represents a field in some root message, `a` and `b`
57
+ # fields in the message found in `f`, and `d` a field found in the
58
+ # message in `f.b`.
59
+ #
60
+ # Field masks are used to specify a subset of fields that should be
61
+ # returned by a get operation or modified by an update operation.
62
+ # Field masks also have a custom JSON encoding (see below).
63
+ #
64
+ # # Field Masks in Projections
65
+ #
66
+ # When used in the context of a projection, a response message or
67
+ # sub-message is filtered by the API to only contain those fields as
68
+ # specified in the mask. For example, if the mask in the previous
69
+ # example is applied to a response message as follows:
70
+ #
71
+ # f {
72
+ # a : 22
73
+ # b {
74
+ # d : 1
75
+ # x : 2
76
+ # }
77
+ # y : 13
78
+ # }
79
+ # z: 8
80
+ #
81
+ # The result will not contain specific values for fields x,y and z
82
+ # (their value will be set to the default, and omitted in proto text
83
+ # output):
84
+ #
85
+ #
86
+ # f {
87
+ # a : 22
88
+ # b {
89
+ # d : 1
90
+ # }
91
+ # }
92
+ #
93
+ # A repeated field is not allowed except at the last position of a
94
+ # paths string.
95
+ #
96
+ # If a FieldMask object is not present in a get operation, the
97
+ # operation applies to all fields (as if a FieldMask of all fields
98
+ # had been specified).
99
+ #
100
+ # Note that a field mask does not necessarily apply to the
101
+ # top-level response message. In case of a REST get operation, the
102
+ # field mask applies directly to the response, but in case of a REST
103
+ # list operation, the mask instead applies to each individual message
104
+ # in the returned resource list. In case of a REST custom method,
105
+ # other definitions may be used. Where the mask applies will be
106
+ # clearly documented together with its declaration in the API. In
107
+ # any case, the effect on the returned resource/resources is required
108
+ # behavior for APIs.
109
+ #
110
+ # # Field Masks in Update Operations
111
+ #
112
+ # A field mask in update operations specifies which fields of the
113
+ # targeted resource are going to be updated. The API is required
114
+ # to only change the values of the fields as specified in the mask
115
+ # and leave the others untouched. If a resource is passed in to
116
+ # describe the updated values, the API ignores the values of all
117
+ # fields not covered by the mask.
118
+ #
119
+ # If a repeated field is specified for an update operation, new values will
120
+ # be appended to the existing repeated field in the target resource. Note that
121
+ # a repeated field is only allowed in the last position of a `paths` string.
122
+ #
123
+ # If a sub-message is specified in the last position of the field mask for an
124
+ # update operation, then new value will be merged into the existing sub-message
125
+ # in the target resource.
126
+ #
127
+ # For example, given the target message:
128
+ #
129
+ # f {
130
+ # b {
131
+ # d: 1
132
+ # x: 2
133
+ # }
134
+ # c: [1]
135
+ # }
136
+ #
137
+ # And an update message:
138
+ #
139
+ # f {
140
+ # b {
141
+ # d: 10
142
+ # }
143
+ # c: [2]
144
+ # }
145
+ #
146
+ # then if the field mask is:
147
+ #
148
+ # paths: ["f.b", "f.c"]
149
+ #
150
+ # then the result will be:
151
+ #
152
+ # f {
153
+ # b {
154
+ # d: 10
155
+ # x: 2
156
+ # }
157
+ # c: [1, 2]
158
+ # }
159
+ #
160
+ # An implementation may provide options to override this default behavior for
161
+ # repeated and message fields.
162
+ #
163
+ # In order to reset a field's value to the default, the field must
164
+ # be in the mask and set to the default value in the provided resource.
165
+ # Hence, in order to reset all fields of a resource, provide a default
166
+ # instance of the resource and set all fields in the mask, or do
167
+ # not provide a mask as described below.
168
+ #
169
+ # If a field mask is not present on update, the operation applies to
170
+ # all fields (as if a field mask of all fields has been specified).
171
+ # Note that in the presence of schema evolution, this may mean that
172
+ # fields the client does not know and has therefore not filled into
173
+ # the request will be reset to their default. If this is unwanted
174
+ # behavior, a specific service may require a client to always specify
175
+ # a field mask, producing an error if not.
176
+ #
177
+ # As with get operations, the location of the resource which
178
+ # describes the updated values in the request message depends on the
179
+ # operation kind. In any case, the effect of the field mask is
180
+ # required to be honored by the API.
181
+ #
182
+ # ## Considerations for HTTP REST
183
+ #
184
+ # The HTTP kind of an update operation which uses a field mask must
185
+ # be set to PATCH instead of PUT in order to satisfy HTTP semantics
186
+ # (PUT must only be used for full updates).
187
+ #
188
+ # # JSON Encoding of Field Masks
189
+ #
190
+ # In JSON, a field mask is encoded as a single string where paths are
191
+ # separated by a comma. Fields name in each path are converted
192
+ # to/from lower-camel naming conventions.
193
+ #
194
+ # As an example, consider the following message declarations:
195
+ #
196
+ # message Profile {
197
+ # User user = 1;
198
+ # Photo photo = 2;
199
+ # }
200
+ # message User {
201
+ # string display_name = 1;
202
+ # string address = 2;
203
+ # }
204
+ #
205
+ # In proto a field mask for `Profile` may look as such:
206
+ #
207
+ # mask {
208
+ # paths: "user.display_name"
209
+ # paths: "photo"
210
+ # }
211
+ #
212
+ # In JSON, the same mask is represented as below:
213
+ #
214
+ # {
215
+ # mask: "user.displayName,photo"
216
+ # }
217
+ #
218
+ # # Field Masks and Oneof Fields
219
+ #
220
+ # Field masks treat fields in oneofs just as regular fields. Consider the
221
+ # following message:
222
+ #
223
+ # message SampleMessage {
224
+ # oneof test_oneof {
225
+ # string name = 4;
226
+ # SubMessage sub_message = 9;
227
+ # }
228
+ # }
229
+ #
230
+ # The field mask can be:
231
+ #
232
+ # mask {
233
+ # paths: "name"
234
+ # }
235
+ #
236
+ # Or:
237
+ #
238
+ # mask {
239
+ # paths: "sub_message"
240
+ # }
241
+ #
242
+ # Note that oneof type names ("test_oneof" in this case) cannot be used in
243
+ # paths.
244
+ #
245
+ # ## Field Mask Verification
246
+ #
247
+ # The implementation of any API method which has a FieldMask type field in the
248
+ # request should verify the included field paths, and return an
249
+ # `INVALID_ARGUMENT` error if any path is unmappable.
250
+ class FieldMask
251
+ extend Protobug::Message
252
+
253
+ self.full_name = "google.protobuf.FieldMask"
254
+
255
+ # The set of field mask paths.
256
+ repeated(1, "paths", type: :string)
257
+ end
258
+
259
+ def self.register_field_mask_protos(registry)
260
+ registry.register(Google::Protobuf::FieldMask)
261
+ end
262
+ end
263
+ end
264
+
265
+ require_relative "field_mask_well_known"
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ Google::Protobuf::FieldMask.class_eval do
4
+ def self.decode_json_hash(json, registry:, ignore_unknown_fields: false)
5
+ raise DecodeError, "expected string for #{full_name}, got #{json.inspect}" unless json.is_a? String
6
+
7
+ paths = json.split(",").each do |field|
8
+ unless /\A[a-zA-Z]+\z/.match?(field)
9
+ raise Protobug::DecodeError,
10
+ "field mask has invalid characters from JSON: #{field.inspect}"
11
+ end
12
+
13
+ field.gsub!(/(?<!\A)([A-Z])/) do |m|
14
+ "_#{m.downcase}"
15
+ end
16
+ end
17
+ json = { "paths" => paths }
18
+ super
19
+ end
20
+
21
+ def as_json(print_unknown_fields: false)
22
+ _ = print_unknown_fields
23
+
24
+ paths.map do |path|
25
+ unless /\A[a-z]+(_[a-z]+)*\z/.match?(path)
26
+ raise Protobug::EncodeError,
27
+ "cannot encode field mask paths to JSON with non-lowercase-alpha characters: #{path.inspect}"
28
+ end
29
+
30
+ path.gsub(/(?<!\A)(?:_([a-z]+))/, &:capitalize)
31
+ end.join(",")
32
+ end
33
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Code generated by protoc-gen-protobug. DO NOT EDIT.
4
+
5
+ # source: google/protobuf/source_context.proto
6
+ # syntax: proto3
7
+ # package: google.protobuf
8
+ # options:
9
+ # java_package: "com.google.protobuf"
10
+ # java_outer_classname: "SourceContextProto"
11
+ # java_multiple_files: true
12
+ # go_package: "google.golang.org/protobuf/types/known/sourcecontextpb"
13
+ # objc_class_prefix: "GPB"
14
+ # csharp_namespace: "Google.Protobuf.WellKnownTypes"
15
+
16
+ # Protocol Buffers - Google's data interchange format
17
+ # Copyright 2008 Google Inc. All rights reserved.
18
+ # https://developers.google.com/protocol-buffers/
19
+ #
20
+ # Redistribution and use in source and binary forms, with or without
21
+ # modification, are permitted provided that the following conditions are
22
+ # met:
23
+ #
24
+ # * Redistributions of source code must retain the above copyright
25
+ # notice, this list of conditions and the following disclaimer.
26
+ # * Redistributions in binary form must reproduce the above
27
+ # copyright notice, this list of conditions and the following disclaimer
28
+ # in the documentation and/or other materials provided with the
29
+ # distribution.
30
+ # * Neither the name of Google Inc. nor the names of its
31
+ # contributors may be used to endorse or promote products derived from
32
+ # this software without specific prior written permission.
33
+ #
34
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
35
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
36
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
37
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
38
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
39
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
40
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
41
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
42
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
43
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
44
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45
+
46
+ require "protobug"
47
+
48
+ module Google
49
+ module Protobuf
50
+ # `SourceContext` represents information about the source of a
51
+ # protobuf element, like the file in which it is defined.
52
+ class SourceContext
53
+ extend Protobug::Message
54
+
55
+ self.full_name = "google.protobuf.SourceContext"
56
+
57
+ # The path-qualified name of the .proto file that contained the associated
58
+ # protobuf element. For example: `"google/protobuf/source_context.proto"`.
59
+ optional(
60
+ 1,
61
+ "file_name",
62
+ type: :string,
63
+ json_name: "fileName",
64
+ proto3_optional: false
65
+ )
66
+ end
67
+
68
+ def self.register_source_context_protos(registry)
69
+ registry.register(Google::Protobuf::SourceContext)
70
+ end
71
+ end
72
+ end