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,77 @@
1
+ # Generated by protostar from google/protobuf/any.proto. Do not edit.
2
+
3
+ module Protostar
4
+ module Google
5
+ module Protobuf
6
+ # `Any` contains an arbitrary serialized protocol buffer message along with a
7
+ # URL that describes the type of the serialized message.
8
+ # In its binary encoding, an `Any` is an ordinary message; but in other wire
9
+ # forms like JSON, it has a special encoding. The format of the type URL is
10
+ # described on the `type_url` field.
11
+ # Protobuf APIs provide utilities to interact with `Any` values:
12
+ # - A 'pack' operation accepts a message and constructs a generic `Any` wrapper
13
+ # around it.
14
+ # - An 'unpack' operation reads the content of an `Any` message, either into an
15
+ # existing message or a new one. Unpack operations must check the type of the
16
+ # value they unpack against the declared `type_url`.
17
+ # - An 'is' operation decides whether an `Any` contains a message of the given
18
+ # type, i.e. whether it can 'unpack' that type.
19
+ # The JSON format representation of an `Any` follows one of these cases:
20
+ # - For types without special-cased JSON encodings, the JSON format
21
+ # representation of the `Any` is the same as that of the message, with an
22
+ # additional `@type` field which contains the type URL.
23
+ # - For types with special-cased JSON encodings (typically called 'well-known'
24
+ # types, listed in https://protobuf.dev/programming-guides/json/#any), the
25
+ # JSON format representation has a key `@type` which contains the type URL
26
+ # and a key `value` which contains the JSON-serialized value.
27
+ # The text format representation of an `Any` is like a message with one field
28
+ # whose name is the type URL in brackets. For example, an `Any` containing a
29
+ # `foo.Bar` message may be written `[type.googleapis.com/foo.Bar] { a: 2 }`.
30
+ class Any < ::Protostar::Message
31
+ include ::Protostar::WellKnown::Any
32
+ extend ::Protostar::WellKnown::Any::ClassMethods
33
+
34
+ type init_map = {
35
+ ?type_url: ::String?,
36
+ ?value: ::String?
37
+ }
38
+ def initialize: (
39
+ ?init_map? fields,
40
+ ?type_url: ::String?,
41
+ ?value: ::String?
42
+ ) -> void
43
+
44
+ # Identifies the type of the serialized Protobuf message with a URI reference
45
+ # consisting of a prefix ending in a slash and the fully-qualified type name.
46
+ # Example: type.googleapis.com/google.protobuf.StringValue
47
+ # This string must contain at least one `/` character, and the content after
48
+ # the last `/` must be the fully-qualified name of the type in canonical
49
+ # form, without a leading dot. Do not write a scheme on these URI references
50
+ # so that clients do not attempt to contact them.
51
+ # The prefix is arbitrary and Protobuf implementations are expected to
52
+ # simply strip off everything up to and including the last `/` to identify
53
+ # the type. `type.googleapis.com/` is a common default prefix that some
54
+ # legacy implementations require. This prefix does not indicate the origin of
55
+ # the type, and URIs containing it are not expected to respond to any
56
+ # requests.
57
+ # All type URL strings must be legal URI references with the additional
58
+ # restriction (for the text format) that the content of the reference
59
+ # must consist only of alphanumeric characters, percent-encoded escapes, and
60
+ # characters in the following set (not including the outer backticks):
61
+ # `/-.~_!$&()*+,;=`. Despite our allowing percent encodings, implementations
62
+ # should not unescape them to prevent confusion with existing parsers. For
63
+ # example, `type.googleapis.com%2FFoo` should be rejected.
64
+ # In the original design of `Any`, the possibility of launching a type
65
+ # resolution service at these type URLs was considered but Protobuf never
66
+ # implemented one and considers contacting these URLs to be problematic and
67
+ # a potential security issue. Do not attempt to contact type URLs.
68
+ attr_reader type_url(): ::String
69
+ attr_writer type_url(): ::String?
70
+
71
+ # Holds a Protobuf serialization of the type described by type_url.
72
+ attr_reader value(): ::String
73
+ attr_writer value(): ::String?
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,242 @@
1
+ # Generated by protostar from google/protobuf/api.proto. Do not edit.
2
+
3
+ module Protostar
4
+ module Google
5
+ module Protobuf
6
+ # Api is a light-weight descriptor for an API Interface.
7
+ # Interfaces are also described as "protocol buffer services" in some contexts,
8
+ # such as by the "service" keyword in a .proto file, but they are different
9
+ # from API Services, which represent a concrete implementation of an interface
10
+ # as opposed to simply a description of methods and bindings. They are also
11
+ # sometimes simply referred to as "APIs" in other contexts, such as the name of
12
+ # this message itself. See https://cloud.google.com/apis/design/glossary for
13
+ # detailed terminology.
14
+ # New usages of this message as an alternative to ServiceDescriptorProto are
15
+ # strongly discouraged. This message does not reliability preserve all
16
+ # information necessary to model the schema and preserve semantics. Instead
17
+ # make use of FileDescriptorSet which preserves the necessary information.
18
+ class Api < ::Protostar::Message
19
+ type init_map = {
20
+ ?name: ::String?,
21
+ ?methods: (::Array[::Protostar::Google::Protobuf::Method | ::Protostar::Google::Protobuf::Method::init_map])?,
22
+ ?options: (::Array[::Protostar::Google::Protobuf::Option | ::Protostar::Google::Protobuf::Option::init_map])?,
23
+ ?version: ::String?,
24
+ ?source_context: (::Protostar::Google::Protobuf::SourceContext | ::Protostar::Google::Protobuf::SourceContext::init_map)?,
25
+ ?mixins: (::Array[::Protostar::Google::Protobuf::Mixin | ::Protostar::Google::Protobuf::Mixin::init_map])?,
26
+ ?syntax: (::Protostar::Google::Protobuf::Syntax::names | ::Integer)?,
27
+ ?edition: ::String?
28
+ }
29
+ def initialize: (
30
+ ?init_map? fields,
31
+ ?name: ::String?,
32
+ ?methods: (::Array[::Protostar::Google::Protobuf::Method | ::Protostar::Google::Protobuf::Method::init_map])?,
33
+ ?options: (::Array[::Protostar::Google::Protobuf::Option | ::Protostar::Google::Protobuf::Option::init_map])?,
34
+ ?version: ::String?,
35
+ ?source_context: (::Protostar::Google::Protobuf::SourceContext | ::Protostar::Google::Protobuf::SourceContext::init_map)?,
36
+ ?mixins: (::Array[::Protostar::Google::Protobuf::Mixin | ::Protostar::Google::Protobuf::Mixin::init_map])?,
37
+ ?syntax: (::Protostar::Google::Protobuf::Syntax::names | ::Integer)?,
38
+ ?edition: ::String?
39
+ ) -> void
40
+
41
+ # The fully qualified name of this interface, including package name
42
+ # followed by the interface's simple name.
43
+ attr_reader name(): ::String
44
+ attr_writer name(): ::String?
45
+
46
+ # The methods of this interface, in unspecified order.
47
+ attr_writer methods(): (::Array[::Protostar::Google::Protobuf::Method | ::Protostar::Google::Protobuf::Method::init_map])?
48
+
49
+ # Any metadata attached to the interface.
50
+ attr_reader options(): ::Array[::Protostar::Google::Protobuf::Option]
51
+ attr_writer options(): (::Array[::Protostar::Google::Protobuf::Option | ::Protostar::Google::Protobuf::Option::init_map])?
52
+
53
+ # A version string for this interface. If specified, must have the form
54
+ # `major-version.minor-version`, as in `1.10`. If the minor version is
55
+ # omitted, it defaults to zero. If the entire version field is empty, the
56
+ # major version is derived from the package name, as outlined below. If the
57
+ # field is not empty, the version in the package name will be verified to be
58
+ # consistent with what is provided here.
59
+ # The versioning schema uses [semantic
60
+ # versioning](http://semver.org) where the major version number
61
+ # indicates a breaking change and the minor version an additive,
62
+ # non-breaking change. Both version numbers are signals to users
63
+ # what to expect from different versions, and should be carefully
64
+ # chosen based on the product plan.
65
+ # The major version is also reflected in the package name of the
66
+ # interface, which must end in `v<major-version>`, as in
67
+ # `google.feature.v1`. For major versions 0 and 1, the suffix can
68
+ # be omitted. Zero major versions must only be used for
69
+ # experimental, non-GA interfaces.
70
+ attr_reader version(): ::String
71
+ attr_writer version(): ::String?
72
+
73
+ # Source context for the protocol buffer service represented by this
74
+ # message.
75
+ attr_reader source_context(): ::Protostar::Google::Protobuf::SourceContext?
76
+ attr_writer source_context(): (::Protostar::Google::Protobuf::SourceContext | ::Protostar::Google::Protobuf::SourceContext::init_map)?
77
+ def has_source_context?: () -> bool
78
+ def clear_source_context: () -> void
79
+
80
+ # Included interfaces. See [Mixin][].
81
+ attr_reader mixins(): ::Array[::Protostar::Google::Protobuf::Mixin]
82
+ attr_writer mixins(): (::Array[::Protostar::Google::Protobuf::Mixin | ::Protostar::Google::Protobuf::Mixin::init_map])?
83
+
84
+ # The source syntax of the service.
85
+ attr_reader syntax(): ::Protostar::Google::Protobuf::Syntax::names | ::Integer
86
+ attr_writer syntax(): (::Protostar::Google::Protobuf::Syntax::names | ::Integer)?
87
+
88
+ # The source edition string, only valid when syntax is SYNTAX_EDITIONS.
89
+ attr_reader edition(): ::String
90
+ attr_writer edition(): ::String?
91
+ end
92
+
93
+ # Method represents a method of an API interface.
94
+ # New usages of this message as an alternative to MethodDescriptorProto are
95
+ # strongly discouraged. This message does not reliability preserve all
96
+ # information necessary to model the schema and preserve semantics. Instead
97
+ # make use of FileDescriptorSet which preserves the necessary information.
98
+ class Method < ::Protostar::Message
99
+ type init_map = {
100
+ ?name: ::String?,
101
+ ?request_type_url: ::String?,
102
+ ?request_streaming: bool?,
103
+ ?response_type_url: ::String?,
104
+ ?response_streaming: bool?,
105
+ ?options: (::Array[::Protostar::Google::Protobuf::Option | ::Protostar::Google::Protobuf::Option::init_map])?,
106
+ ?syntax: (::Protostar::Google::Protobuf::Syntax::names | ::Integer)?,
107
+ ?edition: ::String?
108
+ }
109
+ def initialize: (
110
+ ?init_map? fields,
111
+ ?name: ::String?,
112
+ ?request_type_url: ::String?,
113
+ ?request_streaming: bool?,
114
+ ?response_type_url: ::String?,
115
+ ?response_streaming: bool?,
116
+ ?options: (::Array[::Protostar::Google::Protobuf::Option | ::Protostar::Google::Protobuf::Option::init_map])?,
117
+ ?syntax: (::Protostar::Google::Protobuf::Syntax::names | ::Integer)?,
118
+ ?edition: ::String?
119
+ ) -> void
120
+
121
+ # The simple name of this method.
122
+ attr_reader name(): ::String
123
+ attr_writer name(): ::String?
124
+
125
+ # A URL of the input message type.
126
+ attr_reader request_type_url(): ::String
127
+ attr_writer request_type_url(): ::String?
128
+
129
+ # If true, the request is streamed.
130
+ attr_reader request_streaming(): bool
131
+ attr_writer request_streaming(): bool?
132
+
133
+ # The URL of the output message type.
134
+ attr_reader response_type_url(): ::String
135
+ attr_writer response_type_url(): ::String?
136
+
137
+ # If true, the response is streamed.
138
+ attr_reader response_streaming(): bool
139
+ attr_writer response_streaming(): bool?
140
+
141
+ # Any metadata attached to the method.
142
+ attr_reader options(): ::Array[::Protostar::Google::Protobuf::Option]
143
+ attr_writer options(): (::Array[::Protostar::Google::Protobuf::Option | ::Protostar::Google::Protobuf::Option::init_map])?
144
+
145
+ # The source syntax of this method.
146
+ # This field should be ignored, instead the syntax should be inherited from
147
+ # Api. This is similar to Field and EnumValue.
148
+ attr_reader syntax(): ::Protostar::Google::Protobuf::Syntax::names | ::Integer
149
+ attr_writer syntax(): (::Protostar::Google::Protobuf::Syntax::names | ::Integer)?
150
+
151
+ # The source edition string, only valid when syntax is SYNTAX_EDITIONS.
152
+ # This field should be ignored, instead the edition should be inherited from
153
+ # Api. This is similar to Field and EnumValue.
154
+ attr_reader edition(): ::String
155
+ attr_writer edition(): ::String?
156
+ end
157
+
158
+ # Declares an API Interface to be included in this interface. The including
159
+ # interface must redeclare all the methods from the included interface, but
160
+ # documentation and options are inherited as follows:
161
+ # - If after comment and whitespace stripping, the documentation
162
+ # string of the redeclared method is empty, it will be inherited
163
+ # from the original method.
164
+ # - Each annotation belonging to the service config (http,
165
+ # visibility) which is not set in the redeclared method will be
166
+ # inherited.
167
+ # - If an http annotation is inherited, the path pattern will be
168
+ # modified as follows. Any version prefix will be replaced by the
169
+ # version of the including interface plus the [root][] path if
170
+ # specified.
171
+ # Example of a simple mixin:
172
+ # package google.acl.v1;
173
+ # service AccessControl {
174
+ # // Get the underlying ACL object.
175
+ # rpc GetAcl(GetAclRequest) returns (Acl) {
176
+ # option (google.api.http).get = "/v1/{resource=**}:getAcl";
177
+ # }
178
+ # }
179
+ # package google.storage.v2;
180
+ # service Storage {
181
+ # rpc GetAcl(GetAclRequest) returns (Acl);
182
+ # // Get a data record.
183
+ # rpc GetData(GetDataRequest) returns (Data) {
184
+ # option (google.api.http).get = "/v2/{resource=**}";
185
+ # }
186
+ # }
187
+ # Example of a mixin configuration:
188
+ # apis:
189
+ # - name: google.storage.v2.Storage
190
+ # mixins:
191
+ # - name: google.acl.v1.AccessControl
192
+ # The mixin construct implies that all methods in `AccessControl` are
193
+ # also declared with same name and request/response types in
194
+ # `Storage`. A documentation generator or annotation processor will
195
+ # see the effective `Storage.GetAcl` method after inheriting
196
+ # documentation and annotations as follows:
197
+ # service Storage {
198
+ # // Get the underlying ACL object.
199
+ # rpc GetAcl(GetAclRequest) returns (Acl) {
200
+ # option (google.api.http).get = "/v2/{resource=**}:getAcl";
201
+ # }
202
+ # ...
203
+ # }
204
+ # Note how the version in the path pattern changed from `v1` to `v2`.
205
+ # If the `root` field in the mixin is specified, it should be a
206
+ # relative path under which inherited HTTP paths are placed. Example:
207
+ # apis:
208
+ # - name: google.storage.v2.Storage
209
+ # mixins:
210
+ # - name: google.acl.v1.AccessControl
211
+ # root: acls
212
+ # This implies the following inherited HTTP annotation:
213
+ # service Storage {
214
+ # // Get the underlying ACL object.
215
+ # rpc GetAcl(GetAclRequest) returns (Acl) {
216
+ # option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
217
+ # }
218
+ # ...
219
+ # }
220
+ class Mixin < ::Protostar::Message
221
+ type init_map = {
222
+ ?name: ::String?,
223
+ ?root: ::String?
224
+ }
225
+ def initialize: (
226
+ ?init_map? fields,
227
+ ?name: ::String?,
228
+ ?root: ::String?
229
+ ) -> void
230
+
231
+ # The fully qualified name of the interface which is included.
232
+ attr_reader name(): ::String
233
+ attr_writer name(): ::String?
234
+
235
+ # If non-empty specifies a path under which inherited HTTP paths
236
+ # are rooted.
237
+ attr_reader root(): ::String
238
+ attr_writer root(): ::String?
239
+ end
240
+ end
241
+ end
242
+ end
@@ -0,0 +1,264 @@
1
+ # Generated by protostar from google/protobuf/compiler/plugin.proto. Do not edit.
2
+
3
+ module Protostar
4
+ module Google
5
+ module Protobuf
6
+ module Compiler
7
+ # The version number of protocol compiler.
8
+ class Version < ::Protostar::Message
9
+ type init_map = {
10
+ ?major: ::Integer?,
11
+ ?minor: ::Integer?,
12
+ ?patch: ::Integer?,
13
+ ?suffix: ::String?
14
+ }
15
+ def initialize: (
16
+ ?init_map? fields,
17
+ ?major: ::Integer?,
18
+ ?minor: ::Integer?,
19
+ ?patch: ::Integer?,
20
+ ?suffix: ::String?
21
+ ) -> void
22
+
23
+ attr_reader major(): ::Integer
24
+ attr_writer major(): ::Integer?
25
+ def has_major?: () -> bool
26
+ def clear_major: () -> void
27
+
28
+ attr_reader minor(): ::Integer
29
+ attr_writer minor(): ::Integer?
30
+ def has_minor?: () -> bool
31
+ def clear_minor: () -> void
32
+
33
+ attr_reader patch(): ::Integer
34
+ attr_writer patch(): ::Integer?
35
+ def has_patch?: () -> bool
36
+ def clear_patch: () -> void
37
+
38
+ # A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
39
+ # be empty for mainline stable releases.
40
+ attr_reader suffix(): ::String
41
+ attr_writer suffix(): ::String?
42
+ def has_suffix?: () -> bool
43
+ def clear_suffix: () -> void
44
+ end
45
+
46
+ # An encoded CodeGeneratorRequest is written to the plugin's stdin.
47
+ class CodeGeneratorRequest < ::Protostar::Message
48
+ type init_map = {
49
+ ?file_to_generate: ::Array[::String]?,
50
+ ?parameter: ::String?,
51
+ ?proto_file: (::Array[::Protostar::Google::Protobuf::FileDescriptorProto | ::Protostar::Google::Protobuf::FileDescriptorProto::init_map])?,
52
+ ?source_file_descriptors: (::Array[::Protostar::Google::Protobuf::FileDescriptorProto | ::Protostar::Google::Protobuf::FileDescriptorProto::init_map])?,
53
+ ?compiler_version: (::Protostar::Google::Protobuf::Compiler::Version | ::Protostar::Google::Protobuf::Compiler::Version::init_map)?
54
+ }
55
+ def initialize: (
56
+ ?init_map? fields,
57
+ ?file_to_generate: ::Array[::String]?,
58
+ ?parameter: ::String?,
59
+ ?proto_file: (::Array[::Protostar::Google::Protobuf::FileDescriptorProto | ::Protostar::Google::Protobuf::FileDescriptorProto::init_map])?,
60
+ ?source_file_descriptors: (::Array[::Protostar::Google::Protobuf::FileDescriptorProto | ::Protostar::Google::Protobuf::FileDescriptorProto::init_map])?,
61
+ ?compiler_version: (::Protostar::Google::Protobuf::Compiler::Version | ::Protostar::Google::Protobuf::Compiler::Version::init_map)?
62
+ ) -> void
63
+
64
+ # The .proto files that were explicitly listed on the command-line. The
65
+ # code generator should generate code only for these files. Each file's
66
+ # descriptor will be included in proto_file, below.
67
+ attr_reader file_to_generate(): ::Array[::String]
68
+ attr_writer file_to_generate(): ::Array[::String]?
69
+
70
+ # The generator parameter passed on the command-line.
71
+ attr_reader parameter(): ::String
72
+ attr_writer parameter(): ::String?
73
+ def has_parameter?: () -> bool
74
+ def clear_parameter: () -> void
75
+
76
+ # FileDescriptorProtos for all files in files_to_generate and everything
77
+ # they import. The files will appear in topological order, so each file
78
+ # appears before any file that imports it.
79
+ # Note: the files listed in files_to_generate will include runtime-retention
80
+ # options only, but all other files will include source-retention options.
81
+ # The source_file_descriptors field below is available in case you need
82
+ # source-retention options for files_to_generate.
83
+ # protoc guarantees that all proto_files will be written after
84
+ # the fields above, even though this is not technically guaranteed by the
85
+ # protobuf wire format. This theoretically could allow a plugin to stream
86
+ # in the FileDescriptorProtos and handle them one by one rather than read
87
+ # the entire set into memory at once. However, as of this writing, this
88
+ # is not similarly optimized on protoc's end -- it will store all fields in
89
+ # memory at once before sending them to the plugin.
90
+ # Type names of fields and extensions in the FileDescriptorProto are always
91
+ # fully qualified.
92
+ attr_reader proto_file(): ::Array[::Protostar::Google::Protobuf::FileDescriptorProto]
93
+ attr_writer proto_file(): (::Array[::Protostar::Google::Protobuf::FileDescriptorProto | ::Protostar::Google::Protobuf::FileDescriptorProto::init_map])?
94
+
95
+ # File descriptors with all options, including source-retention options.
96
+ # These descriptors are only provided for the files listed in
97
+ # files_to_generate.
98
+ attr_reader source_file_descriptors(): ::Array[::Protostar::Google::Protobuf::FileDescriptorProto]
99
+ attr_writer source_file_descriptors(): (::Array[::Protostar::Google::Protobuf::FileDescriptorProto | ::Protostar::Google::Protobuf::FileDescriptorProto::init_map])?
100
+
101
+ # The version number of protocol compiler.
102
+ attr_reader compiler_version(): ::Protostar::Google::Protobuf::Compiler::Version?
103
+ attr_writer compiler_version(): (::Protostar::Google::Protobuf::Compiler::Version | ::Protostar::Google::Protobuf::Compiler::Version::init_map)?
104
+ def has_compiler_version?: () -> bool
105
+ def clear_compiler_version: () -> void
106
+ end
107
+
108
+ # The plugin writes an encoded CodeGeneratorResponse to stdout.
109
+ class CodeGeneratorResponse < ::Protostar::Message
110
+ # Represents a single generated file.
111
+ class File < ::Protostar::Message
112
+ type init_map = {
113
+ ?name: ::String?,
114
+ ?insertion_point: ::String?,
115
+ ?content: ::String?,
116
+ ?generated_code_info: (::Protostar::Google::Protobuf::GeneratedCodeInfo | ::Protostar::Google::Protobuf::GeneratedCodeInfo::init_map)?
117
+ }
118
+ def initialize: (
119
+ ?init_map? fields,
120
+ ?name: ::String?,
121
+ ?insertion_point: ::String?,
122
+ ?content: ::String?,
123
+ ?generated_code_info: (::Protostar::Google::Protobuf::GeneratedCodeInfo | ::Protostar::Google::Protobuf::GeneratedCodeInfo::init_map)?
124
+ ) -> void
125
+
126
+ # The file name, relative to the output directory. The name must not
127
+ # contain "." or ".." components and must be relative, not be absolute (so,
128
+ # the file cannot lie outside the output directory). "/" must be used as
129
+ # the path separator, not "\".
130
+ # If the name is omitted, the content will be appended to the previous
131
+ # file. This allows the generator to break large files into small chunks,
132
+ # and allows the generated text to be streamed back to protoc so that large
133
+ # files need not reside completely in memory at one time. Note that as of
134
+ # this writing protoc does not optimize for this -- it will read the entire
135
+ # CodeGeneratorResponse before writing files to disk.
136
+ attr_reader name(): ::String
137
+ attr_writer name(): ::String?
138
+ def has_name?: () -> bool
139
+ def clear_name: () -> void
140
+
141
+ # If non-empty, indicates that the named file should already exist, and the
142
+ # content here is to be inserted into that file at a defined insertion
143
+ # point. This feature allows a code generator to extend the output
144
+ # produced by another code generator. The original generator may provide
145
+ # insertion points by placing special annotations in the file that look
146
+ # like:
147
+ # @@protoc_insertion_point(NAME)
148
+ # The annotation can have arbitrary text before and after it on the line,
149
+ # which allows it to be placed in a comment. NAME should be replaced with
150
+ # an identifier naming the point -- this is what other generators will use
151
+ # as the insertion_point. Code inserted at this point will be placed
152
+ # immediately above the line containing the insertion point (thus multiple
153
+ # insertions to the same point will come out in the order they were added).
154
+ # The double-@ is intended to make it unlikely that the generated code
155
+ # could contain things that look like insertion points by accident.
156
+ # For example, the C++ code generator places the following line in the
157
+ # .pb.h files that it generates:
158
+ # // @@protoc_insertion_point(namespace_scope)
159
+ # This line appears within the scope of the file's package namespace, but
160
+ # outside of any particular class. Another plugin can then specify the
161
+ # insertion_point "namespace_scope" to generate additional classes or
162
+ # other declarations that should be placed in this scope.
163
+ # Note that if the line containing the insertion point begins with
164
+ # whitespace, the same whitespace will be added to every line of the
165
+ # inserted text. This is useful for languages like Python, where
166
+ # indentation matters. In these languages, the insertion point comment
167
+ # should be indented the same amount as any inserted code will need to be
168
+ # in order to work correctly in that context.
169
+ # The code generator that generates the initial file and the one which
170
+ # inserts into it must both run as part of a single invocation of protoc.
171
+ # Code generators are executed in the order in which they appear on the
172
+ # command line.
173
+ # If |insertion_point| is present, |name| must also be present.
174
+ attr_reader insertion_point(): ::String
175
+ attr_writer insertion_point(): ::String?
176
+ def has_insertion_point?: () -> bool
177
+ def clear_insertion_point: () -> void
178
+
179
+ # The file contents.
180
+ attr_reader content(): ::String
181
+ attr_writer content(): ::String?
182
+ def has_content?: () -> bool
183
+ def clear_content: () -> void
184
+
185
+ # Information describing the file content being inserted. If an insertion
186
+ # point is used, this information will be appropriately offset and inserted
187
+ # into the code generation metadata for the generated files.
188
+ attr_reader generated_code_info(): ::Protostar::Google::Protobuf::GeneratedCodeInfo?
189
+ attr_writer generated_code_info(): (::Protostar::Google::Protobuf::GeneratedCodeInfo | ::Protostar::Google::Protobuf::GeneratedCodeInfo::init_map)?
190
+ def has_generated_code_info?: () -> bool
191
+ def clear_generated_code_info: () -> void
192
+ end
193
+
194
+ # Sync with code_generator.h.
195
+ module Feature
196
+ extend ::Protostar::Enum
197
+
198
+ FEATURE_NONE: 0
199
+ FEATURE_PROTO3_OPTIONAL: 1
200
+ FEATURE_SUPPORTS_EDITIONS: 2
201
+
202
+ type names = :FEATURE_NONE | :FEATURE_PROTO3_OPTIONAL | :FEATURE_SUPPORTS_EDITIONS
203
+ end
204
+
205
+ type init_map = {
206
+ ?error: ::String?,
207
+ ?supported_features: ::Integer?,
208
+ ?minimum_edition: ::Integer?,
209
+ ?maximum_edition: ::Integer?,
210
+ ?file: (::Array[::Protostar::Google::Protobuf::Compiler::CodeGeneratorResponse::File | ::Protostar::Google::Protobuf::Compiler::CodeGeneratorResponse::File::init_map])?
211
+ }
212
+ def initialize: (
213
+ ?init_map? fields,
214
+ ?error: ::String?,
215
+ ?supported_features: ::Integer?,
216
+ ?minimum_edition: ::Integer?,
217
+ ?maximum_edition: ::Integer?,
218
+ ?file: (::Array[::Protostar::Google::Protobuf::Compiler::CodeGeneratorResponse::File | ::Protostar::Google::Protobuf::Compiler::CodeGeneratorResponse::File::init_map])?
219
+ ) -> void
220
+
221
+ # Error message. If non-empty, code generation failed. The plugin process
222
+ # should exit with status code zero even if it reports an error in this way.
223
+ # This should be used to indicate errors in .proto files which prevent the
224
+ # code generator from generating correct code. Errors which indicate a
225
+ # problem in protoc itself -- such as the input CodeGeneratorRequest being
226
+ # unparseable -- should be reported by writing a message to stderr and
227
+ # exiting with a non-zero status code.
228
+ attr_reader error(): ::String
229
+ attr_writer error(): ::String?
230
+ def has_error?: () -> bool
231
+ def clear_error: () -> void
232
+
233
+ # A bitmask of supported features that the code generator supports.
234
+ # This is a bitwise "or" of values from the Feature enum.
235
+ attr_reader supported_features(): ::Integer
236
+ attr_writer supported_features(): ::Integer?
237
+ def has_supported_features?: () -> bool
238
+ def clear_supported_features: () -> void
239
+
240
+ # The minimum edition this plugin supports. This will be treated as an
241
+ # Edition enum, but we want to allow unknown values. It should be specified
242
+ # according the edition enum value, *not* the edition number. Only takes
243
+ # effect for plugins that have FEATURE_SUPPORTS_EDITIONS set.
244
+ attr_reader minimum_edition(): ::Integer
245
+ attr_writer minimum_edition(): ::Integer?
246
+ def has_minimum_edition?: () -> bool
247
+ def clear_minimum_edition: () -> void
248
+
249
+ # The maximum edition this plugin supports. This will be treated as an
250
+ # Edition enum, but we want to allow unknown values. It should be specified
251
+ # according the edition enum value, *not* the edition number. Only takes
252
+ # effect for plugins that have FEATURE_SUPPORTS_EDITIONS set.
253
+ attr_reader maximum_edition(): ::Integer
254
+ attr_writer maximum_edition(): ::Integer?
255
+ def has_maximum_edition?: () -> bool
256
+ def clear_maximum_edition: () -> void
257
+
258
+ attr_reader file(): ::Array[::Protostar::Google::Protobuf::Compiler::CodeGeneratorResponse::File]
259
+ attr_writer file(): (::Array[::Protostar::Google::Protobuf::Compiler::CodeGeneratorResponse::File | ::Protostar::Google::Protobuf::Compiler::CodeGeneratorResponse::File::init_map])?
260
+ end
261
+ end
262
+ end
263
+ end
264
+ end