protostar 0.1.0.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +60 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +647 -0
  5. data/THIRD_PARTY_NOTICES.md +61 -0
  6. data/exe/protoc-gen-protostar +7 -0
  7. data/exe/protostar +7 -0
  8. data/lib/protostar/builder/generator.rb +71 -0
  9. data/lib/protostar/builder/sink.rb +35 -0
  10. data/lib/protostar/builder.rb +965 -0
  11. data/lib/protostar/cli.rb +267 -0
  12. data/lib/protostar/codec/decode_generator.rb +199 -0
  13. data/lib/protostar/codec/decoder.rb +296 -0
  14. data/lib/protostar/codec/encode_generator.rb +224 -0
  15. data/lib/protostar/codec/encoder.rb +121 -0
  16. data/lib/protostar/codec/sizer.rb +91 -0
  17. data/lib/protostar/codec.rb +15 -0
  18. data/lib/protostar/compiler/ast.rb +193 -0
  19. data/lib/protostar/compiler/emitters/descriptor_set.rb +57 -0
  20. data/lib/protostar/compiler/emitters/google_ruby.rb +103 -0
  21. data/lib/protostar/compiler/emitters/grpc.rb +175 -0
  22. data/lib/protostar/compiler/emitters/protostar_rbs.rb +252 -0
  23. data/lib/protostar/compiler/emitters/rbs.rb +394 -0
  24. data/lib/protostar/compiler/emitters/ruby.rb +503 -0
  25. data/lib/protostar/compiler/emitters.rb +268 -0
  26. data/lib/protostar/compiler/include/LICENSE +32 -0
  27. data/lib/protostar/compiler/include/google/protobuf/any.proto +106 -0
  28. data/lib/protostar/compiler/include/google/protobuf/api.proto +229 -0
  29. data/lib/protostar/compiler/include/google/protobuf/compiler/plugin.proto +180 -0
  30. data/lib/protostar/compiler/include/google/protobuf/cpp_features.proto +87 -0
  31. data/lib/protostar/compiler/include/google/protobuf/descriptor.proto +1532 -0
  32. data/lib/protostar/compiler/include/google/protobuf/duration.proto +115 -0
  33. data/lib/protostar/compiler/include/google/protobuf/empty.proto +51 -0
  34. data/lib/protostar/compiler/include/google/protobuf/field_mask.proto +243 -0
  35. data/lib/protostar/compiler/include/google/protobuf/java_features.proto +132 -0
  36. data/lib/protostar/compiler/include/google/protobuf/source_context.proto +48 -0
  37. data/lib/protostar/compiler/include/google/protobuf/struct.proto +111 -0
  38. data/lib/protostar/compiler/include/google/protobuf/timestamp.proto +145 -0
  39. data/lib/protostar/compiler/include/google/protobuf/type.proto +217 -0
  40. data/lib/protostar/compiler/include/google/protobuf/wrappers.proto +157 -0
  41. data/lib/protostar/compiler/lexer.rb +659 -0
  42. data/lib/protostar/compiler/linker.rb +894 -0
  43. data/lib/protostar/compiler/option_interpreter.rb +363 -0
  44. data/lib/protostar/compiler/parser.rb +1696 -0
  45. data/lib/protostar/compiler/retention.rb +104 -0
  46. data/lib/protostar/compiler/run.rb +184 -0
  47. data/lib/protostar/compiler/source_info.rb +161 -0
  48. data/lib/protostar/compiler/symbol_table.rb +223 -0
  49. data/lib/protostar/compiler/text_format.rb +340 -0
  50. data/lib/protostar/compiler/validator.rb +944 -0
  51. data/lib/protostar/compiler.rb +304 -0
  52. data/lib/protostar/diagnostics/codes.rb +1307 -0
  53. data/lib/protostar/diagnostics/formats.rb +64 -0
  54. data/lib/protostar/diagnostics/renderer.rb +240 -0
  55. data/lib/protostar/diagnostics/source.rb +153 -0
  56. data/lib/protostar/diagnostics.rb +117 -0
  57. data/lib/protostar/dsl.rb +367 -0
  58. data/lib/protostar/enum.rb +70 -0
  59. data/lib/protostar/errors.rb +23 -0
  60. data/lib/protostar/google/protobuf/any_pb.rb +90 -0
  61. data/lib/protostar/google/protobuf/api_pb.rb +199 -0
  62. data/lib/protostar/google/protobuf/compiler/plugin_pb.rb +168 -0
  63. data/lib/protostar/google/protobuf/descriptor_pb.rb +1239 -0
  64. data/lib/protostar/google/protobuf/duration_pb.rb +99 -0
  65. data/lib/protostar/google/protobuf/empty_pb.rb +36 -0
  66. data/lib/protostar/google/protobuf/field_mask_pb.rb +228 -0
  67. data/lib/protostar/google/protobuf/source_context_pb.rb +33 -0
  68. data/lib/protostar/google/protobuf/struct_pb.rb +91 -0
  69. data/lib/protostar/google/protobuf/timestamp_pb.rb +129 -0
  70. data/lib/protostar/google/protobuf/type_pb.rb +202 -0
  71. data/lib/protostar/google/protobuf/wrappers_pb.rb +125 -0
  72. data/lib/protostar/google_protobuf_shim.rb +24 -0
  73. data/lib/protostar/json/encoder.rb +340 -0
  74. data/lib/protostar/json/errors.rb +34 -0
  75. data/lib/protostar/json/parser.rb +437 -0
  76. data/lib/protostar/json/path.rb +39 -0
  77. data/lib/protostar/json.rb +95 -0
  78. data/lib/protostar/lint/command.rb +197 -0
  79. data/lib/protostar/lint/config.rb +98 -0
  80. data/lib/protostar/lint/context.rb +126 -0
  81. data/lib/protostar/lint/directives.rb +56 -0
  82. data/lib/protostar/lint/fixer.rb +165 -0
  83. data/lib/protostar/lint/naming.rb +54 -0
  84. data/lib/protostar/lint/rule.rb +120 -0
  85. data/lib/protostar/lint/rules/comment_enum.rb +31 -0
  86. data/lib/protostar/lint/rules/comment_enum_value.rb +32 -0
  87. data/lib/protostar/lint/rules/comment_field.rb +33 -0
  88. data/lib/protostar/lint/rules/comment_message.rb +31 -0
  89. data/lib/protostar/lint/rules/comment_rpc.rb +31 -0
  90. data/lib/protostar/lint/rules/comment_service.rb +31 -0
  91. data/lib/protostar/lint/rules/edition_recommended.rb +31 -0
  92. data/lib/protostar/lint/rules/enum_first_value_zero.rb +34 -0
  93. data/lib/protostar/lint/rules/enum_pascal_case.rb +25 -0
  94. data/lib/protostar/lint/rules/enum_value_prefix.rb +38 -0
  95. data/lib/protostar/lint/rules/enum_value_upper_snake_case.rb +28 -0
  96. data/lib/protostar/lint/rules/enum_zero_value_suffix.rb +41 -0
  97. data/lib/protostar/lint/rules/field_lower_snake_case.rb +34 -0
  98. data/lib/protostar/lint/rules/field_not_required.rb +39 -0
  99. data/lib/protostar/lint/rules/field_number_reuse_risk.rb +45 -0
  100. data/lib/protostar/lint/rules/field_numbers_hot_range.rb +44 -0
  101. data/lib/protostar/lint/rules/file_lower_snake_case.rb +27 -0
  102. data/lib/protostar/lint/rules/import_no_public.rb +29 -0
  103. data/lib/protostar/lint/rules/import_no_weak.rb +28 -0
  104. data/lib/protostar/lint/rules/import_used.rb +33 -0
  105. data/lib/protostar/lint/rules/message_pascal_case.rb +27 -0
  106. data/lib/protostar/lint/rules/no_deprecated_features.rb +50 -0
  107. data/lib/protostar/lint/rules/no_groups.rb +34 -0
  108. data/lib/protostar/lint/rules/oneof_lower_snake_case.rb +27 -0
  109. data/lib/protostar/lint/rules/package_defined.rb +28 -0
  110. data/lib/protostar/lint/rules/package_directory_match.rb +33 -0
  111. data/lib/protostar/lint/rules/package_lower_snake_case.rb +28 -0
  112. data/lib/protostar/lint/rules/package_same_directory.rb +39 -0
  113. data/lib/protostar/lint/rules/package_version_suffix.rb +31 -0
  114. data/lib/protostar/lint/rules/reserved_names_with_numbers.rb +44 -0
  115. data/lib/protostar/lint/rules/rpc_pascal_case.rb +25 -0
  116. data/lib/protostar/lint/rules/rpc_request_response_unique.rb +40 -0
  117. data/lib/protostar/lint/rules/rpc_request_standard_name.rb +32 -0
  118. data/lib/protostar/lint/rules/rpc_response_standard_name.rb +31 -0
  119. data/lib/protostar/lint/rules/service_pascal_case.rb +25 -0
  120. data/lib/protostar/lint/rules/service_suffix.rb +28 -0
  121. data/lib/protostar/lint/rules/syntax_specified.rb +35 -0
  122. data/lib/protostar/lint/runner.rb +135 -0
  123. data/lib/protostar/lint.rb +122 -0
  124. data/lib/protostar/message/accessors.rb +86 -0
  125. data/lib/protostar/message/coercion.rb +171 -0
  126. data/lib/protostar/message/field_info.rb +145 -0
  127. data/lib/protostar/message/reflection.rb +149 -0
  128. data/lib/protostar/message.rb +572 -0
  129. data/lib/protostar/plugin.rb +94 -0
  130. data/lib/protostar/schema/default_value.rb +113 -0
  131. data/lib/protostar/schema/descriptor.rb +41 -0
  132. data/lib/protostar/schema/draft/copy.rb +88 -0
  133. data/lib/protostar/schema/draft/resolution.rb +177 -0
  134. data/lib/protostar/schema/draft.rb +779 -0
  135. data/lib/protostar/schema/enum.rb +106 -0
  136. data/lib/protostar/schema/extension_range.rb +37 -0
  137. data/lib/protostar/schema/features.rb +153 -0
  138. data/lib/protostar/schema/field.rb +201 -0
  139. data/lib/protostar/schema/file.rb +217 -0
  140. data/lib/protostar/schema/freezer.rb +61 -0
  141. data/lib/protostar/schema/message.rb +104 -0
  142. data/lib/protostar/schema/oneof.rb +38 -0
  143. data/lib/protostar/schema/options.rb +367 -0
  144. data/lib/protostar/schema/pool.rb +179 -0
  145. data/lib/protostar/schema/proto.rb +576 -0
  146. data/lib/protostar/schema/resolver.rb +118 -0
  147. data/lib/protostar/schema/service.rb +89 -0
  148. data/lib/protostar/schema/source_info.rb +53 -0
  149. data/lib/protostar/schema.rb +65 -0
  150. data/lib/protostar/short_names/any.rb +7 -0
  151. data/lib/protostar/short_names/duration.rb +7 -0
  152. data/lib/protostar/short_names/empty.rb +7 -0
  153. data/lib/protostar/short_names/field_mask.rb +7 -0
  154. data/lib/protostar/short_names/struct.rb +9 -0
  155. data/lib/protostar/short_names/timestamp.rb +7 -0
  156. data/lib/protostar/short_names/wrappers.rb +15 -0
  157. data/lib/protostar/text/extensions.rb +114 -0
  158. data/lib/protostar/text/parser.rb +439 -0
  159. data/lib/protostar/text/printer.rb +304 -0
  160. data/lib/protostar/text/tokenizer.rb +116 -0
  161. data/lib/protostar/text.rb +67 -0
  162. data/lib/protostar/types.rb +152 -0
  163. data/lib/protostar/unknown_field.rb +58 -0
  164. data/lib/protostar/version.rb +5 -0
  165. data/lib/protostar/view/generator.rb +298 -0
  166. data/lib/protostar/view/map.rb +194 -0
  167. data/lib/protostar/view/repeated.rb +143 -0
  168. data/lib/protostar/view/scan.rb +183 -0
  169. data/lib/protostar/view.rb +283 -0
  170. data/lib/protostar/well_known/any.rb +52 -0
  171. data/lib/protostar/well_known/duration.rb +53 -0
  172. data/lib/protostar/well_known/list_value.rb +63 -0
  173. data/lib/protostar/well_known/struct.rb +55 -0
  174. data/lib/protostar/well_known/timestamp.rb +64 -0
  175. data/lib/protostar/well_known/value.rb +60 -0
  176. data/lib/protostar/well_known.rb +38 -0
  177. data/lib/protostar/wire/io_source.rb +40 -0
  178. data/lib/protostar/wire/reader.rb +254 -0
  179. data/lib/protostar/wire/writer.rb +201 -0
  180. data/lib/protostar/wire.rb +96 -0
  181. data/lib/protostar.rb +95 -0
  182. data/shims/google-protobuf/lib/google/protobuf/any_pb.rb +17 -0
  183. data/shims/google-protobuf/lib/google/protobuf/api_pb.rb +22 -0
  184. data/shims/google-protobuf/lib/google/protobuf/compiler/plugin_pb.rb +25 -0
  185. data/shims/google-protobuf/lib/google/protobuf/descriptor_pb.rb +72 -0
  186. data/shims/google-protobuf/lib/google/protobuf/descriptor_pool.rb +164 -0
  187. data/shims/google-protobuf/lib/google/protobuf/descriptors.rb +553 -0
  188. data/shims/google-protobuf/lib/google/protobuf/duration_pb.rb +17 -0
  189. data/shims/google-protobuf/lib/google/protobuf/empty_pb.rb +17 -0
  190. data/shims/google-protobuf/lib/google/protobuf/field_mask_pb.rb +17 -0
  191. data/shims/google-protobuf/lib/google/protobuf/internal/convert.rb +180 -0
  192. data/shims/google-protobuf/lib/google/protobuf/internal/extensions.rb +154 -0
  193. data/shims/google-protobuf/lib/google/protobuf/internal/json.rb +104 -0
  194. data/shims/google-protobuf/lib/google/protobuf/internal/well_known.rb +140 -0
  195. data/shims/google-protobuf/lib/google/protobuf/map.rb +216 -0
  196. data/shims/google-protobuf/lib/google/protobuf/message.rb +544 -0
  197. data/shims/google-protobuf/lib/google/protobuf/message_exts.rb +41 -0
  198. data/shims/google-protobuf/lib/google/protobuf/plugin_pb.rb +4 -0
  199. data/shims/google-protobuf/lib/google/protobuf/repeated_field.rb +366 -0
  200. data/shims/google-protobuf/lib/google/protobuf/source_context_pb.rb +17 -0
  201. data/shims/google-protobuf/lib/google/protobuf/struct_pb.rb +20 -0
  202. data/shims/google-protobuf/lib/google/protobuf/timestamp_pb.rb +17 -0
  203. data/shims/google-protobuf/lib/google/protobuf/type_pb.rb +27 -0
  204. data/shims/google-protobuf/lib/google/protobuf/well_known_types.rb +37 -0
  205. data/shims/google-protobuf/lib/google/protobuf/wrappers_pb.rb +25 -0
  206. data/shims/google-protobuf/lib/google/protobuf.rb +107 -0
  207. data/shims/google-protobuf/lib/google/protobuf_ffi.rb +5 -0
  208. data/shims/google-protobuf/lib/google/protobuf_native.rb +5 -0
  209. data/sig/protostar/google/protobuf/any_pb.rbs +77 -0
  210. data/sig/protostar/google/protobuf/api_pb.rbs +242 -0
  211. data/sig/protostar/google/protobuf/compiler/plugin_pb.rbs +264 -0
  212. data/sig/protostar/google/protobuf/descriptor_pb.rbs +2220 -0
  213. data/sig/protostar/google/protobuf/duration_pb.rbs +82 -0
  214. data/sig/protostar/google/protobuf/empty_pb.rbs +18 -0
  215. data/sig/protostar/google/protobuf/field_mask_pb.rbs +170 -0
  216. data/sig/protostar/google/protobuf/source_context_pb.rbs +24 -0
  217. data/sig/protostar/google/protobuf/struct_pb.rbs +135 -0
  218. data/sig/protostar/google/protobuf/timestamp_pb.rbs +102 -0
  219. data/sig/protostar/google/protobuf/type_pb.rbs +304 -0
  220. data/sig/protostar/google/protobuf/wrappers_pb.rbs +169 -0
  221. data/sig/protostar/lint.rbs +216 -0
  222. data/sig/protostar.rbs +326 -0
  223. metadata +366 -0
