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,1239 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by protostar from google/protobuf/descriptor.proto. Do not edit.
4
+
5
+ require "protostar"
6
+
7
+ Protostar::DSL.file(
8
+ "google/protobuf/descriptor.proto",
9
+ package: "google.protobuf",
10
+ go_package: "google.golang.org/protobuf/types/descriptorpb",
11
+ java_package: "com.google.protobuf",
12
+ java_outer_classname: "DescriptorProtos",
13
+ csharp_namespace: "Google.Protobuf.Reflection",
14
+ objc_class_prefix: "GPB",
15
+ cc_enable_arenas: true,
16
+ optimize_for: :SPEED
17
+ ) do |f|
18
+ # The protocol compiler can output a FileDescriptorSet containing the .proto
19
+ # files it parses.
20
+ f.message "FileDescriptorSet" do |m|
21
+ m.field :file, 1, :message, ".google.protobuf.FileDescriptorProto", label: :repeated
22
+ m.extensions 536000000
23
+ end
24
+ # Describes a complete .proto file.
25
+ f.message "FileDescriptorProto" do |m|
26
+ m.field :name, 1, :string
27
+ m.field :package, 2, :string
28
+ # Names of files imported by this file.
29
+ m.field :dependency, 3, :string, label: :repeated
30
+ # Indexes of the public imported files in the dependency list above.
31
+ m.field :public_dependency, 10, :int32, label: :repeated
32
+ # Indexes of the weak imported files in the dependency list.
33
+ # For Google-internal migration only. Do not use.
34
+ m.field :weak_dependency, 11, :int32, label: :repeated
35
+ # Names of files imported by this file purely for the purpose of providing
36
+ # option extensions. These are excluded from the dependency list above.
37
+ m.field :option_dependency, 15, :string, label: :repeated
38
+ # All top-level definitions in this file.
39
+ m.field :message_type, 4, :message, ".google.protobuf.DescriptorProto", label: :repeated
40
+ m.field :enum_type, 5, :message, ".google.protobuf.EnumDescriptorProto", label: :repeated
41
+ m.field :service, 6, :message, ".google.protobuf.ServiceDescriptorProto", label: :repeated
42
+ m.field :extension, 7, :message, ".google.protobuf.FieldDescriptorProto", label: :repeated
43
+ m.field :options, 8, :message, ".google.protobuf.FileOptions"
44
+ # This field contains optional information about the original source code.
45
+ # You may safely remove this entire field without harming runtime
46
+ # functionality of the descriptors -- the information is needed only by
47
+ # development tools.
48
+ m.field :source_code_info, 9, :message, ".google.protobuf.SourceCodeInfo"
49
+ # The syntax of the proto file.
50
+ # The supported values are "proto2", "proto3", and "editions".
51
+ #
52
+ # If `edition` is present, this value must be "editions".
53
+ # WARNING: This field should only be used by protobuf plugins or special
54
+ # cases like the proto compiler. Other uses are discouraged and
55
+ # developers should rely on the protoreflect APIs for their client language.
56
+ m.field :syntax, 12, :string
57
+ # The edition of the proto file.
58
+ # WARNING: This field should only be used by protobuf plugins or special
59
+ # cases like the proto compiler. Other uses are discouraged and
60
+ # developers should rely on the protoreflect APIs for their client language.
61
+ m.field :edition, 14, :enum, ".google.protobuf.Edition"
62
+ end
63
+ # Describes a message type.
64
+ f.message "DescriptorProto" do |m|
65
+ m.field :name, 1, :string
66
+ m.field :field, 2, :message, ".google.protobuf.FieldDescriptorProto", label: :repeated
67
+ m.field :extension, 6, :message, ".google.protobuf.FieldDescriptorProto", label: :repeated
68
+ m.field :nested_type, 3, :message, ".google.protobuf.DescriptorProto", label: :repeated
69
+ m.field :enum_type, 4, :message, ".google.protobuf.EnumDescriptorProto", label: :repeated
70
+ m.field :extension_range, 5, :message, ".google.protobuf.DescriptorProto.ExtensionRange",
71
+ label: :repeated
72
+ m.field :oneof_decl, 8, :message, ".google.protobuf.OneofDescriptorProto", label: :repeated
73
+ m.field :options, 7, :message, ".google.protobuf.MessageOptions"
74
+ m.field :reserved_range, 9, :message, ".google.protobuf.DescriptorProto.ReservedRange",
75
+ label: :repeated
76
+ # Reserved field names, which may not be used by fields in the same message.
77
+ # A given name may only be reserved once.
78
+ m.field :reserved_name, 10, :string, label: :repeated
79
+ # Support for `export` and `local` keywords on enums.
80
+ m.field :visibility, 11, :enum, ".google.protobuf.SymbolVisibility"
81
+ m.message "ExtensionRange" do |m|
82
+ m.field :start, 1, :int32
83
+ m.field :end, 2, :int32
84
+ m.field :options, 3, :message, ".google.protobuf.ExtensionRangeOptions"
85
+ end
86
+ # Range of reserved tag numbers. Reserved tag numbers may not be used by
87
+ # fields or extension ranges in the same message. Reserved ranges may
88
+ # not overlap.
89
+ m.message "ReservedRange" do |m|
90
+ m.field :start, 1, :int32
91
+ m.field :end, 2, :int32
92
+ end
93
+ end
94
+ f.message "ExtensionRangeOptions" do |m|
95
+ # The parser stores options it doesn't recognize here. See above.
96
+ m.field :uninterpreted_option, 999, :message, ".google.protobuf.UninterpretedOption",
97
+ label: :repeated
98
+ # For external users: DO NOT USE. We are in the process of open sourcing
99
+ # extension declaration and executing internal cleanups before it can be
100
+ # used externally.
101
+ m.field :declaration, 2, :message, ".google.protobuf.ExtensionRangeOptions.Declaration",
102
+ label: :repeated,
103
+ retention: :RETENTION_SOURCE
104
+ # Any features defined in the specific edition.
105
+ m.field :features, 50, :message, ".google.protobuf.FeatureSet"
106
+ # The verification state of the range.
107
+ # TODO: flip the default to DECLARATION once all empty ranges
108
+ # are marked as UNVERIFIED.
109
+ m.field :verification, 3, :enum, ".google.protobuf.ExtensionRangeOptions.VerificationState",
110
+ default: "UNVERIFIED",
111
+ retention: :RETENTION_SOURCE
112
+ m.message "Declaration" do |m|
113
+ # The extension number declared within the extension range.
114
+ m.field :number, 1, :int32
115
+ # The fully-qualified name of the extension field. There must be a leading
116
+ # dot in front of the full name.
117
+ m.field :full_name, 2, :string
118
+ # The fully-qualified type name of the extension field. Unlike
119
+ # Metadata.type, Declaration.type must have a leading dot for messages
120
+ # and enums.
121
+ m.field :type, 3, :string
122
+ # If true, indicates that the number is reserved in the extension range,
123
+ # and any extension field with the number will fail to compile. Set this
124
+ # when a declared extension field is deleted.
125
+ m.field :reserved, 5, :bool
126
+ # If true, indicates that the extension must be defined as repeated.
127
+ # Otherwise the extension must be defined as optional.
128
+ m.field :repeated, 6, :bool
129
+ m.reserved 4
130
+ end
131
+ # The verification state of the extension range.
132
+ m.enum "VerificationState" do |e|
133
+ # All the extensions of the range must be declared.
134
+ e.value :DECLARATION, 0
135
+ e.value :UNVERIFIED, 1
136
+ end
137
+ m.extensions 990..998
138
+ m.extensions 1000..536870911
139
+ end
140
+ # Describes a field within a message.
141
+ f.message "FieldDescriptorProto" do |m|
142
+ m.field :name, 1, :string
143
+ m.field :number, 3, :int32
144
+ m.field :label, 4, :enum, ".google.protobuf.FieldDescriptorProto.Label"
145
+ # If type_name is set, this need not be set. If both this and type_name
146
+ # are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
147
+ m.field :type, 5, :enum, ".google.protobuf.FieldDescriptorProto.Type"
148
+ # For message and enum types, this is the name of the type. If the name
149
+ # starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
150
+ # rules are used to find the type (i.e. first the nested types within this
151
+ # message are searched, then within the parent, on up to the root
152
+ # namespace).
153
+ m.field :type_name, 6, :string
154
+ # For extensions, this is the name of the type being extended. It is
155
+ # resolved in the same manner as type_name.
156
+ m.field :extendee, 2, :string
157
+ # For numeric types, contains the original text representation of the value.
158
+ # For booleans, "true" or "false".
159
+ # For strings, contains the default text contents (not escaped in any way).
160
+ # For bytes, contains the C escaped value. All bytes >= 128 are escaped.
161
+ m.field :default_value, 7, :string
162
+ # If set, gives the index of a oneof in the containing type's oneof_decl
163
+ # list. This field is a member of that oneof.
164
+ m.field :oneof_index, 9, :int32
165
+ # JSON name of this field. The value is set by protocol compiler. If the
166
+ # user has set a "json_name" option on this field, that option's value
167
+ # will be used. Otherwise, it's deduced from the field's name by converting
168
+ # it to camelCase.
169
+ m.field :json_name, 10, :string
170
+ m.field :options, 8, :message, ".google.protobuf.FieldOptions"
171
+ # If true, this is a proto3 "optional". When a proto3 field is optional, it
172
+ # tracks presence regardless of field type.
173
+ #
174
+ # When proto3_optional is true, this field must belong to a oneof to signal
175
+ # to old proto3 clients that presence is tracked for this field. This oneof
176
+ # is known as a "synthetic" oneof, and this field must be its sole member
177
+ # (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs
178
+ # exist in the descriptor only, and do not generate any API. Synthetic oneofs
179
+ # must be ordered after all "real" oneofs.
180
+ #
181
+ # For message fields, proto3_optional doesn't create any semantic change,
182
+ # since non-repeated message fields always track presence. However it still
183
+ # indicates the semantic detail of whether the user wrote "optional" or not.
184
+ # This can be useful for round-tripping the .proto file. For consistency we
185
+ # give message fields a synthetic oneof also, even though it is not required
186
+ # to track presence. This is especially important because the parser can't
187
+ # tell if a field is a message or an enum, so it must always create a
188
+ # synthetic oneof.
189
+ #
190
+ # Proto2 optional fields do not set this flag, because they already indicate
191
+ # optional with `LABEL_OPTIONAL`.
192
+ m.field :proto3_optional, 17, :bool
193
+ m.enum "Type" do |e|
194
+ # 0 is reserved for errors.
195
+ # Order is weird for historical reasons.
196
+ e.value :TYPE_DOUBLE, 1
197
+ e.value :TYPE_FLOAT, 2
198
+ # Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
199
+ # negative values are likely.
200
+ e.value :TYPE_INT64, 3
201
+ e.value :TYPE_UINT64, 4
202
+ # Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
203
+ # negative values are likely.
204
+ e.value :TYPE_INT32, 5
205
+ e.value :TYPE_FIXED64, 6
206
+ e.value :TYPE_FIXED32, 7
207
+ e.value :TYPE_BOOL, 8
208
+ e.value :TYPE_STRING, 9
209
+ # Tag-delimited aggregate.
210
+ # Group type is deprecated and not supported after google.protobuf. However, Proto3
211
+ # implementations should still be able to parse the group wire format and
212
+ # treat group fields as unknown fields. In Editions, the group wire format
213
+ # can be enabled via the `message_encoding` feature.
214
+ e.value :TYPE_GROUP, 10
215
+ e.value :TYPE_MESSAGE, 11
216
+ # New in version 2.
217
+ e.value :TYPE_BYTES, 12
218
+ e.value :TYPE_UINT32, 13
219
+ e.value :TYPE_ENUM, 14
220
+ e.value :TYPE_SFIXED32, 15
221
+ e.value :TYPE_SFIXED64, 16
222
+ e.value :TYPE_SINT32, 17
223
+ e.value :TYPE_SINT64, 18
224
+ end
225
+ m.enum "Label" do |e|
226
+ # 0 is reserved for errors
227
+ e.value :LABEL_OPTIONAL, 1
228
+ e.value :LABEL_REPEATED, 3
229
+ # The required label is only allowed in google.protobuf. In proto3 and Editions
230
+ # it's explicitly prohibited. In Editions, the `field_presence` feature
231
+ # can be used to get this behavior.
232
+ e.value :LABEL_REQUIRED, 2
233
+ end
234
+ end
235
+ # Describes a oneof.
236
+ f.message "OneofDescriptorProto" do |m|
237
+ m.field :name, 1, :string
238
+ m.field :options, 2, :message, ".google.protobuf.OneofOptions"
239
+ end
240
+ # Describes an enum type.
241
+ f.message "EnumDescriptorProto" do |m|
242
+ m.field :name, 1, :string
243
+ m.field :value, 2, :message, ".google.protobuf.EnumValueDescriptorProto", label: :repeated
244
+ m.field :options, 3, :message, ".google.protobuf.EnumOptions"
245
+ # Range of reserved numeric values. Reserved numeric values may not be used
246
+ # by enum values in the same enum declaration. Reserved ranges may not
247
+ # overlap.
248
+ m.field :reserved_range, 4, :message, ".google.protobuf.EnumDescriptorProto.EnumReservedRange",
249
+ label: :repeated
250
+ # Reserved enum value names, which may not be reused. A given name may only
251
+ # be reserved once.
252
+ m.field :reserved_name, 5, :string, label: :repeated
253
+ # Support for `export` and `local` keywords on enums.
254
+ m.field :visibility, 6, :enum, ".google.protobuf.SymbolVisibility"
255
+ # Range of reserved numeric values. Reserved values may not be used by
256
+ # entries in the same enum. Reserved ranges may not overlap.
257
+ #
258
+ # Note that this is distinct from DescriptorProto.ReservedRange in that it
259
+ # is inclusive such that it can appropriately represent the entire int32
260
+ # domain.
261
+ m.message "EnumReservedRange" do |m|
262
+ m.field :start, 1, :int32
263
+ m.field :end, 2, :int32
264
+ end
265
+ end
266
+ # Describes a value within an enum.
267
+ f.message "EnumValueDescriptorProto" do |m|
268
+ m.field :name, 1, :string
269
+ m.field :number, 2, :int32
270
+ m.field :options, 3, :message, ".google.protobuf.EnumValueOptions"
271
+ end
272
+ # Describes a service.
273
+ f.message "ServiceDescriptorProto" do |m|
274
+ m.field :name, 1, :string
275
+ m.field :method, 2, :message, ".google.protobuf.MethodDescriptorProto", label: :repeated
276
+ m.field :options, 3, :message, ".google.protobuf.ServiceOptions"
277
+ m.reserved 4, "stream"
278
+ end
279
+ # Describes a method of a service.
280
+ f.message "MethodDescriptorProto" do |m|
281
+ m.field :name, 1, :string
282
+ # Input and output type names. These are resolved in the same way as
283
+ # FieldDescriptorProto.type_name, but must refer to a message type.
284
+ m.field :input_type, 2, :string
285
+ m.field :output_type, 3, :string
286
+ m.field :options, 4, :message, ".google.protobuf.MethodOptions"
287
+ # Identifies if client streams multiple client messages
288
+ m.field :client_streaming, 5, :bool, default: "false"
289
+ # Identifies if server streams multiple server messages
290
+ m.field :server_streaming, 6, :bool, default: "false"
291
+ end
292
+ f.message "FileOptions" do |m|
293
+ # Sets the Java package where classes generated from this .proto will be
294
+ # placed. By default, the proto package is used, but this is often
295
+ # inappropriate because proto packages do not normally start with backwards
296
+ # domain names.
297
+ m.field :java_package, 1, :string
298
+ # Controls the name of the wrapper Java class generated for the .proto file.
299
+ # That class will always contain the .proto file's getDescriptor() method as
300
+ # well as any top-level extensions defined in the .proto file.
301
+ # If java_multiple_files is disabled, then all the other classes from the
302
+ # .proto file will be nested inside the single wrapper outer class.
303
+ m.field :java_outer_classname, 8, :string
304
+ # If enabled, then the Java code generator will generate a separate .java
305
+ # file for each top-level message, enum, and service defined in the .proto
306
+ # file. Thus, these types will *not* be nested inside the wrapper class
307
+ # named by java_outer_classname. However, the wrapper class will still be
308
+ # generated to contain the file's getDescriptor() method as well as any
309
+ # top-level extensions defined in the file.
310
+ m.field :java_multiple_files, 10, :bool,
311
+ default: "false",
312
+ feature_support: {
313
+ edition_introduced: :EDITION_PROTO2,
314
+ edition_removed: :EDITION_2024,
315
+ removal_error: "This behavior is enabled by default in editions 2024 and above. To disable it, you can set `features.(pb.java).nest_in_file_class = YES` on individual messages, enums, or services."
316
+ }
317
+ # This option does nothing.
318
+ m.field :java_generate_equals_and_hash, 20, :bool, deprecated: true
319
+ # A proto2 file can set this to true to opt in to UTF-8 checking for Java,
320
+ # which will throw an exception if invalid UTF-8 is parsed from the wire or
321
+ # assigned to a string field.
322
+ #
323
+ # TODO: clarify exactly what kinds of field types this option
324
+ # applies to, and update these docs accordingly.
325
+ #
326
+ # Proto3 files already perform these checks. Setting the option explicitly to
327
+ # false has no effect: it cannot be used to opt proto3 files out of UTF-8
328
+ # checks.
329
+ m.field :java_string_check_utf8, 27, :bool, default: "false"
330
+ m.field :optimize_for, 9, :enum, ".google.protobuf.FileOptions.OptimizeMode", default: "SPEED"
331
+ # Sets the Go package where structs generated from this .proto will be
332
+ # placed. If omitted, the Go package will be derived from the following:
333
+ # - The basename of the package import path, if provided.
334
+ # - Otherwise, the package statement in the .proto file, if present.
335
+ # - Otherwise, the basename of the .proto file, without extension.
336
+ m.field :go_package, 11, :string
337
+ # Should generic services be generated in each language? "Generic" services
338
+ # are not specific to any particular RPC system. They are generated by the
339
+ # main code generators in each language (without additional plugins).
340
+ # Generic services were the only kind of service generation supported by
341
+ # early versions of google.protobuf.
342
+ #
343
+ # Generic services are now considered deprecated in favor of using plugins
344
+ # that generate code specific to your particular RPC system. Therefore,
345
+ # these default to false. Old code which depends on generic services should
346
+ # explicitly set them to true.
347
+ m.field :cc_generic_services, 16, :bool, default: "false"
348
+ m.field :java_generic_services, 17, :bool, default: "false"
349
+ m.field :py_generic_services, 18, :bool, default: "false"
350
+ # Is this file deprecated?
351
+ # Depending on the target platform, this can emit Deprecated annotations
352
+ # for everything in the file, or it will be completely ignored; in the very
353
+ # least, this is a formalization for deprecating files.
354
+ m.field :deprecated, 23, :bool, default: "false"
355
+ # Enables the use of arenas for the proto messages in this file. This applies
356
+ # only to generated classes for C++.
357
+ m.field :cc_enable_arenas, 31, :bool,
358
+ default: "true",
359
+ feature_support: {
360
+ edition_removed: :EDITION_2026,
361
+ removal_error: "cc_enable_arenas is enabled by default in every edition and overrides are ignored.This option is removed in editions 2026 and above."
362
+ }
363
+ # Sets the objective c class prefix which is prepended to all objective c
364
+ # generated classes from this .proto. There is no default.
365
+ m.field :objc_class_prefix, 36, :string
366
+ # Namespace for generated classes; defaults to the package.
367
+ m.field :csharp_namespace, 37, :string
368
+ # By default Swift generators will take the proto package and CamelCase it
369
+ # replacing '.' with underscore and use that to prefix the types/symbols
370
+ # defined. When this options is provided, they will use this value instead
371
+ # to prefix the types/symbols defined.
372
+ m.field :swift_prefix, 39, :string
373
+ # Sets the php class prefix which is prepended to all php generated classes
374
+ # from this .proto. Default is empty.
375
+ m.field :php_class_prefix, 40, :string
376
+ # Use this option to change the namespace of php generated classes. Default
377
+ # is empty. When this option is empty, the package name will be used for
378
+ # determining the namespace.
379
+ m.field :php_namespace, 41, :string
380
+ # Use this option to change the namespace of php generated metadata classes.
381
+ # Default is empty. When this option is empty, the proto file name will be
382
+ # used for determining the namespace.
383
+ m.field :php_metadata_namespace, 44, :string
384
+ # Use this option to change the package of ruby generated classes. Default
385
+ # is empty. When this option is not set, the package name will be used for
386
+ # determining the ruby package.
387
+ m.field :ruby_package, 45, :string
388
+ # Any features defined in the specific edition.
389
+ # WARNING: This field should only be used by protobuf plugins or special
390
+ # cases like the proto compiler. Other uses are discouraged and
391
+ # developers should rely on the protoreflect APIs for their client language.
392
+ m.field :features, 50, :message, ".google.protobuf.FeatureSet"
393
+ # The parser stores options it doesn't recognize here.
394
+ # See the documentation for the "Options" section above.
395
+ m.field :uninterpreted_option, 999, :message, ".google.protobuf.UninterpretedOption",
396
+ label: :repeated
397
+ # Generated classes can be optimized for speed or code size.
398
+ m.enum "OptimizeMode" do |e|
399
+ e.value :SPEED, 1
400
+ # etc.
401
+ e.value :CODE_SIZE, 2
402
+ e.value :LITE_RUNTIME, 3
403
+ end
404
+ m.extensions 990..998
405
+ m.extensions 1000..536870911
406
+ m.reserved 42, 38, "php_generic_services"
407
+ end
408
+ f.message "MessageOptions" do |m|
409
+ # Set true to use the old proto1 MessageSet wire format for extensions.
410
+ # This is provided for backwards-compatibility with the MessageSet wire
411
+ # format. You should not use this for any other reason: It's less
412
+ # efficient, has fewer features, and is more complicated.
413
+ #
414
+ # The message must be defined exactly as follows:
415
+ # message Foo {
416
+ # option message_set_wire_format = true;
417
+ # extensions 4 to max;
418
+ # }
419
+ # Note that the message cannot have any defined fields; MessageSets only
420
+ # have extensions.
421
+ #
422
+ # All extensions of your type must be singular messages; e.g. they cannot
423
+ # be int32s, enums, or repeated messages.
424
+ #
425
+ # Because this is an option, the above two restrictions are not enforced by
426
+ # the protocol compiler.
427
+ m.field :message_set_wire_format, 1, :bool, default: "false"
428
+ # Disables the generation of the standard "descriptor()" accessor, which can
429
+ # conflict with a field of the same name. This is meant to make migration
430
+ # from proto1 easier; new code should avoid fields named "descriptor".
431
+ m.field :no_standard_descriptor_accessor, 2, :bool, default: "false"
432
+ # Is this message deprecated?
433
+ # Depending on the target platform, this can emit Deprecated annotations
434
+ # for the message, or it will be completely ignored; in the very least,
435
+ # this is a formalization for deprecating messages.
436
+ m.field :deprecated, 3, :bool, default: "false"
437
+ # Whether the message is an automatically generated map entry type for the
438
+ # maps field.
439
+ #
440
+ # For maps fields:
441
+ # map<KeyType, ValueType> map_field = 1;
442
+ # The parsed descriptor looks like:
443
+ # message MapFieldEntry {
444
+ # option map_entry = true;
445
+ # optional KeyType key = 1;
446
+ # optional ValueType value = 2;
447
+ # }
448
+ # repeated MapFieldEntry map_field = 1;
449
+ #
450
+ # Implementations may choose not to generate the map_entry=true message, but
451
+ # use a native map in the target language to hold the keys and values.
452
+ # The reflection APIs in such implementations still need to work as
453
+ # if the field is a repeated message field.
454
+ #
455
+ # NOTE: Do not set the option in .proto files. Always use the maps syntax
456
+ # instead. The option should only be implicitly set by the proto compiler
457
+ # parser.
458
+ m.field :map_entry, 7, :bool
459
+ # Enable the legacy handling of JSON field name conflicts. This lowercases
460
+ # and strips underscored from the fields before comparison in proto3 only.
461
+ # The new behavior takes `json_name` into account and applies to proto2 as
462
+ # well.
463
+ #
464
+ # This should only be used as a temporary measure against broken builds due
465
+ # to the change in behavior for JSON field name conflicts.
466
+ #
467
+ # TODO This is legacy behavior we plan to remove once downstream
468
+ # teams have had time to migrate.
469
+ m.field :deprecated_legacy_json_field_conflicts, 11, :bool, deprecated: true
470
+ # Any features defined in the specific edition.
471
+ # WARNING: This field should only be used by protobuf plugins or special
472
+ # cases like the proto compiler. Other uses are discouraged and
473
+ # developers should rely on the protoreflect APIs for their client language.
474
+ m.field :features, 12, :message, ".google.protobuf.FeatureSet"
475
+ # The parser stores options it doesn't recognize here. See above.
476
+ m.field :uninterpreted_option, 999, :message, ".google.protobuf.UninterpretedOption",
477
+ label: :repeated
478
+ m.extensions 990..998
479
+ m.extensions 1000..536870911
480
+ m.reserved 4, 5, 6, 8, 9
481
+ end
482
+ f.message "FieldOptions" do |m|
483
+ # NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead.
484
+ # The ctype option instructs the C++ code generator to use a different
485
+ # representation of the field than it normally would. See the specific
486
+ # options below. This option is only implemented to support use of
487
+ # [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
488
+ # type "bytes" in the open source release.
489
+ # TODO: make ctype actually deprecated.
490
+ m.field :ctype, 1, :enum, ".google.protobuf.FieldOptions.CType", default: "STRING"
491
+ # The packed option can be enabled for repeated primitive fields to enable
492
+ # a more efficient representation on the wire. Rather than repeatedly
493
+ # writing the tag and type for each element, the entire array is encoded as
494
+ # a single length-delimited blob. In proto3, only explicit setting it to
495
+ # false will avoid using packed encoding. This option is prohibited in
496
+ # Editions, but the `repeated_field_encoding` feature can be used to control
497
+ # the behavior.
498
+ m.field :packed, 2, :bool
499
+ # The jstype option determines the JavaScript type used for values of the
500
+ # field. The option is permitted only for 64 bit integral and fixed types
501
+ # (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
502
+ # is represented as JavaScript string, which avoids loss of precision that
503
+ # can happen when a large value is converted to a floating point JavaScript.
504
+ # Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
505
+ # use the JavaScript "number" type. The behavior of the default option
506
+ # JS_NORMAL is implementation dependent.
507
+ #
508
+ # This option is an enum to permit additional types to be added, e.g.
509
+ # goog.math.Integer.
510
+ m.field :jstype, 6, :enum, ".google.protobuf.FieldOptions.JSType", default: "JS_NORMAL"
511
+ # Should this field be parsed lazily? Lazy applies only to message-type
512
+ # fields. It means that when the outer message is initially parsed, the
513
+ # inner message's contents will not be parsed but instead stored in encoded
514
+ # form. The inner message will actually be parsed when it is first accessed.
515
+ #
516
+ # This is only a hint. Implementations are free to choose whether to use
517
+ # eager or lazy parsing regardless of the value of this option. However,
518
+ # setting this option true suggests that the protocol author believes that
519
+ # using lazy parsing on this field is worth the additional bookkeeping
520
+ # overhead typically needed to implement it.
521
+ #
522
+ # This option does not affect the public interface of any generated code;
523
+ # all method signatures remain the same. Furthermore, thread-safety of the
524
+ # interface is not affected by this option; const methods remain safe to
525
+ # call from multiple threads concurrently, while non-const methods continue
526
+ # to require exclusive access.
527
+ #
528
+ # Note that lazy message fields are still eagerly verified to check
529
+ # ill-formed wireformat or missing required fields. Calling IsInitialized()
530
+ # on the outer message would fail if the inner message has missing required
531
+ # fields. Failed verification would result in parsing failure (except when
532
+ # uninitialized messages are acceptable).
533
+ m.field :lazy, 5, :bool, default: "false"
534
+ # unverified_lazy does no correctness checks on the byte stream. This should
535
+ # only be used where lazy with verification is prohibitive for performance
536
+ # reasons.
537
+ m.field :unverified_lazy, 15, :bool, default: "false"
538
+ # Is this field deprecated?
539
+ # Depending on the target platform, this can emit Deprecated annotations
540
+ # for accessors, or it will be completely ignored; in the very least, this
541
+ # is a formalization for deprecating fields.
542
+ m.field :deprecated, 3, :bool, default: "false"
543
+ # DEPRECATED. DO NOT USE!
544
+ # For Google-internal migration only. Do not use.
545
+ m.field :weak, 10, :bool, default: "false", deprecated: true
546
+ # Indicate that the field value should not be printed out when using debug
547
+ # formats, e.g. when the field contains sensitive credentials.
548
+ m.field :debug_redact, 16, :bool, default: "false"
549
+ m.field :retention, 17, :enum, ".google.protobuf.FieldOptions.OptionRetention"
550
+ m.field :targets, 19, :enum, ".google.protobuf.FieldOptions.OptionTargetType", label: :repeated
551
+ m.field :edition_defaults, 20, :message, ".google.protobuf.FieldOptions.EditionDefault",
552
+ label: :repeated
553
+ # Any features defined in the specific edition.
554
+ # WARNING: This field should only be used by protobuf plugins or special
555
+ # cases like the proto compiler. Other uses are discouraged and
556
+ # developers should rely on the protoreflect APIs for their client language.
557
+ m.field :features, 21, :message, ".google.protobuf.FeatureSet"
558
+ m.field :feature_support, 22, :message, ".google.protobuf.FieldOptions.FeatureSupport"
559
+ # The parser stores options it doesn't recognize here. See above.
560
+ m.field :uninterpreted_option, 999, :message, ".google.protobuf.UninterpretedOption",
561
+ label: :repeated
562
+ m.message "EditionDefault" do |m|
563
+ m.field :edition, 3, :enum, ".google.protobuf.Edition"
564
+ m.field :value, 2, :string
565
+ end
566
+ # Information about the support window of a feature.
567
+ m.message "FeatureSupport" do |m|
568
+ # The edition that this feature was first available in. In editions
569
+ # earlier than this one, the default assigned to EDITION_LEGACY will be
570
+ # used, and proto files will not be able to override it.
571
+ m.field :edition_introduced, 1, :enum, ".google.protobuf.Edition"
572
+ # The edition this feature becomes deprecated in. Using this after this
573
+ # edition may trigger warnings.
574
+ m.field :edition_deprecated, 2, :enum, ".google.protobuf.Edition"
575
+ # The deprecation warning text if this feature is used after the edition it
576
+ # was marked deprecated in.
577
+ m.field :deprecation_warning, 3, :string
578
+ # The edition this feature is no longer available in. In editions after
579
+ # this one, the last default assigned will be used, and proto files will
580
+ # not be able to override it.
581
+ m.field :edition_removed, 4, :enum, ".google.protobuf.Edition"
582
+ # The removal error text if this feature is used after the edition it was
583
+ # removed in.
584
+ m.field :removal_error, 5, :string
585
+ end
586
+ m.enum "CType" do |e|
587
+ # Default mode.
588
+ e.value :STRING, 0
589
+ # The option [ctype=CORD] may be applied to a non-repeated field of type
590
+ # "bytes". It indicates that in C++, the data should be stored in a Cord
591
+ # instead of a string. For very large strings, this may reduce memory
592
+ # fragmentation. It may also allow better performance when parsing from a
593
+ # Cord, or when parsing with aliasing enabled, as the parsed Cord may then
594
+ # alias the original buffer.
595
+ e.value :CORD, 1
596
+ e.value :STRING_PIECE, 2
597
+ end
598
+ m.enum "JSType" do |e|
599
+ # Use the default type.
600
+ e.value :JS_NORMAL, 0
601
+ # Use JavaScript strings.
602
+ e.value :JS_STRING, 1
603
+ # Use JavaScript numbers.
604
+ e.value :JS_NUMBER, 2
605
+ end
606
+ # If set to RETENTION_SOURCE, the option will be omitted from the binary.
607
+ m.enum "OptionRetention" do |e|
608
+ e.value :RETENTION_UNKNOWN, 0
609
+ e.value :RETENTION_RUNTIME, 1
610
+ e.value :RETENTION_SOURCE, 2
611
+ end
612
+ # This indicates the types of entities that the field may apply to when used
613
+ # as an option. If it is unset, then the field may be freely used as an
614
+ # option on any kind of entity.
615
+ m.enum "OptionTargetType" do |e|
616
+ e.value :TARGET_TYPE_UNKNOWN, 0
617
+ e.value :TARGET_TYPE_FILE, 1
618
+ e.value :TARGET_TYPE_EXTENSION_RANGE, 2
619
+ e.value :TARGET_TYPE_MESSAGE, 3
620
+ e.value :TARGET_TYPE_FIELD, 4
621
+ e.value :TARGET_TYPE_ONEOF, 5
622
+ e.value :TARGET_TYPE_ENUM, 6
623
+ e.value :TARGET_TYPE_ENUM_ENTRY, 7
624
+ e.value :TARGET_TYPE_SERVICE, 8
625
+ e.value :TARGET_TYPE_METHOD, 9
626
+ end
627
+ m.extensions 990..998
628
+ m.extensions 1000..536870911
629
+ m.reserved 4, 18
630
+ end
631
+ f.message "OneofOptions" do |m|
632
+ # Any features defined in the specific edition.
633
+ # WARNING: This field should only be used by protobuf plugins or special
634
+ # cases like the proto compiler. Other uses are discouraged and
635
+ # developers should rely on the protoreflect APIs for their client language.
636
+ m.field :features, 1, :message, ".google.protobuf.FeatureSet"
637
+ # The parser stores options it doesn't recognize here. See above.
638
+ m.field :uninterpreted_option, 999, :message, ".google.protobuf.UninterpretedOption",
639
+ label: :repeated
640
+ m.extensions 990..998
641
+ m.extensions 1000..536870911
642
+ end
643
+ f.message "EnumOptions" do |m|
644
+ # Set this option to true to allow mapping different tag names to the same
645
+ # value.
646
+ m.field :allow_alias, 2, :bool
647
+ # Is this enum deprecated?
648
+ # Depending on the target platform, this can emit Deprecated annotations
649
+ # for the enum, or it will be completely ignored; in the very least, this
650
+ # is a formalization for deprecating enums.
651
+ m.field :deprecated, 3, :bool, default: "false"
652
+ # Enable the legacy handling of JSON field name conflicts. This lowercases
653
+ # and strips underscored from the fields before comparison in proto3 only.
654
+ # The new behavior takes `json_name` into account and applies to proto2 as
655
+ # well.
656
+ # TODO Remove this legacy behavior once downstream teams have
657
+ # had time to migrate.
658
+ m.field :deprecated_legacy_json_field_conflicts, 6, :bool, deprecated: true
659
+ # Any features defined in the specific edition.
660
+ # WARNING: This field should only be used by protobuf plugins or special
661
+ # cases like the proto compiler. Other uses are discouraged and
662
+ # developers should rely on the protoreflect APIs for their client language.
663
+ m.field :features, 7, :message, ".google.protobuf.FeatureSet"
664
+ # The parser stores options it doesn't recognize here. See above.
665
+ m.field :uninterpreted_option, 999, :message, ".google.protobuf.UninterpretedOption",
666
+ label: :repeated
667
+ m.extensions 990..998
668
+ m.extensions 1000..536870911
669
+ m.reserved 5
670
+ end
671
+ f.message "EnumValueOptions" do |m|
672
+ # Is this enum value deprecated?
673
+ # Depending on the target platform, this can emit Deprecated annotations
674
+ # for the enum value, or it will be completely ignored; in the very least,
675
+ # this is a formalization for deprecating enum values.
676
+ m.field :deprecated, 1, :bool, default: "false"
677
+ # Any features defined in the specific edition.
678
+ # WARNING: This field should only be used by protobuf plugins or special
679
+ # cases like the proto compiler. Other uses are discouraged and
680
+ # developers should rely on the protoreflect APIs for their client language.
681
+ m.field :features, 2, :message, ".google.protobuf.FeatureSet"
682
+ # Indicate that fields annotated with this enum value should not be printed
683
+ # out when using debug formats, e.g. when the field contains sensitive
684
+ # credentials.
685
+ m.field :debug_redact, 3, :bool, default: "false"
686
+ # Information about the support window of a feature value.
687
+ m.field :feature_support, 4, :message, ".google.protobuf.FieldOptions.FeatureSupport"
688
+ # The parser stores options it doesn't recognize here. See above.
689
+ m.field :uninterpreted_option, 999, :message, ".google.protobuf.UninterpretedOption",
690
+ label: :repeated
691
+ m.extensions 990..998
692
+ m.extensions 1000..536870911
693
+ end
694
+ f.message "ServiceOptions" do |m|
695
+ # Any features defined in the specific edition.
696
+ # WARNING: This field should only be used by protobuf plugins or special
697
+ # cases like the proto compiler. Other uses are discouraged and
698
+ # developers should rely on the protoreflect APIs for their client language.
699
+ m.field :features, 34, :message, ".google.protobuf.FeatureSet"
700
+ # Is this service deprecated?
701
+ # Depending on the target platform, this can emit Deprecated annotations
702
+ # for the service, or it will be completely ignored; in the very least,
703
+ # this is a formalization for deprecating services.
704
+ m.field :deprecated, 33, :bool, default: "false"
705
+ # The parser stores options it doesn't recognize here. See above.
706
+ m.field :uninterpreted_option, 999, :message, ".google.protobuf.UninterpretedOption",
707
+ label: :repeated
708
+ m.extensions 990..998
709
+ m.extensions 1000..536870911
710
+ end
711
+ f.message "MethodOptions" do |m|
712
+ # Is this method deprecated?
713
+ # Depending on the target platform, this can emit Deprecated annotations
714
+ # for the method, or it will be completely ignored; in the very least,
715
+ # this is a formalization for deprecating methods.
716
+ m.field :deprecated, 33, :bool, default: "false"
717
+ m.field :idempotency_level, 34, :enum, ".google.protobuf.MethodOptions.IdempotencyLevel",
718
+ default: "IDEMPOTENCY_UNKNOWN"
719
+ # Any features defined in the specific edition.
720
+ # WARNING: This field should only be used by protobuf plugins or special
721
+ # cases like the proto compiler. Other uses are discouraged and
722
+ # developers should rely on the protoreflect APIs for their client language.
723
+ m.field :features, 35, :message, ".google.protobuf.FeatureSet"
724
+ # The parser stores options it doesn't recognize here. See above.
725
+ m.field :uninterpreted_option, 999, :message, ".google.protobuf.UninterpretedOption",
726
+ label: :repeated
727
+ # Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
728
+ # or neither? HTTP based RPC implementation may choose GET verb for safe
729
+ # methods, and PUT verb for idempotent methods instead of the default POST.
730
+ m.enum "IdempotencyLevel" do |e|
731
+ e.value :IDEMPOTENCY_UNKNOWN, 0
732
+ e.value :NO_SIDE_EFFECTS, 1
733
+ e.value :IDEMPOTENT, 2
734
+ end
735
+ m.extensions 990..998
736
+ m.extensions 1000..536870911
737
+ end
738
+ # A message representing a option the parser does not recognize. This only
739
+ # appears in options protos created by the compiler::Parser class.
740
+ # DescriptorPool resolves these when building Descriptor objects. Therefore,
741
+ # options protos in descriptor objects (e.g. returned by Descriptor::options(),
742
+ # or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
743
+ # in them.
744
+ f.message "UninterpretedOption" do |m|
745
+ m.field :name, 2, :message, ".google.protobuf.UninterpretedOption.NamePart", label: :repeated
746
+ # The value of the uninterpreted option, in whatever type the tokenizer
747
+ # identified it as during parsing. Exactly one of these should be set.
748
+ m.field :identifier_value, 3, :string
749
+ m.field :positive_int_value, 4, :uint64
750
+ m.field :negative_int_value, 5, :int64
751
+ m.field :double_value, 6, :double
752
+ m.field :string_value, 7, :bytes
753
+ m.field :aggregate_value, 8, :string
754
+ # The name of the uninterpreted option. Each string represents a segment in
755
+ # a dot-separated name. is_extension is true iff a segment represents an
756
+ # extension (denoted with parentheses in options specs in .proto files).
757
+ # E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents
758
+ # "foo.(bar.baz).moo".
759
+ m.message "NamePart" do |m|
760
+ m.field :name_part, 1, :string, label: :required
761
+ m.field :is_extension, 2, :bool, label: :required
762
+ end
763
+ end
764
+ # TODO Enums in C++ gencode (and potentially other languages) are
765
+ # not well scoped. This means that each of the feature enums below can clash
766
+ # with each other. The short names we've chosen maximize call-site
767
+ # readability, but leave us very open to this scenario. A future feature will
768
+ # be designed and implemented to handle this, hopefully before we ever hit a
769
+ # conflict here.
770
+ f.message "FeatureSet" do |m|
771
+ m.field :field_presence, 1, :enum, ".google.protobuf.FeatureSet.FieldPresence",
772
+ retention: :RETENTION_RUNTIME,
773
+ targets: [:TARGET_TYPE_FIELD, :TARGET_TYPE_FILE],
774
+ feature_support: {edition_introduced: :EDITION_2023},
775
+ edition_defaults: [
776
+ {edition: :EDITION_LEGACY, value: "EXPLICIT"},
777
+ {edition: :EDITION_PROTO3, value: "IMPLICIT"},
778
+ {edition: :EDITION_2023, value: "EXPLICIT"}
779
+ ]
780
+ m.field :enum_type, 2, :enum, ".google.protobuf.FeatureSet.EnumType",
781
+ retention: :RETENTION_RUNTIME,
782
+ targets: [:TARGET_TYPE_ENUM, :TARGET_TYPE_FILE],
783
+ feature_support: {edition_introduced: :EDITION_2023},
784
+ edition_defaults: [
785
+ {edition: :EDITION_LEGACY, value: "CLOSED"},
786
+ {edition: :EDITION_PROTO3, value: "OPEN"}
787
+ ]
788
+ m.field :repeated_field_encoding, 3, :enum, ".google.protobuf.FeatureSet.RepeatedFieldEncoding",
789
+ retention: :RETENTION_RUNTIME,
790
+ targets: [:TARGET_TYPE_FIELD, :TARGET_TYPE_FILE],
791
+ feature_support: {edition_introduced: :EDITION_2023},
792
+ edition_defaults: [
793
+ {edition: :EDITION_LEGACY, value: "EXPANDED"},
794
+ {edition: :EDITION_PROTO3, value: "PACKED"}
795
+ ]
796
+ m.field :utf8_validation, 4, :enum, ".google.protobuf.FeatureSet.Utf8Validation",
797
+ retention: :RETENTION_RUNTIME,
798
+ targets: [:TARGET_TYPE_FIELD, :TARGET_TYPE_FILE],
799
+ feature_support: {edition_introduced: :EDITION_2023},
800
+ edition_defaults: [
801
+ {edition: :EDITION_LEGACY, value: "NONE"},
802
+ {edition: :EDITION_PROTO3, value: "VERIFY"}
803
+ ]
804
+ m.field :message_encoding, 5, :enum, ".google.protobuf.FeatureSet.MessageEncoding",
805
+ retention: :RETENTION_RUNTIME,
806
+ targets: [:TARGET_TYPE_FIELD, :TARGET_TYPE_FILE],
807
+ feature_support: {edition_introduced: :EDITION_2023},
808
+ edition_defaults: [{edition: :EDITION_LEGACY, value: "LENGTH_PREFIXED"}]
809
+ m.field :json_format, 6, :enum, ".google.protobuf.FeatureSet.JsonFormat",
810
+ retention: :RETENTION_RUNTIME,
811
+ targets: [:TARGET_TYPE_MESSAGE, :TARGET_TYPE_ENUM, :TARGET_TYPE_FILE],
812
+ feature_support: {edition_introduced: :EDITION_2023},
813
+ edition_defaults: [
814
+ {edition: :EDITION_LEGACY, value: "LEGACY_BEST_EFFORT"},
815
+ {edition: :EDITION_PROTO3, value: "ALLOW"}
816
+ ]
817
+ m.field :enforce_naming_style, 7, :enum, ".google.protobuf.FeatureSet.EnforceNamingStyle",
818
+ retention: :RETENTION_SOURCE,
819
+ targets: [
820
+ :TARGET_TYPE_FILE,
821
+ :TARGET_TYPE_EXTENSION_RANGE,
822
+ :TARGET_TYPE_MESSAGE,
823
+ :TARGET_TYPE_FIELD,
824
+ :TARGET_TYPE_ONEOF,
825
+ :TARGET_TYPE_ENUM,
826
+ :TARGET_TYPE_ENUM_ENTRY,
827
+ :TARGET_TYPE_SERVICE,
828
+ :TARGET_TYPE_METHOD
829
+ ],
830
+ feature_support: {edition_introduced: :EDITION_2024},
831
+ edition_defaults: [
832
+ {edition: :EDITION_LEGACY, value: "STYLE_LEGACY"},
833
+ {edition: :EDITION_2024, value: "STYLE2024"},
834
+ {edition: :EDITION_2026, value: "STYLE2026"}
835
+ ]
836
+ m.field :default_symbol_visibility, 8, :enum, ".google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility",
837
+ retention: :RETENTION_SOURCE,
838
+ targets: [:TARGET_TYPE_FILE],
839
+ feature_support: {edition_introduced: :EDITION_2024},
840
+ edition_defaults: [
841
+ {edition: :EDITION_LEGACY, value: "EXPORT_ALL"},
842
+ {edition: :EDITION_2024, value: "EXPORT_TOP_LEVEL"},
843
+ {edition: :EDITION_2026, value: "STRICT"}
844
+ ]
845
+ m.field :enforce_proto_limits, 9, :enum, ".google.protobuf.FeatureSet.ProtoLimitsFeature.EnforceProtoLimits",
846
+ retention: :RETENTION_SOURCE,
847
+ targets: [:TARGET_TYPE_ENUM, :TARGET_TYPE_MESSAGE, :TARGET_TYPE_FIELD, :TARGET_TYPE_ONEOF],
848
+ feature_support: {edition_introduced: :EDITION_2026},
849
+ edition_defaults: [
850
+ {edition: :EDITION_LEGACY, value: "LEGACY_NO_EXPLICIT_LIMITS"},
851
+ {edition: :EDITION_2026, value: "PROTO_LIMITS2026"}
852
+ ]
853
+ m.message "VisibilityFeature" do |m|
854
+ m.enum "DefaultSymbolVisibility" do |e|
855
+ e.value :DEFAULT_SYMBOL_VISIBILITY_UNKNOWN, 0
856
+ # Default pre-EDITION_2024, all UNSET visibility are export.
857
+ e.value :EXPORT_ALL, 1
858
+ # All top-level symbols default to export, nested default to local.
859
+ e.value :EXPORT_TOP_LEVEL, 2
860
+ # All symbols default to local.
861
+ e.value :LOCAL_ALL, 3
862
+ # All symbols local by default. Nested types cannot be exported.
863
+ # With special case caveat for message { enum {} reserved 1 to max; }
864
+ # This is the recommended setting for new protos.
865
+ e.value :STRICT, 4
866
+ end
867
+ m.reserved 1..536870911
868
+ end
869
+ m.message "ProtoLimitsFeature" do |m|
870
+ m.enum "EnforceProtoLimits" do |e|
871
+ e.value :PROTO_LIMITS_UNKNOWN, 0
872
+ # Default pre-EDITION_2026: there are no limit enforcement at the protoc
873
+ # level. Practical limits still exist, but they will tend to fail while
874
+ # compiling protoc-generated code, and these limits tend to be language
875
+ # or toolchain specific.
876
+ e.value :LEGACY_NO_EXPLICIT_LIMITS, 1
877
+ # A set of limits enforced by Edition 2026 by default. For a detailed
878
+ # list of all the limits please consult the Edition 2026 documentation.
879
+ e.value :PROTO_LIMITS2026, 2
880
+ end
881
+ end
882
+ m.enum "FieldPresence" do |e|
883
+ e.value :FIELD_PRESENCE_UNKNOWN, 0
884
+ e.value :EXPLICIT, 1
885
+ e.value :IMPLICIT, 2
886
+ e.value :LEGACY_REQUIRED, 3
887
+ end
888
+ m.enum "EnumType" do |e|
889
+ e.value :ENUM_TYPE_UNKNOWN, 0
890
+ e.value :OPEN, 1
891
+ e.value :CLOSED, 2
892
+ end
893
+ m.enum "RepeatedFieldEncoding" do |e|
894
+ e.value :REPEATED_FIELD_ENCODING_UNKNOWN, 0
895
+ e.value :PACKED, 1
896
+ e.value :EXPANDED, 2
897
+ end
898
+ m.enum "Utf8Validation" do |e|
899
+ e.value :UTF8_VALIDATION_UNKNOWN, 0
900
+ e.value :VERIFY, 2
901
+ e.value :NONE, 3
902
+ e.reserved 1
903
+ end
904
+ m.enum "MessageEncoding" do |e|
905
+ e.value :MESSAGE_ENCODING_UNKNOWN, 0
906
+ e.value :LENGTH_PREFIXED, 1
907
+ e.value :DELIMITED, 2
908
+ end
909
+ m.enum "JsonFormat" do |e|
910
+ e.value :JSON_FORMAT_UNKNOWN, 0
911
+ e.value :ALLOW, 1
912
+ e.value :LEGACY_BEST_EFFORT, 2
913
+ end
914
+ m.enum "EnforceNamingStyle" do |e|
915
+ e.value :ENFORCE_NAMING_STYLE_UNKNOWN, 0
916
+ e.value :STYLE2024, 1
917
+ e.value :STYLE_LEGACY, 2
918
+ e.value :STYLE2026, 3
919
+ end
920
+ m.extensions 1000..9994
921
+ m.extensions 9995..9999
922
+ m.extensions 10000
923
+ m.reserved 999
924
+ end
925
+ # A compiled specification for the defaults of a set of features. These
926
+ # messages are generated from FeatureSet extensions and can be used to seed
927
+ # feature resolution. The resolution with this object becomes a simple search
928
+ # for the closest matching edition, followed by proto merges.
929
+ f.message "FeatureSetDefaults" do |m|
930
+ m.field :defaults, 1, :message, ".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault",
931
+ label: :repeated
932
+ # The minimum supported edition (inclusive) when this was constructed.
933
+ # Editions before this will not have defaults.
934
+ m.field :minimum_edition, 4, :enum, ".google.protobuf.Edition"
935
+ # The maximum known edition (inclusive) when this was constructed. Editions
936
+ # after this will not have reliable defaults.
937
+ m.field :maximum_edition, 5, :enum, ".google.protobuf.Edition"
938
+ # A map from every known edition with a unique set of defaults to its
939
+ # defaults. Not all editions may be contained here. For a given edition,
940
+ # the defaults at the closest matching edition ordered at or before it should
941
+ # be used. This field must be in strict ascending order by edition.
942
+ m.message "FeatureSetEditionDefault" do |m|
943
+ m.field :edition, 3, :enum, ".google.protobuf.Edition"
944
+ # Defaults of features that can be overridden in this edition.
945
+ m.field :overridable_features, 4, :message, ".google.protobuf.FeatureSet"
946
+ # Defaults of features that can't be overridden in this edition.
947
+ m.field :fixed_features, 5, :message, ".google.protobuf.FeatureSet"
948
+ m.reserved 1, 2, "features"
949
+ end
950
+ end
951
+ # Encapsulates information about the original source file from which a
952
+ # FileDescriptorProto was generated.
953
+ f.message "SourceCodeInfo" do |m|
954
+ # A Location identifies a piece of source code in a .proto file which
955
+ # corresponds to a particular definition. This information is intended
956
+ # to be useful to IDEs, code indexers, documentation generators, and similar
957
+ # tools.
958
+ #
959
+ # For example, say we have a file like:
960
+ # message Foo {
961
+ # optional string foo = 1;
962
+ # }
963
+ # Let's look at just the field definition:
964
+ # optional string foo = 1;
965
+ # ^ ^^ ^^ ^ ^^^
966
+ # a bc de f ghi
967
+ # We have the following locations:
968
+ # span path represents
969
+ # [a,i) [ 4, 0, 2, 0 ] The whole field definition.
970
+ # [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
971
+ # [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
972
+ # [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
973
+ # [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
974
+ #
975
+ # Notes:
976
+ # - A location may refer to a repeated field itself (i.e. not to any
977
+ # particular index within it). This is used whenever a set of elements are
978
+ # logically enclosed in a single code segment. For example, an entire
979
+ # extend block (possibly containing multiple extension definitions) will
980
+ # have an outer location whose path refers to the "extensions" repeated
981
+ # field without an index.
982
+ # - Multiple locations may have the same path. This happens when a single
983
+ # logical declaration is spread out across multiple places. The most
984
+ # obvious example is the "extend" block again -- there may be multiple
985
+ # extend blocks in the same scope, each of which will have the same path.
986
+ # - A location's span is not always a subset of its parent's span. For
987
+ # example, the "extendee" of an extension declaration appears at the
988
+ # beginning of the "extend" block and is shared by all extensions within
989
+ # the block.
990
+ # - Just because a location's span is a subset of some other location's span
991
+ # does not mean that it is a descendant. For example, a "group" defines
992
+ # both a type and a field in a single declaration. Thus, the locations
993
+ # corresponding to the type and field and their components will overlap.
994
+ # - Code which tries to interpret locations should probably be designed to
995
+ # ignore those that it doesn't understand, as more types of locations could
996
+ # be recorded in the future.
997
+ m.field :location, 1, :message, ".google.protobuf.SourceCodeInfo.Location", label: :repeated
998
+ m.message "Location" do |m|
999
+ # Identifies which part of the FileDescriptorProto was defined at this
1000
+ # location.
1001
+ #
1002
+ # Each element is a field number or an index. They form a path from
1003
+ # the root FileDescriptorProto to the place where the definition appears.
1004
+ # For example, this path:
1005
+ # [ 4, 3, 2, 7, 1 ]
1006
+ # refers to:
1007
+ # file.message_type(3) // 4, 3
1008
+ # .field(7) // 2, 7
1009
+ # .name() // 1
1010
+ # This is because FileDescriptorProto.message_type has field number 4:
1011
+ # repeated DescriptorProto message_type = 4;
1012
+ # and DescriptorProto.field has field number 2:
1013
+ # repeated FieldDescriptorProto field = 2;
1014
+ # and FieldDescriptorProto.name has field number 1:
1015
+ # optional string name = 1;
1016
+ #
1017
+ # Thus, the above path gives the location of a field name. If we removed
1018
+ # the last element:
1019
+ # [ 4, 3, 2, 7 ]
1020
+ # this path refers to the whole field declaration (from the beginning
1021
+ # of the label to the terminating semicolon).
1022
+ #
1023
+ # For options, the path refers to the interpreted option in the descriptor.
1024
+ # E.g., for a custom option `(my_opt) = "foo"` on a message using extension
1025
+ # number 10101, the path is:
1026
+ # [ 4, 3, 7, 10101 ]
1027
+ # refers to:
1028
+ # file.message_type(3) // 4, 3
1029
+ # .options() // 7
1030
+ # .my_opt() // 10101
1031
+ #
1032
+ # Sub-locations corresponding to the interpreted option's corresponding
1033
+ # `UninterpretedOption` are also appended to the interpreted option, which
1034
+ # deviates from the actual FileDescriptorProto path. E.g.:
1035
+ # [ 4, 3, 7, 10101, 2 ]
1036
+ # refers to the option name `(my_opt)`, and:
1037
+ # [ 4, 3, 7, 10101, 7 ]
1038
+ # refers to the "foo" string value of the option.
1039
+ m.field :path, 1, :int32, label: :repeated, packed: true
1040
+ # Always has exactly three or four elements: start line, start column,
1041
+ # end line (optional, otherwise assumed same as start line), end column.
1042
+ # These are packed into a single field for efficiency. Note that line
1043
+ # and column numbers are zero-based -- typically you will want to add
1044
+ # 1 to each before displaying to a user.
1045
+ m.field :span, 2, :int32, label: :repeated, packed: true
1046
+ # If this SourceCodeInfo represents a complete declaration, these are any
1047
+ # comments appearing before and after the declaration which appear to be
1048
+ # attached to the declaration.
1049
+ #
1050
+ # A series of line comments appearing on consecutive lines, with no other
1051
+ # tokens appearing on those lines, will be treated as a single comment.
1052
+ #
1053
+ # leading_detached_comments will keep paragraphs of comments that appear
1054
+ # before (but not connected to) the current element. Each paragraph,
1055
+ # separated by empty lines, will be one comment element in the repeated
1056
+ # field.
1057
+ #
1058
+ # Only the comment content is provided; comment markers (e.g. //) are
1059
+ # stripped out. For block comments, leading whitespace and an asterisk
1060
+ # will be stripped from the beginning of each line other than the first.
1061
+ # Newlines are included in the output.
1062
+ #
1063
+ # Examples:
1064
+ #
1065
+ # optional int32 foo = 1; // Comment attached to foo.
1066
+ # // Comment attached to bar.
1067
+ # optional int32 bar = 2;
1068
+ #
1069
+ # optional string baz = 3;
1070
+ # // Comment attached to baz.
1071
+ # // Another line attached to baz.
1072
+ #
1073
+ # // Comment attached to moo.
1074
+ # //
1075
+ # // Another line attached to moo.
1076
+ # optional double moo = 4;
1077
+ #
1078
+ # // Detached comment for corge. This is not leading or trailing comments
1079
+ # // to moo or corge because there are blank lines separating it from
1080
+ # // both.
1081
+ #
1082
+ # // Detached comment for corge paragraph 2.
1083
+ #
1084
+ # optional string corge = 5;
1085
+ # /* Block comment attached
1086
+ # * to corge. Leading asterisks
1087
+ # * will be removed. */
1088
+ # /* Block comment attached to
1089
+ # * grault. */
1090
+ # optional int32 grault = 6;
1091
+ #
1092
+ # // ignored detached comments.
1093
+ m.field :leading_comments, 3, :string
1094
+ m.field :trailing_comments, 4, :string
1095
+ m.field :leading_detached_comments, 6, :string, label: :repeated
1096
+ end
1097
+ m.extensions 536000000
1098
+ end
1099
+ # Describes the relationship between generated code and its original source
1100
+ # file. A GeneratedCodeInfo message is associated with only one generated
1101
+ # source file, but may contain references to different source .proto files.
1102
+ f.message "GeneratedCodeInfo" do |m|
1103
+ # An Annotation connects some span of text in generated code to an element
1104
+ # of its generating .proto file.
1105
+ m.field :annotation, 1, :message, ".google.protobuf.GeneratedCodeInfo.Annotation",
1106
+ label: :repeated
1107
+ m.message "Annotation" do |m|
1108
+ # Identifies the element in the original source .proto file. This field
1109
+ # is formatted the same as SourceCodeInfo.Location.path.
1110
+ m.field :path, 1, :int32, label: :repeated, packed: true
1111
+ # Identifies the filesystem path to the original source .proto.
1112
+ m.field :source_file, 2, :string
1113
+ # Identifies the starting offset in bytes in the generated code
1114
+ # that relates to the identified object.
1115
+ m.field :begin, 3, :int32
1116
+ # Identifies the ending offset in bytes in the generated code that
1117
+ # relates to the identified object. The end offset should be one past
1118
+ # the last relevant byte (so the length of the text = end - begin).
1119
+ m.field :end, 4, :int32
1120
+ m.field :semantic, 5, :enum, ".google.protobuf.GeneratedCodeInfo.Annotation.Semantic"
1121
+ # Represents the identified object's effect on the element in the original
1122
+ # .proto file.
1123
+ m.enum "Semantic" do |e|
1124
+ # There is no effect or the effect is indescribable.
1125
+ e.value :NONE, 0
1126
+ # The element is set or otherwise mutated.
1127
+ e.value :SET, 1
1128
+ # An alias to the element is returned.
1129
+ e.value :ALIAS, 2
1130
+ end
1131
+ end
1132
+ end
1133
+ # The full set of known editions.
1134
+ f.enum "Edition" do |e|
1135
+ # A placeholder for an unknown edition value.
1136
+ e.value :EDITION_UNKNOWN, 0
1137
+ # A placeholder edition for specifying default behaviors *before* a feature
1138
+ # was first introduced. This is effectively an "infinite past".
1139
+ e.value :EDITION_LEGACY, 900
1140
+ # Legacy syntax "editions". These pre-date editions, but behave much like
1141
+ # distinct editions. These can't be used to specify the edition of proto
1142
+ # files, but feature definitions must supply proto2/proto3 defaults for
1143
+ # backwards compatibility.
1144
+ e.value :EDITION_PROTO2, 998
1145
+ e.value :EDITION_PROTO3, 999
1146
+ # Editions that have been released. The specific values are arbitrary and
1147
+ # should not be depended on, but they will always be time-ordered for easy
1148
+ # comparison.
1149
+ e.value :EDITION_2023, 1000
1150
+ e.value :EDITION_2024, 1001
1151
+ e.value :EDITION_2026, 1002
1152
+ # A placeholder edition for developing and testing unscheduled features.
1153
+ e.value :EDITION_UNSTABLE, 9999
1154
+ # Placeholder editions for testing feature resolution. These should not be
1155
+ # used or relied on outside of tests.
1156
+ e.value :EDITION_1_TEST_ONLY, 1
1157
+ e.value :EDITION_2_TEST_ONLY, 2
1158
+ e.value :EDITION_99997_TEST_ONLY, 99997
1159
+ e.value :EDITION_99998_TEST_ONLY, 99998
1160
+ e.value :EDITION_99999_TEST_ONLY, 99999
1161
+ # Placeholder for specifying unbounded edition support. This should only
1162
+ # ever be used by plugins that can expect to never require any changes to
1163
+ # support a new edition.
1164
+ e.value :EDITION_MAX, 2147483647
1165
+ end
1166
+ # Describes the 'visibility' of a symbol with respect to the proto import
1167
+ # system. Symbols can only be imported when the visibility rules do not prevent
1168
+ # it (ex: local symbols cannot be imported). Visibility modifiers can only set
1169
+ # on `message` and `enum` as they are the only types available to be referenced
1170
+ # from other files.
1171
+ f.enum "SymbolVisibility" do |e|
1172
+ e.value :VISIBILITY_UNSET, 0
1173
+ e.value :VISIBILITY_LOCAL, 1
1174
+ e.value :VISIBILITY_EXPORT, 2
1175
+ end
1176
+ end
1177
+
1178
+ module Protostar
1179
+ module Google
1180
+ module Protobuf
1181
+ FileDescriptorSet = Protostar::DSL.message("google.protobuf.FileDescriptorSet")
1182
+ FileDescriptorProto = Protostar::DSL.message("google.protobuf.FileDescriptorProto")
1183
+ DescriptorProto = Protostar::DSL.message("google.protobuf.DescriptorProto")
1184
+ DescriptorProto::ExtensionRange = Protostar::DSL.message("google.protobuf.DescriptorProto.ExtensionRange")
1185
+ DescriptorProto::ReservedRange = Protostar::DSL.message("google.protobuf.DescriptorProto.ReservedRange")
1186
+ ExtensionRangeOptions = Protostar::DSL.message("google.protobuf.ExtensionRangeOptions")
1187
+ ExtensionRangeOptions::Declaration = Protostar::DSL.message("google.protobuf.ExtensionRangeOptions.Declaration")
1188
+ ExtensionRangeOptions::VerificationState = Protostar::DSL.enum("google.protobuf.ExtensionRangeOptions.VerificationState")
1189
+ FieldDescriptorProto = Protostar::DSL.message("google.protobuf.FieldDescriptorProto")
1190
+ FieldDescriptorProto::Type = Protostar::DSL.enum("google.protobuf.FieldDescriptorProto.Type")
1191
+ FieldDescriptorProto::Label = Protostar::DSL.enum("google.protobuf.FieldDescriptorProto.Label")
1192
+ OneofDescriptorProto = Protostar::DSL.message("google.protobuf.OneofDescriptorProto")
1193
+ EnumDescriptorProto = Protostar::DSL.message("google.protobuf.EnumDescriptorProto")
1194
+ EnumDescriptorProto::EnumReservedRange = Protostar::DSL.message("google.protobuf.EnumDescriptorProto.EnumReservedRange")
1195
+ EnumValueDescriptorProto = Protostar::DSL.message("google.protobuf.EnumValueDescriptorProto")
1196
+ ServiceDescriptorProto = Protostar::DSL.message("google.protobuf.ServiceDescriptorProto")
1197
+ MethodDescriptorProto = Protostar::DSL.message("google.protobuf.MethodDescriptorProto")
1198
+ FileOptions = Protostar::DSL.message("google.protobuf.FileOptions")
1199
+ FileOptions::OptimizeMode = Protostar::DSL.enum("google.protobuf.FileOptions.OptimizeMode")
1200
+ MessageOptions = Protostar::DSL.message("google.protobuf.MessageOptions")
1201
+ FieldOptions = Protostar::DSL.message("google.protobuf.FieldOptions")
1202
+ FieldOptions::EditionDefault = Protostar::DSL.message("google.protobuf.FieldOptions.EditionDefault")
1203
+ FieldOptions::FeatureSupport = Protostar::DSL.message("google.protobuf.FieldOptions.FeatureSupport")
1204
+ FieldOptions::CType = Protostar::DSL.enum("google.protobuf.FieldOptions.CType")
1205
+ FieldOptions::JSType = Protostar::DSL.enum("google.protobuf.FieldOptions.JSType")
1206
+ FieldOptions::OptionRetention = Protostar::DSL.enum("google.protobuf.FieldOptions.OptionRetention")
1207
+ FieldOptions::OptionTargetType = Protostar::DSL.enum("google.protobuf.FieldOptions.OptionTargetType")
1208
+ OneofOptions = Protostar::DSL.message("google.protobuf.OneofOptions")
1209
+ EnumOptions = Protostar::DSL.message("google.protobuf.EnumOptions")
1210
+ EnumValueOptions = Protostar::DSL.message("google.protobuf.EnumValueOptions")
1211
+ ServiceOptions = Protostar::DSL.message("google.protobuf.ServiceOptions")
1212
+ MethodOptions = Protostar::DSL.message("google.protobuf.MethodOptions")
1213
+ MethodOptions::IdempotencyLevel = Protostar::DSL.enum("google.protobuf.MethodOptions.IdempotencyLevel")
1214
+ UninterpretedOption = Protostar::DSL.message("google.protobuf.UninterpretedOption")
1215
+ UninterpretedOption::NamePart = Protostar::DSL.message("google.protobuf.UninterpretedOption.NamePart")
1216
+ FeatureSet = Protostar::DSL.message("google.protobuf.FeatureSet")
1217
+ FeatureSet::VisibilityFeature = Protostar::DSL.message("google.protobuf.FeatureSet.VisibilityFeature")
1218
+ FeatureSet::VisibilityFeature::DefaultSymbolVisibility = Protostar::DSL.enum("google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility")
1219
+ FeatureSet::ProtoLimitsFeature = Protostar::DSL.message("google.protobuf.FeatureSet.ProtoLimitsFeature")
1220
+ FeatureSet::ProtoLimitsFeature::EnforceProtoLimits = Protostar::DSL.enum("google.protobuf.FeatureSet.ProtoLimitsFeature.EnforceProtoLimits")
1221
+ FeatureSet::FieldPresence = Protostar::DSL.enum("google.protobuf.FeatureSet.FieldPresence")
1222
+ FeatureSet::EnumType = Protostar::DSL.enum("google.protobuf.FeatureSet.EnumType")
1223
+ FeatureSet::RepeatedFieldEncoding = Protostar::DSL.enum("google.protobuf.FeatureSet.RepeatedFieldEncoding")
1224
+ FeatureSet::Utf8Validation = Protostar::DSL.enum("google.protobuf.FeatureSet.Utf8Validation")
1225
+ FeatureSet::MessageEncoding = Protostar::DSL.enum("google.protobuf.FeatureSet.MessageEncoding")
1226
+ FeatureSet::JsonFormat = Protostar::DSL.enum("google.protobuf.FeatureSet.JsonFormat")
1227
+ FeatureSet::EnforceNamingStyle = Protostar::DSL.enum("google.protobuf.FeatureSet.EnforceNamingStyle")
1228
+ FeatureSetDefaults = Protostar::DSL.message("google.protobuf.FeatureSetDefaults")
1229
+ FeatureSetDefaults::FeatureSetEditionDefault = Protostar::DSL.message("google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault")
1230
+ SourceCodeInfo = Protostar::DSL.message("google.protobuf.SourceCodeInfo")
1231
+ SourceCodeInfo::Location = Protostar::DSL.message("google.protobuf.SourceCodeInfo.Location")
1232
+ GeneratedCodeInfo = Protostar::DSL.message("google.protobuf.GeneratedCodeInfo")
1233
+ GeneratedCodeInfo::Annotation = Protostar::DSL.message("google.protobuf.GeneratedCodeInfo.Annotation")
1234
+ GeneratedCodeInfo::Annotation::Semantic = Protostar::DSL.enum("google.protobuf.GeneratedCodeInfo.Annotation.Semantic")
1235
+ Edition = Protostar::DSL.enum("google.protobuf.Edition")
1236
+ SymbolVisibility = Protostar::DSL.enum("google.protobuf.SymbolVisibility")
1237
+ end
1238
+ end
1239
+ end