@@ -0,0 +1,82 @@
1
+ # Generated by protostar from google/protobuf/duration.proto. Do not edit.
2
+
3
+ module Protostar
4
+ module Google
5
+ module Protobuf
6
+ # A Duration represents a signed, fixed-length span of time represented
7
+ # as a count of seconds and fractions of seconds at nanosecond
8
+ # resolution. It is independent of any calendar and concepts like "day"
9
+ # or "month". It is related to Timestamp in that the difference between
10
+ # two Timestamp values is a Duration and it can be added or subtracted
11
+ # from a Timestamp. Range is approximately +-10,000 years.
12
+ # # Examples
13
+ # Example 1: Compute Duration from two Timestamps in pseudo code.
14
+ # Timestamp start = ...;
15
+ # Timestamp end = ...;
16
+ # Duration duration = ...;
17
+ # duration.seconds = end.seconds - start.seconds;
18
+ # duration.nanos = end.nanos - start.nanos;
19
+ # if (duration.seconds < 0 && duration.nanos > 0) {
20
+ # duration.seconds += 1;
21
+ # duration.nanos -= 1000000000;
22
+ # } else if (duration.seconds > 0 && duration.nanos < 0) {
23
+ # duration.seconds -= 1;
24
+ # duration.nanos += 1000000000;
25
+ # }
26
+ # Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
27
+ # Timestamp start = ...;
28
+ # Duration duration = ...;
29
+ # Timestamp end = ...;
30
+ # end.seconds = start.seconds + duration.seconds;
31
+ # end.nanos = start.nanos + duration.nanos;
32
+ # if (end.nanos < 0) {
33
+ # end.seconds -= 1;
34
+ # end.nanos += 1000000000;
35
+ # } else if (end.nanos >= 1000000000) {
36
+ # end.seconds += 1;
37
+ # end.nanos -= 1000000000;
38
+ # }
39
+ # Example 3: Compute Duration from datetime.timedelta in Python.
40
+ # td = datetime.timedelta(days=3, minutes=10)
41
+ # duration = Duration()
42
+ # duration.FromTimedelta(td)
43
+ # # JSON Mapping
44
+ # In JSON format, the Duration type is encoded as a string rather than an
45
+ # object, where the string ends in the suffix "s" (indicating seconds) and
46
+ # is preceded by the number of seconds, with nanoseconds expressed as
47
+ # fractional seconds. For example, 3 seconds with 0 nanoseconds should be
48
+ # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
49
+ # be expressed in JSON format as "3.000000001s", and 3 seconds and 1
50
+ # microsecond should be expressed in JSON format as "3.000001s".
51
+ class Duration < ::Protostar::Message
52
+ include ::Protostar::WellKnown::Duration
53
+ extend ::Protostar::WellKnown::Duration::ClassMethods
54
+
55
+ type init_map = {
56
+ ?seconds: ::Integer?,
57
+ ?nanos: ::Integer?
58
+ }
59
+ def initialize: (
60
+ ?init_map? fields,
61
+ ?seconds: ::Integer?,
62
+ ?nanos: ::Integer?
63
+ ) -> void
64
+
65
+ # Signed seconds of the span of time. Must be from -315,576,000,000
66
+ # to +315,576,000,000 inclusive. Note: these bounds are computed from:
67
+ # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
68
+ attr_reader seconds(): ::Integer
69
+ attr_writer seconds(): ::Integer?
70
+
71
+ # Signed fractions of a second at nanosecond resolution of the span
72
+ # of time. Durations less than one second are represented with a 0
73
+ # `seconds` field and a positive or negative `nanos` field. For durations
74
+ # of one second or more, a non-zero value for the `nanos` field must be
75
+ # of the same sign as the `seconds` field. Must be from -999,999,999
76
+ # to +999,999,999 inclusive.
77
+ attr_reader nanos(): ::Integer
78
+ attr_writer nanos(): ::Integer?
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,18 @@
1
+ # Generated by protostar from google/protobuf/empty.proto. Do not edit.
2
+
3
+ module Protostar
4
+ module Google
5
+ module Protobuf
6
+ # A generic empty message that you can re-use to avoid defining duplicated
7
+ # empty messages in your APIs. A typical example is to use it as the request
8
+ # or the response type of an API method. For instance:
9
+ # service Foo {
10
+ # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
11
+ # }
12
+ class Empty < ::Protostar::Message
13
+ type init_map = ::Hash[::Symbol | ::String, untyped]
14
+ def initialize: (?init_map? fields, **untyped) -> void
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,170 @@
1
+ # Generated by protostar from google/protobuf/field_mask.proto. Do not edit.
2
+
3
+ module Protostar
4
+ module Google
5
+ module Protobuf
6
+ # `FieldMask` represents a set of symbolic field paths, for example:
7
+ # paths: "f.a"
8
+ # paths: "f.b.d"
9
+ # Here `f` represents a field in some root message, `a` and `b`
10
+ # fields in the message found in `f`, and `d` a field found in the
11
+ # message in `f.b`.
12
+ # Field masks are used to specify a subset of fields that should be
13
+ # returned by a get operation or modified by an update operation.
14
+ # Field masks also have a custom JSON encoding (see below).
15
+ # # Field Masks in Projections
16
+ # When used in the context of a projection, a response message or
17
+ # sub-message is filtered by the API to only contain those fields as
18
+ # specified in the mask. For example, if the mask in the previous
19
+ # example is applied to a response message as follows:
20
+ # f {
21
+ # a : 22
22
+ # b {
23
+ # d : 1
24
+ # x : 2
25
+ # }
26
+ # y : 13
27
+ # }
28
+ # z: 8
29
+ # The result will not contain specific values for fields x,y and z
30
+ # (their value will be set to the default, and omitted in proto text
31
+ # output):
32
+ # f {
33
+ # a : 22
34
+ # b {
35
+ # d : 1
36
+ # }
37
+ # }
38
+ # A repeated field is not allowed except at the last position of a
39
+ # paths string.
40
+ # If a FieldMask object is not present in a get operation, the
41
+ # operation applies to all fields (as if a FieldMask of all fields
42
+ # had been specified).
43
+ # Note that a field mask does not necessarily apply to the
44
+ # top-level response message. In case of a REST get operation, the
45
+ # field mask applies directly to the response, but in case of a REST
46
+ # list operation, the mask instead applies to each individual message
47
+ # in the returned resource list. In case of a REST custom method,
48
+ # other definitions may be used. Where the mask applies will be
49
+ # clearly documented together with its declaration in the API. In
50
+ # any case, the effect on the returned resource/resources is required
51
+ # behavior for APIs.
52
+ # # Field Masks in Update Operations
53
+ # A field mask in update operations specifies which fields of the
54
+ # targeted resource are going to be updated. The API is required
55
+ # to only change the values of the fields as specified in the mask
56
+ # and leave the others untouched. If a resource is passed in to
57
+ # describe the updated values, the API ignores the values of all
58
+ # fields not covered by the mask.
59
+ # If a repeated field is specified for an update operation, new values will
60
+ # be appended to the existing repeated field in the target resource. Note that
61
+ # a repeated field is only allowed in the last position of a `paths` string.
62
+ # If a sub-message is specified in the last position of the field mask for an
63
+ # update operation, then new value will be merged into the existing sub-message
64
+ # in the target resource.
65
+ # For example, given the target message:
66
+ # f {
67
+ # b {
68
+ # d: 1
69
+ # x: 2
70
+ # }
71
+ # c: [1]
72
+ # }
73
+ # And an update message:
74
+ # f {
75
+ # b {
76
+ # d: 10
77
+ # }
78
+ # c: [2]
79
+ # }
80
+ # then if the field mask is:
81
+ # paths: ["f.b", "f.c"]
82
+ # then the result will be:
83
+ # f {
84
+ # b {
85
+ # d: 10
86
+ # x: 2
87
+ # }
88
+ # c: [1, 2]
89
+ # }
90
+ # An implementation may provide options to override this default behavior for
91
+ # repeated and message fields.
92
+ # Note that libraries which implement FieldMask resolution have various
93
+ # different behaviors in the face of empty masks or the special "*" mask.
94
+ # When implementing a service you should confirm these cases have the
95
+ # appropriate behavior in the underlying FieldMask library that you desire,
96
+ # and you may need to special case those cases in your application code if
97
+ # the underlying field mask library behavior differs from your intended
98
+ # service semantics.
99
+ # Update methods implementing https://google.aip.dev/134
100
+ # - MUST support the special value * meaning "full replace"
101
+ # - MUST treat an omitted field mask as "replace fields which are present".
102
+ # Other methods implementing https://google.aip.dev/157
103
+ # - SHOULD support the special value "*" to mean "get all".
104
+ # - MUST treat an omitted field mask to mean "get all", unless otherwise
105
+ # documented.
106
+ # ## Considerations for HTTP REST
107
+ # The HTTP kind of an update operation which uses a field mask must
108
+ # be set to PATCH instead of PUT in order to satisfy HTTP semantics
109
+ # (PUT must only be used for full updates).
110
+ # # JSON Encoding of Field Masks
111
+ # In JSON, a field mask is encoded as a single string where paths are
112
+ # separated by a comma. Fields name in each path are converted
113
+ # to/from lower-camel naming conventions.
114
+ # As an example, consider the following message declarations:
115
+ # message Profile {
116
+ # User user = 1;
117
+ # Photo photo = 2;
118
+ # }
119
+ # message User {
120
+ # string display_name = 1;
121
+ # string address = 2;
122
+ # }
123
+ # In proto a field mask for `Profile` may look as such:
124
+ # mask {
125
+ # paths: "user.display_name"
126
+ # paths: "photo"
127
+ # }
128
+ # In JSON, the same mask is represented as below:
129
+ # {
130
+ # mask: "user.displayName,photo"
131
+ # }
132
+ # # Field Masks and Oneof Fields
133
+ # Field masks treat fields in oneofs just as regular fields. Consider the
134
+ # following message:
135
+ # message SampleMessage {
136
+ # oneof test_oneof {
137
+ # string name = 4;
138
+ # SubMessage sub_message = 9;
139
+ # }
140
+ # }
141
+ # The field mask can be:
142
+ # mask {
143
+ # paths: "name"
144
+ # }
145
+ # Or:
146
+ # mask {
147
+ # paths: "sub_message"
148
+ # }
149
+ # Note that oneof type names ("test_oneof" in this case) cannot be used in
150
+ # paths.
151
+ # ## Field Mask Verification
152
+ # The implementation of any API method which has a FieldMask type field in the
153
+ # request should verify the included field paths, and return an
154
+ # `INVALID_ARGUMENT` error if any path is unmappable.
155
+ class FieldMask < ::Protostar::Message
156
+ type init_map = {
157
+ ?paths: ::Array[::String]?
158
+ }
159
+ def initialize: (
160
+ ?init_map? fields,
161
+ ?paths: ::Array[::String]?
162
+ ) -> void
163
+
164
+ # The set of field mask paths.
165
+ attr_reader paths(): ::Array[::String]
166
+ attr_writer paths(): ::Array[::String]?
167
+ end
168
+ end
169
+ end
170
+ end
@@ -0,0 +1,24 @@
1
+ # Generated by protostar from google/protobuf/source_context.proto. Do not edit.
2
+
3
+ module Protostar
4
+ module Google
5
+ module Protobuf
6
+ # `SourceContext` represents information about the source of a
7
+ # protobuf element, like the file in which it is defined.
8
+ class SourceContext < ::Protostar::Message
9
+ type init_map = {
10
+ ?file_name: ::String?
11
+ }
12
+ def initialize: (
13
+ ?init_map? fields,
14
+ ?file_name: ::String?
15
+ ) -> void
16
+
17
+ # The path-qualified name of the .proto file that contained the associated
18
+ # protobuf element. For example: `"google/protobuf/source_context.proto"`.
19
+ attr_reader file_name(): ::String
20
+ attr_writer file_name(): ::String?
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,135 @@
1
+ # Generated by protostar from google/protobuf/struct.proto. Do not edit.
2
+
3
+ module Protostar
4
+ module Google
5
+ module Protobuf
6
+ # Represents a JSON object.
7
+ # An unordered key-value map, intending to perfectly capture the semantics of a
8
+ # JSON object. This enables parsing any arbitrary JSON payload as a message
9
+ # field in ProtoJSON format.
10
+ # This follows RFC 8259 guidelines for interoperable JSON: notably this type
11
+ # cannot represent large Int64 values or `NaN`/`Infinity` numbers,
12
+ # since the JSON format generally does not support those values in its number
13
+ # type.
14
+ # If you do not intend to parse arbitrary JSON into your message, a custom
15
+ # typed message should be preferred instead of using this type.
16
+ class Struct < ::Protostar::Message
17
+ include ::Protostar::WellKnown::Struct
18
+ extend ::Protostar::WellKnown::Struct::ClassMethods
19
+
20
+ type init_map = {
21
+ ?fields: (::Hash[::String, ::Protostar::Google::Protobuf::Value | ::Protostar::Google::Protobuf::Value::init_map])?
22
+ }
23
+ def initialize: (
24
+ ?init_map? fields,
25
+ ?fields: (::Hash[::String, ::Protostar::Google::Protobuf::Value | ::Protostar::Google::Protobuf::Value::init_map])?
26
+ ) -> void
27
+
28
+ # Unordered map of dynamically typed values.
29
+ attr_reader fields(): ::Hash[::String, ::Protostar::Google::Protobuf::Value]
30
+ attr_writer fields(): (::Hash[::String, ::Protostar::Google::Protobuf::Value | ::Protostar::Google::Protobuf::Value::init_map])?
31
+ end
32
+
33
+ # Represents a JSON value.
34
+ # `Value` represents a dynamically typed value which can be either
35
+ # null, a number, a string, a boolean, a recursive struct value, or a
36
+ # list of values. A producer of value is expected to set one of these
37
+ # variants. Absence of any variant is an invalid state.
38
+ class Value < ::Protostar::Message
39
+ include ::Protostar::WellKnown::Value
40
+ extend ::Protostar::WellKnown::Value::ClassMethods
41
+
42
+ type init_map = {
43
+ ?null_value: (::Protostar::Google::Protobuf::NullValue::names | ::Integer)?,
44
+ ?number_value: (::Float | ::Integer)?,
45
+ ?string_value: ::String?,
46
+ ?bool_value: bool?,
47
+ ?struct_value: (::Protostar::Google::Protobuf::Struct | ::Protostar::Google::Protobuf::Struct::init_map)?,
48
+ ?list_value: (::Protostar::Google::Protobuf::ListValue | ::Protostar::Google::Protobuf::ListValue::init_map)?
49
+ }
50
+ def initialize: (
51
+ ?init_map? fields,
52
+ ?null_value: (::Protostar::Google::Protobuf::NullValue::names | ::Integer)?,
53
+ ?number_value: (::Float | ::Integer)?,
54
+ ?string_value: ::String?,
55
+ ?bool_value: bool?,
56
+ ?struct_value: (::Protostar::Google::Protobuf::Struct | ::Protostar::Google::Protobuf::Struct::init_map)?,
57
+ ?list_value: (::Protostar::Google::Protobuf::ListValue | ::Protostar::Google::Protobuf::ListValue::init_map)?
58
+ ) -> void
59
+
60
+ # Represents a JSON `null`.
61
+ attr_reader null_value(): ::Protostar::Google::Protobuf::NullValue::names | ::Integer
62
+ attr_writer null_value(): (::Protostar::Google::Protobuf::NullValue::names | ::Integer)?
63
+ def has_null_value?: () -> bool
64
+ def clear_null_value: () -> void
65
+
66
+ # Represents a JSON number. Must not be `NaN`, `Infinity` or
67
+ # `-Infinity`, since those are not supported in JSON. This also cannot
68
+ # represent large Int64 values, since JSON format generally does not
69
+ # support them in its number type.
70
+ attr_reader number_value(): ::Float
71
+ attr_writer number_value(): (::Float | ::Integer)?
72
+ def has_number_value?: () -> bool
73
+ def clear_number_value: () -> void
74
+
75
+ # Represents a JSON string.
76
+ attr_reader string_value(): ::String
77
+ attr_writer string_value(): ::String?
78
+ def has_string_value?: () -> bool
79
+ def clear_string_value: () -> void
80
+
81
+ # Represents a JSON boolean (`true` or `false` literal in JSON).
82
+ attr_reader bool_value(): bool
83
+ attr_writer bool_value(): bool?
84
+ def has_bool_value?: () -> bool
85
+ def clear_bool_value: () -> void
86
+
87
+ # Represents a JSON object.
88
+ attr_reader struct_value(): ::Protostar::Google::Protobuf::Struct?
89
+ attr_writer struct_value(): (::Protostar::Google::Protobuf::Struct | ::Protostar::Google::Protobuf::Struct::init_map)?
90
+ def has_struct_value?: () -> bool
91
+ def clear_struct_value: () -> void
92
+
93
+ # Represents a JSON array.
94
+ attr_reader list_value(): ::Protostar::Google::Protobuf::ListValue?
95
+ attr_writer list_value(): (::Protostar::Google::Protobuf::ListValue | ::Protostar::Google::Protobuf::ListValue::init_map)?
96
+ def has_list_value?: () -> bool
97
+ def clear_list_value: () -> void
98
+ def which_kind: () -> (:null_value | :number_value | :string_value | :bool_value | :struct_value | :list_value)?
99
+ end
100
+
101
+ # Represents a JSON array.
102
+ class ListValue < ::Protostar::Message
103
+ include ::Protostar::WellKnown::ListValue
104
+ extend ::Protostar::WellKnown::ListValue::ClassMethods
105
+
106
+ type init_map = {
107
+ ?values: (::Array[::Protostar::Google::Protobuf::Value | ::Protostar::Google::Protobuf::Value::init_map])?
108
+ }
109
+ def initialize: (
110
+ ?init_map? fields,
111
+ ?values: (::Array[::Protostar::Google::Protobuf::Value | ::Protostar::Google::Protobuf::Value::init_map])?
112
+ ) -> void
113
+
114
+ # Repeated field of dynamically typed values.
115
+ attr_reader values(): ::Array[::Protostar::Google::Protobuf::Value]
116
+ attr_writer values(): (::Array[::Protostar::Google::Protobuf::Value | ::Protostar::Google::Protobuf::Value::init_map])?
117
+ end
118
+
119
+ # Represents a JSON `null`.
120
+ # `NullValue` is a sentinel, using an enum with only one value to represent
121
+ # the null value for the `Value` type union.
122
+ # A field of type `NullValue` with any value other than `0` is considered
123
+ # invalid. Most ProtoJSON serializers will emit a `Value` with a `null_value`
124
+ # set as a JSON `null` regardless of the integer value, and so will round trip
125
+ # to a `0` value.
126
+ module NullValue
127
+ extend ::Protostar::Enum
128
+
129
+ NULL_VALUE: 0
130
+
131
+ type names = :NULL_VALUE
132
+ end
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,102 @@
1
+ # Generated by protostar from google/protobuf/timestamp.proto. Do not edit.
2
+
3
+ module Protostar
4
+ module Google
5
+ module Protobuf
6
+ # A Timestamp represents a point in time independent of any time zone or local
7
+ # calendar, encoded as a count of seconds and fractions of seconds at
8
+ # nanosecond resolution. The count is relative to an epoch at UTC midnight on
9
+ # January 1, 1970, in the proleptic Gregorian calendar which extends the
10
+ # Gregorian calendar backwards to year one.
11
+ # All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
12
+ # second table is needed for interpretation, using a [24-hour linear
13
+ # smear](https://developers.google.com/time/smear).
14
+ # The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
15
+ # restricting to that range, we ensure that we can convert to and from [RFC
16
+ # 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
17
+ # # Examples
18
+ # Example 1: Compute Timestamp from POSIX `time()`.
19
+ # Timestamp timestamp;
20
+ # timestamp.set_seconds(time(NULL));
21
+ # timestamp.set_nanos(0);
22
+ # Example 2: Compute Timestamp from POSIX `gettimeofday()`.
23
+ # struct timeval tv;
24
+ # gettimeofday(&tv, NULL);
25
+ # Timestamp timestamp;
26
+ # timestamp.set_seconds(tv.tv_sec);
27
+ # timestamp.set_nanos(tv.tv_usec * 1000);
28
+ # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
29
+ # FILETIME ft;
30
+ # GetSystemTimeAsFileTime(&ft);
31
+ # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
32
+ # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
33
+ # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
34
+ # Timestamp timestamp;
35
+ # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
36
+ # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
37
+ # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
38
+ # long millis = System.currentTimeMillis();
39
+ # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
40
+ # .setNanos((int) ((millis % 1000) * 1000000)).build();
41
+ # Example 5: Compute Timestamp from Java `Instant.now()`.
42
+ # Instant now = Instant.now();
43
+ # Timestamp timestamp =
44
+ # Timestamp.newBuilder().setSeconds(now.getEpochSecond())
45
+ # .setNanos(now.getNano()).build();
46
+ # Example 6: Compute Timestamp from current time in Python.
47
+ # timestamp = Timestamp()
48
+ # timestamp.GetCurrentTime()
49
+ # # JSON Mapping
50
+ # In JSON format, the Timestamp type is encoded as a string in the
51
+ # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
52
+ # format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
53
+ # where {year} is always expressed using four digits while {month}, {day},
54
+ # {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
55
+ # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
56
+ # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
57
+ # is required. A ProtoJSON serializer should always use UTC (as indicated by
58
+ # "Z") when printing the Timestamp type and a ProtoJSON parser should be
59
+ # able to accept both UTC and other timezones (as indicated by an offset).
60
+ # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
61
+ # 01:30 UTC on January 15, 2017.
62
+ # In JavaScript, one can convert a Date object to this format using the
63
+ # standard
64
+ # [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
65
+ # method. In Python, a standard `datetime.datetime` object can be converted
66
+ # to this format using
67
+ # [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
68
+ # the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
69
+ # the Joda Time's [`ISODateTimeFormat.dateTime()`](
70
+ # http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
71
+ # ) to obtain a formatter capable of generating timestamps in this format.
72
+ class Timestamp < ::Protostar::Message
73
+ include ::Protostar::WellKnown::Timestamp
74
+ extend ::Protostar::WellKnown::Timestamp::ClassMethods
75
+
76
+ type init_map = {
77
+ ?seconds: ::Integer?,
78
+ ?nanos: ::Integer?
79
+ }
80
+ def initialize: (
81
+ ?init_map? fields,
82
+ ?seconds: ::Integer?,
83
+ ?nanos: ::Integer?
84
+ ) -> void
85
+
86
+ # Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must
87
+ # be between -62135596800 and 253402300799 inclusive (which corresponds to
88
+ # 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z).
89
+ attr_reader seconds(): ::Integer
90
+ attr_writer seconds(): ::Integer?
91
+
92
+ # Non-negative fractions of a second at nanosecond resolution. This field is
93
+ # the nanosecond portion of the duration, not an alternative to seconds.
94
+ # Negative second values with fractions must still have non-negative nanos
95
+ # values that count forward in time. Must be between 0 and 999,999,999
96
+ # inclusive.
97
+ attr_reader nanos(): ::Integer
98
+ attr_writer nanos(): ::Integer?
99
+ end
100
+ end
101
+ end
102
+ end