protobuf-cucumber 3.10.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/.rubocop.yml +70 -0
  4. data/.rubocop_todo.yml +145 -0
  5. data/.travis.yml +40 -0
  6. data/.yardopts +5 -0
  7. data/CHANGES.md +344 -0
  8. data/CONTRIBUTING.md +16 -0
  9. data/Gemfile +3 -0
  10. data/LICENSE.txt +22 -0
  11. data/README.md +33 -0
  12. data/Rakefile +64 -0
  13. data/bin/protoc-gen-ruby +22 -0
  14. data/bin/rpc_server +5 -0
  15. data/install-protobuf.sh +28 -0
  16. data/lib/protobuf.rb +129 -0
  17. data/lib/protobuf/cli.rb +257 -0
  18. data/lib/protobuf/code_generator.rb +120 -0
  19. data/lib/protobuf/decoder.rb +28 -0
  20. data/lib/protobuf/deprecation.rb +117 -0
  21. data/lib/protobuf/descriptors.rb +3 -0
  22. data/lib/protobuf/descriptors/google/protobuf/compiler/plugin.pb.rb +62 -0
  23. data/lib/protobuf/descriptors/google/protobuf/descriptor.pb.rb +301 -0
  24. data/lib/protobuf/encoder.rb +11 -0
  25. data/lib/protobuf/enum.rb +365 -0
  26. data/lib/protobuf/exceptions.rb +9 -0
  27. data/lib/protobuf/field.rb +74 -0
  28. data/lib/protobuf/field/base_field.rb +380 -0
  29. data/lib/protobuf/field/base_field_object_definitions.rb +504 -0
  30. data/lib/protobuf/field/bool_field.rb +64 -0
  31. data/lib/protobuf/field/bytes_field.rb +78 -0
  32. data/lib/protobuf/field/double_field.rb +25 -0
  33. data/lib/protobuf/field/enum_field.rb +61 -0
  34. data/lib/protobuf/field/field_array.rb +104 -0
  35. data/lib/protobuf/field/field_hash.rb +122 -0
  36. data/lib/protobuf/field/fixed32_field.rb +25 -0
  37. data/lib/protobuf/field/fixed64_field.rb +28 -0
  38. data/lib/protobuf/field/float_field.rb +43 -0
  39. data/lib/protobuf/field/int32_field.rb +21 -0
  40. data/lib/protobuf/field/int64_field.rb +34 -0
  41. data/lib/protobuf/field/integer_field.rb +23 -0
  42. data/lib/protobuf/field/message_field.rb +51 -0
  43. data/lib/protobuf/field/sfixed32_field.rb +27 -0
  44. data/lib/protobuf/field/sfixed64_field.rb +28 -0
  45. data/lib/protobuf/field/signed_integer_field.rb +29 -0
  46. data/lib/protobuf/field/sint32_field.rb +21 -0
  47. data/lib/protobuf/field/sint64_field.rb +21 -0
  48. data/lib/protobuf/field/string_field.rb +51 -0
  49. data/lib/protobuf/field/uint32_field.rb +21 -0
  50. data/lib/protobuf/field/uint64_field.rb +21 -0
  51. data/lib/protobuf/field/varint_field.rb +77 -0
  52. data/lib/protobuf/generators/base.rb +85 -0
  53. data/lib/protobuf/generators/enum_generator.rb +39 -0
  54. data/lib/protobuf/generators/extension_generator.rb +27 -0
  55. data/lib/protobuf/generators/field_generator.rb +193 -0
  56. data/lib/protobuf/generators/file_generator.rb +262 -0
  57. data/lib/protobuf/generators/group_generator.rb +122 -0
  58. data/lib/protobuf/generators/message_generator.rb +104 -0
  59. data/lib/protobuf/generators/option_generator.rb +17 -0
  60. data/lib/protobuf/generators/printable.rb +160 -0
  61. data/lib/protobuf/generators/service_generator.rb +50 -0
  62. data/lib/protobuf/lifecycle.rb +33 -0
  63. data/lib/protobuf/logging.rb +39 -0
  64. data/lib/protobuf/message.rb +260 -0
  65. data/lib/protobuf/message/fields.rb +233 -0
  66. data/lib/protobuf/message/serialization.rb +85 -0
  67. data/lib/protobuf/optionable.rb +70 -0
  68. data/lib/protobuf/rpc/buffer.rb +78 -0
  69. data/lib/protobuf/rpc/client.rb +140 -0
  70. data/lib/protobuf/rpc/connectors/base.rb +221 -0
  71. data/lib/protobuf/rpc/connectors/ping.rb +89 -0
  72. data/lib/protobuf/rpc/connectors/socket.rb +78 -0
  73. data/lib/protobuf/rpc/connectors/zmq.rb +319 -0
  74. data/lib/protobuf/rpc/dynamic_discovery.pb.rb +50 -0
  75. data/lib/protobuf/rpc/env.rb +60 -0
  76. data/lib/protobuf/rpc/error.rb +28 -0
  77. data/lib/protobuf/rpc/error/client_error.rb +31 -0
  78. data/lib/protobuf/rpc/error/server_error.rb +43 -0
  79. data/lib/protobuf/rpc/middleware.rb +25 -0
  80. data/lib/protobuf/rpc/middleware/exception_handler.rb +40 -0
  81. data/lib/protobuf/rpc/middleware/logger.rb +95 -0
  82. data/lib/protobuf/rpc/middleware/request_decoder.rb +79 -0
  83. data/lib/protobuf/rpc/middleware/response_encoder.rb +83 -0
  84. data/lib/protobuf/rpc/middleware/runner.rb +18 -0
  85. data/lib/protobuf/rpc/rpc.pb.rb +64 -0
  86. data/lib/protobuf/rpc/rpc_method.rb +16 -0
  87. data/lib/protobuf/rpc/server.rb +39 -0
  88. data/lib/protobuf/rpc/servers/socket/server.rb +121 -0
  89. data/lib/protobuf/rpc/servers/socket/worker.rb +56 -0
  90. data/lib/protobuf/rpc/servers/socket_runner.rb +46 -0
  91. data/lib/protobuf/rpc/servers/zmq/broker.rb +194 -0
  92. data/lib/protobuf/rpc/servers/zmq/server.rb +321 -0
  93. data/lib/protobuf/rpc/servers/zmq/util.rb +48 -0
  94. data/lib/protobuf/rpc/servers/zmq/worker.rb +105 -0
  95. data/lib/protobuf/rpc/servers/zmq_runner.rb +70 -0
  96. data/lib/protobuf/rpc/service.rb +172 -0
  97. data/lib/protobuf/rpc/service_directory.rb +261 -0
  98. data/lib/protobuf/rpc/service_dispatcher.rb +45 -0
  99. data/lib/protobuf/rpc/service_filters.rb +250 -0
  100. data/lib/protobuf/rpc/stat.rb +119 -0
  101. data/lib/protobuf/socket.rb +21 -0
  102. data/lib/protobuf/tasks.rb +1 -0
  103. data/lib/protobuf/tasks/compile.rake +80 -0
  104. data/lib/protobuf/varint.rb +20 -0
  105. data/lib/protobuf/varint_pure.rb +31 -0
  106. data/lib/protobuf/version.rb +3 -0
  107. data/lib/protobuf/wire_type.rb +10 -0
  108. data/lib/protobuf/zmq.rb +21 -0
  109. data/profile.html +5103 -0
  110. data/proto/dynamic_discovery.proto +44 -0
  111. data/proto/google/protobuf/compiler/plugin.proto +147 -0
  112. data/proto/google/protobuf/descriptor.proto +779 -0
  113. data/proto/rpc.proto +69 -0
  114. data/protobuf-cucumber.gemspec +57 -0
  115. data/spec/benchmark/tasks.rb +143 -0
  116. data/spec/bin/protoc-gen-ruby_spec.rb +23 -0
  117. data/spec/encoding/all_types_spec.rb +103 -0
  118. data/spec/encoding/extreme_values_spec.rb +0 -0
  119. data/spec/functional/class_inheritance_spec.rb +52 -0
  120. data/spec/functional/code_generator_spec.rb +58 -0
  121. data/spec/functional/socket_server_spec.rb +59 -0
  122. data/spec/functional/zmq_server_spec.rb +105 -0
  123. data/spec/lib/protobuf/cli_spec.rb +317 -0
  124. data/spec/lib/protobuf/code_generator_spec.rb +87 -0
  125. data/spec/lib/protobuf/enum_spec.rb +307 -0
  126. data/spec/lib/protobuf/field/bool_field_spec.rb +91 -0
  127. data/spec/lib/protobuf/field/double_field_spec.rb +9 -0
  128. data/spec/lib/protobuf/field/enum_field_spec.rb +44 -0
  129. data/spec/lib/protobuf/field/field_array_spec.rb +105 -0
  130. data/spec/lib/protobuf/field/field_hash_spec.rb +168 -0
  131. data/spec/lib/protobuf/field/fixed32_field_spec.rb +7 -0
  132. data/spec/lib/protobuf/field/fixed64_field_spec.rb +7 -0
  133. data/spec/lib/protobuf/field/float_field_spec.rb +90 -0
  134. data/spec/lib/protobuf/field/int32_field_spec.rb +120 -0
  135. data/spec/lib/protobuf/field/int64_field_spec.rb +7 -0
  136. data/spec/lib/protobuf/field/message_field_spec.rb +132 -0
  137. data/spec/lib/protobuf/field/sfixed32_field_spec.rb +9 -0
  138. data/spec/lib/protobuf/field/sfixed64_field_spec.rb +9 -0
  139. data/spec/lib/protobuf/field/sint32_field_spec.rb +9 -0
  140. data/spec/lib/protobuf/field/sint64_field_spec.rb +9 -0
  141. data/spec/lib/protobuf/field/string_field_spec.rb +79 -0
  142. data/spec/lib/protobuf/field/uint32_field_spec.rb +7 -0
  143. data/spec/lib/protobuf/field/uint64_field_spec.rb +7 -0
  144. data/spec/lib/protobuf/field_spec.rb +192 -0
  145. data/spec/lib/protobuf/generators/base_spec.rb +154 -0
  146. data/spec/lib/protobuf/generators/enum_generator_spec.rb +82 -0
  147. data/spec/lib/protobuf/generators/extension_generator_spec.rb +42 -0
  148. data/spec/lib/protobuf/generators/field_generator_spec.rb +197 -0
  149. data/spec/lib/protobuf/generators/file_generator_spec.rb +119 -0
  150. data/spec/lib/protobuf/generators/message_generator_spec.rb +0 -0
  151. data/spec/lib/protobuf/generators/service_generator_spec.rb +99 -0
  152. data/spec/lib/protobuf/lifecycle_spec.rb +94 -0
  153. data/spec/lib/protobuf/message_spec.rb +944 -0
  154. data/spec/lib/protobuf/optionable_spec.rb +265 -0
  155. data/spec/lib/protobuf/rpc/client_spec.rb +66 -0
  156. data/spec/lib/protobuf/rpc/connectors/base_spec.rb +226 -0
  157. data/spec/lib/protobuf/rpc/connectors/ping_spec.rb +69 -0
  158. data/spec/lib/protobuf/rpc/connectors/socket_spec.rb +34 -0
  159. data/spec/lib/protobuf/rpc/connectors/zmq_spec.rb +110 -0
  160. data/spec/lib/protobuf/rpc/middleware/exception_handler_spec.rb +62 -0
  161. data/spec/lib/protobuf/rpc/middleware/logger_spec.rb +49 -0
  162. data/spec/lib/protobuf/rpc/middleware/request_decoder_spec.rb +115 -0
  163. data/spec/lib/protobuf/rpc/middleware/response_encoder_spec.rb +91 -0
  164. data/spec/lib/protobuf/rpc/servers/socket_server_spec.rb +38 -0
  165. data/spec/lib/protobuf/rpc/servers/zmq/server_spec.rb +43 -0
  166. data/spec/lib/protobuf/rpc/servers/zmq/util_spec.rb +55 -0
  167. data/spec/lib/protobuf/rpc/servers/zmq/worker_spec.rb +35 -0
  168. data/spec/lib/protobuf/rpc/service_directory_spec.rb +293 -0
  169. data/spec/lib/protobuf/rpc/service_dispatcher_spec.rb +35 -0
  170. data/spec/lib/protobuf/rpc/service_filters_spec.rb +517 -0
  171. data/spec/lib/protobuf/rpc/service_spec.rb +162 -0
  172. data/spec/lib/protobuf/rpc/stat_spec.rb +101 -0
  173. data/spec/lib/protobuf/varint_spec.rb +29 -0
  174. data/spec/lib/protobuf_spec.rb +105 -0
  175. data/spec/spec_helper.rb +42 -0
  176. data/spec/support/all.rb +6 -0
  177. data/spec/support/packed_field.rb +23 -0
  178. data/spec/support/protos/all_types.data.bin +0 -0
  179. data/spec/support/protos/all_types.data.txt +119 -0
  180. data/spec/support/protos/enum.pb.rb +63 -0
  181. data/spec/support/protos/enum.proto +37 -0
  182. data/spec/support/protos/extreme_values.data.bin +0 -0
  183. data/spec/support/protos/google_unittest.bin +0 -0
  184. data/spec/support/protos/google_unittest.pb.rb +798 -0
  185. data/spec/support/protos/google_unittest.proto +884 -0
  186. data/spec/support/protos/google_unittest_custom_options.bin +0 -0
  187. data/spec/support/protos/google_unittest_custom_options.pb.rb +361 -0
  188. data/spec/support/protos/google_unittest_custom_options.proto +424 -0
  189. data/spec/support/protos/google_unittest_import.pb.rb +55 -0
  190. data/spec/support/protos/google_unittest_import.proto +73 -0
  191. data/spec/support/protos/google_unittest_import_public.pb.rb +31 -0
  192. data/spec/support/protos/google_unittest_import_public.proto +41 -0
  193. data/spec/support/protos/map-test.bin +157 -0
  194. data/spec/support/protos/map-test.pb.rb +85 -0
  195. data/spec/support/protos/map-test.proto +68 -0
  196. data/spec/support/protos/multi_field_extensions.pb.rb +59 -0
  197. data/spec/support/protos/multi_field_extensions.proto +35 -0
  198. data/spec/support/protos/resource.pb.rb +172 -0
  199. data/spec/support/protos/resource.proto +137 -0
  200. data/spec/support/resource_service.rb +23 -0
  201. data/spec/support/server.rb +65 -0
  202. data/spec/support/test_app_file.rb +2 -0
  203. data/varint_prof.rb +82 -0
  204. metadata +579 -0
@@ -0,0 +1,68 @@
1
+ // Use protoc v3.0.0 to compile this file into map-test.bin:
2
+ // protoc --descriptor_set_out=map-test.bin map-test.proto
3
+
4
+ syntax = "proto2";
5
+
6
+ package foo;
7
+
8
+ enum Frobnitz {
9
+ FROB = 1;
10
+ NITZ = 2;
11
+ }
12
+
13
+ message Baz {
14
+ message LooksLikeMapEntry {
15
+ option map_entry = true;
16
+ optional string key = 1;
17
+ optional string value = 2;
18
+ }
19
+ repeated LooksLikeMapEntry looks_like_map = 1;
20
+
21
+ message DoesNotLookLikeMapEntry {
22
+ optional string key = 1;
23
+ optional string value = 2;
24
+ }
25
+ repeated DoesNotLookLikeMapEntry does_not_look_like_map = 2;
26
+ }
27
+
28
+ message Bar {
29
+ map<sint32, Baz> sint32_to_baz = 1;
30
+ map<sint64, Baz> sint64_to_baz = 2;
31
+ map<int32, Baz> int32_to_baz = 3;
32
+ map<int64, Baz> int64_to_baz = 4;
33
+ map<uint32, Baz> uint32_to_baz = 5;
34
+ map<uint64, Baz> uint64_to_baz = 6;
35
+ map<string, Baz> string_to_baz = 7;
36
+
37
+ map<sint32, Frobnitz> sint32_to_frobnitz = 8;
38
+ map<sint64, Frobnitz> sint64_to_frobnitz = 9;
39
+ map<int32, Frobnitz> int32_to_frobnitz = 10;
40
+ map<int64, Frobnitz> int64_to_frobnitz = 11;
41
+ map<uint32, Frobnitz> uint32_to_frobnitz = 12;
42
+ map<uint64, Frobnitz> uint64_to_frobnitz = 13;
43
+ map<string, Frobnitz> string_to_frobnitz = 14;
44
+
45
+ map<sint32, string> sint32_to_string = 15;
46
+ map<sint64, string> sint64_to_string = 16;
47
+ map<int32, string> int32_to_string = 17;
48
+ map<int64, string> int64_to_string = 18;
49
+ map<uint32, string> uint32_to_string = 19;
50
+ map<uint64, string> uint64_to_string = 20;
51
+ map<string, string> string_to_string = 21;
52
+
53
+ map<sint32, float> sint32_to_float = 22;
54
+ map<sint64, float> sint64_to_float = 23;
55
+ map<int32, float> int32_to_float = 24;
56
+ map<int64, float> int64_to_float = 25;
57
+ map<uint32, float> uint32_to_float = 26;
58
+ map<uint64, float> uint64_to_float = 27;
59
+ map<string, float> string_to_float = 28;
60
+
61
+ map<sint32, double> sint32_to_double = 29;
62
+ map<sint64, double> sint64_to_double = 30;
63
+ map<int32, double> int32_to_double = 31;
64
+ map<int64, double> int64_to_double = 32;
65
+ map<uint32, double> uint32_to_double = 33;
66
+ map<uint64, double> uint64_to_double = 34;
67
+ map<string, double> string_to_double = 35;
68
+ }
@@ -0,0 +1,59 @@
1
+ # encoding: utf-8
2
+
3
+ ##
4
+ # This file is auto-generated. DO NOT EDIT!
5
+ #
6
+ require 'protobuf'
7
+
8
+ module Test
9
+ ::Protobuf::Optionable.inject(self) { ::Google::Protobuf::FileOptions }
10
+
11
+ ##
12
+ # Message Classes
13
+ #
14
+ class Header < ::Protobuf::Message
15
+ class Type < ::Protobuf::Enum
16
+ define :PayloadTypeA, 1
17
+ define :PayloadTypeB, 2
18
+ end
19
+
20
+ end
21
+
22
+ class PayloadA < ::Protobuf::Message
23
+ class Foo < ::Protobuf::Message; end
24
+
25
+ end
26
+
27
+ class PayloadB < ::Protobuf::Message
28
+ class Foo < ::Protobuf::Message; end
29
+
30
+ end
31
+
32
+
33
+
34
+ ##
35
+ # Message Fields
36
+ #
37
+ class Header
38
+ required ::Test::Header::Type, :type, 1
39
+ # Extension Fields
40
+ extensions 100...536870912
41
+ optional ::Test::PayloadA, :".test.PayloadA.payload", 100, :extension => true
42
+ end
43
+
44
+ class PayloadA
45
+ class Foo
46
+ optional :string, :foo_a, 1
47
+ end
48
+
49
+ end
50
+
51
+ class PayloadB
52
+ class Foo
53
+ optional :string, :foo_b, 1
54
+ end
55
+
56
+ end
57
+
58
+ end
59
+
@@ -0,0 +1,35 @@
1
+ syntax = "proto2";
2
+
3
+ package test;
4
+
5
+ message Header {
6
+ extensions 100 to max;
7
+
8
+ enum Type {
9
+ PayloadTypeA = 1;
10
+ PayloadTypeB = 2;
11
+ }
12
+
13
+ required Type type = 1;
14
+ }
15
+
16
+ message PayloadA {
17
+ message Foo {
18
+ optional string foo_a = 1;
19
+ }
20
+
21
+ extend Header {
22
+ optional PayloadA payload = 100;
23
+ }
24
+ }
25
+
26
+ message PayloadB {
27
+ message Foo {
28
+ optional string foo_b = 1;
29
+ }
30
+
31
+ // UNCOMMENT TO TEST RUNTIME FAILING WITH MULTIPLE FIELDS
32
+ // extend Header {
33
+ // optional PayloadB payload = 101;
34
+ //}
35
+ }
@@ -0,0 +1,172 @@
1
+ # encoding: utf-8
2
+
3
+ ##
4
+ # This file is auto-generated. DO NOT EDIT!
5
+ #
6
+ require 'protobuf'
7
+ require 'protobuf/rpc/service'
8
+
9
+
10
+ ##
11
+ # Imports
12
+ #
13
+ require 'google/protobuf/descriptor.pb'
14
+
15
+ module Test
16
+ ::Protobuf::Optionable.inject(self) { ::Google::Protobuf::FileOptions }
17
+
18
+ ##
19
+ # Enum Classes
20
+ #
21
+ class StatusType < ::Protobuf::Enum
22
+ set_option :allow_alias, true
23
+ set_option :".test.enum_option", -789
24
+
25
+ define :PENDING, 0
26
+ define :ENABLED, 1
27
+ define :DISABLED, 2
28
+ define :DELETED, 3
29
+ define :ALIASED, 3
30
+ end
31
+
32
+
33
+ ##
34
+ # Message Classes
35
+ #
36
+ class ResourceFindRequest < ::Protobuf::Message; end
37
+ class ResourceSleepRequest < ::Protobuf::Message; end
38
+ class Resource < ::Protobuf::Message; end
39
+ class ResourceWithRequiredField < ::Protobuf::Message; end
40
+ class Searchable < ::Protobuf::Message
41
+ class SearchType < ::Protobuf::Enum
42
+ define :FLAT, 1
43
+ define :NESTED, 2
44
+ end
45
+
46
+ end
47
+
48
+ class MessageParent < ::Protobuf::Message
49
+ class MessageChild < ::Protobuf::Message; end
50
+
51
+ end
52
+
53
+ class Nested < ::Protobuf::Message
54
+ class NestedLevelOne < ::Protobuf::Message; end
55
+
56
+ end
57
+
58
+
59
+
60
+ ##
61
+ # File Options
62
+ #
63
+ set_option :cc_generic_services, true
64
+ set_option :".test.file_option", 9876543210
65
+
66
+
67
+ ##
68
+ # Message Fields
69
+ #
70
+ class ResourceFindRequest
71
+ required :string, :name, 1
72
+ optional :bool, :active, 2
73
+ repeated :string, :widgets, 3
74
+ repeated :bytes, :widget_bytes, 4
75
+ optional :bytes, :single_bytes, 5
76
+ end
77
+
78
+ class ResourceSleepRequest
79
+ optional :int32, :sleep, 1
80
+ end
81
+
82
+ class Resource
83
+ # Message Options
84
+ set_option :map_entry, false
85
+ set_option :".test.message_option", -56
86
+
87
+ required :string, :name, 1, :ctype => ::Google::Protobuf::FieldOptions::CType::CORD, :".test.field_option" => 8765432109
88
+ optional :int64, :date_created, 2
89
+ optional ::Test::StatusType, :status, 3
90
+ repeated ::Test::StatusType, :repeated_enum, 4
91
+ # Extension Fields
92
+ extensions 100...536870912
93
+ optional :bool, :".test.Searchable.ext_is_searchable", 100, :extension => true
94
+ optional :bool, :".test.Searchable.ext_is_hidden", 101, :extension => true
95
+ optional ::Test::Searchable::SearchType, :".test.Searchable.ext_search_type", 102, :default => ::Test::Searchable::SearchType::FLAT, :extension => true
96
+ optional :bool, :".test.Nested.NestedLevelOne.ext_nested_in_level_one", 105, :extension => true
97
+ optional :bool, :".test.Nested.NestedLevelOne.ext_dup_field", 106, :extension => true
98
+ end
99
+
100
+ class ResourceWithRequiredField
101
+ required :string, :foo_is_required, 1
102
+ end
103
+
104
+ class MessageParent
105
+ class MessageChild
106
+ optional :string, :child1, 1
107
+ end
108
+
109
+ end
110
+
111
+ class Nested
112
+ class NestedLevelOne
113
+ optional :bool, :level_one, 1, :default => true
114
+ # Extension Fields
115
+ extensions 100...102
116
+ optional :bool, :".test.ext_nested_level_one_outer", 101, :extension => true
117
+ optional :bool, :".test.Nested.ext_nested_level_one", 100, :extension => true
118
+ end
119
+
120
+ optional :string, :name, 1
121
+ optional ::Test::Resource, :resource, 2
122
+ repeated ::Test::Resource, :multiple_resources, 3
123
+ optional ::Test::StatusType, :status, 4
124
+ # Extension Fields
125
+ extensions 100...111
126
+ optional :string, :".test.foo", 100, :extension => true
127
+ optional :int64, :".test.bar", 101, :extension => true
128
+ end
129
+
130
+
131
+ ##
132
+ # Extended Message Fields
133
+ #
134
+ class ::Google::Protobuf::FileOptions < ::Protobuf::Message
135
+ optional :uint64, :".test.file_option", 9585869, :extension => true
136
+ end
137
+
138
+ class ::Google::Protobuf::FieldOptions < ::Protobuf::Message
139
+ optional :uint64, :".test.field_option", 858769, :extension => true
140
+ end
141
+
142
+ class ::Google::Protobuf::EnumOptions < ::Protobuf::Message
143
+ optional :int64, :".test.enum_option", 590284, :extension => true
144
+ end
145
+
146
+ class ::Google::Protobuf::MessageOptions < ::Protobuf::Message
147
+ optional :int64, :".test.message_option", 485969, :extension => true
148
+ end
149
+
150
+ class ::Google::Protobuf::ServiceOptions < ::Protobuf::Message
151
+ optional :int64, :".test.service_option", 5869607, :extension => true
152
+ end
153
+
154
+ class ::Google::Protobuf::MethodOptions < ::Protobuf::Message
155
+ optional :int64, :".test.method_option", 7893233, :extension => true
156
+ end
157
+
158
+
159
+ ##
160
+ # Service Classes
161
+ #
162
+ class ResourceService < ::Protobuf::Rpc::Service
163
+ set_option :".test.service_option", -9876543210
164
+ rpc :find, ::Test::ResourceFindRequest, ::Test::Resource do
165
+ set_option :".test.method_option", 2
166
+ end
167
+ rpc :find_with_rpc_failed, ::Test::ResourceFindRequest, ::Test::Resource
168
+ rpc :find_with_sleep, ::Test::ResourceSleepRequest, ::Test::Resource
169
+ rpc :find_not_implemented, ::Test::ResourceFindRequest, ::Test::Resource
170
+ end
171
+
172
+ end
@@ -0,0 +1,137 @@
1
+ syntax = "proto2";
2
+
3
+ import "google/protobuf/descriptor.proto";
4
+
5
+ package test;
6
+
7
+ option cc_generic_services = true;
8
+ option (file_option) = 9876543210;
9
+
10
+ extend google.protobuf.FileOptions {
11
+ optional uint64 file_option = 9585869;
12
+ }
13
+
14
+ extend google.protobuf.FieldOptions {
15
+ optional uint64 field_option = 858769;
16
+ }
17
+
18
+ extend google.protobuf.EnumOptions {
19
+ optional int64 enum_option = 590284;
20
+ }
21
+
22
+ extend google.protobuf.MessageOptions {
23
+ optional int64 message_option = 485969;
24
+ }
25
+
26
+ extend google.protobuf.ServiceOptions {
27
+ optional int64 service_option = 5869607;
28
+ }
29
+
30
+ extend google.protobuf.MethodOptions {
31
+ optional int64 method_option = 7893233;
32
+ }
33
+
34
+ enum StatusType {
35
+ option allow_alias = true;
36
+ option (enum_option) = -789;
37
+
38
+ PENDING = 0;
39
+ ENABLED = 1;
40
+ DISABLED = 2;
41
+ DELETED = 3;
42
+ ALIASED = 3;
43
+ }
44
+
45
+ message ResourceFindRequest {
46
+ required string name = 1;
47
+ optional bool active = 2;
48
+ repeated string widgets = 3;
49
+ repeated bytes widget_bytes = 4;
50
+ optional bytes single_bytes = 5;
51
+ }
52
+
53
+ message ResourceSleepRequest {
54
+ optional int32 sleep = 1;
55
+ }
56
+
57
+ message Resource {
58
+ option map_entry = false;
59
+ option (message_option) = -56;
60
+
61
+ extensions 100 to max;
62
+
63
+ required string name = 1 [(field_option) = 8765432109, ctype = CORD];
64
+ optional int64 date_created = 2;
65
+ optional StatusType status = 3;
66
+ repeated StatusType repeated_enum = 4;
67
+ }
68
+
69
+ message ResourceWithRequiredField {
70
+ required string foo_is_required = 1;
71
+ }
72
+
73
+ message Searchable {
74
+ enum SearchType {
75
+ FLAT = 1;
76
+ NESTED = 2;
77
+ }
78
+
79
+ extend test.Resource {
80
+ optional bool ext_is_searchable = 100;
81
+ optional bool ext_is_hidden = 101;
82
+ optional Searchable.SearchType ext_search_type = 102 [default=FLAT];
83
+ }
84
+ }
85
+
86
+ message MessageParent {
87
+ message MessageChild {
88
+ optional string child1 = 1;
89
+ }
90
+ }
91
+
92
+ message Nested {
93
+ extensions 100 to 110;
94
+
95
+ optional string name = 1;
96
+ optional Resource resource = 2;
97
+ repeated Resource multiple_resources = 3;
98
+ optional StatusType status = 4;
99
+
100
+ message NestedLevelOne {
101
+ extensions 100 to 101;
102
+ optional bool level_one = 1 [default=true];
103
+
104
+ extend Resource {
105
+ optional bool ext_nested_in_level_one = 105;
106
+ optional bool ext_dup_field = 106;
107
+ }
108
+ }
109
+
110
+ extend NestedLevelOne {
111
+ optional bool ext_nested_level_one = 100;
112
+ }
113
+
114
+ // extend Resource {
115
+ // optional bool ext_dup_field = 107;
116
+ // }
117
+ }
118
+
119
+ extend Nested {
120
+ optional string foo = 100;
121
+ optional int64 bar = 101;
122
+ }
123
+
124
+ extend Nested.NestedLevelOne {
125
+ optional bool ext_nested_level_one_outer = 101;
126
+ }
127
+
128
+ service ResourceService {
129
+ option (service_option) = -9876543210;
130
+
131
+ rpc Find (ResourceFindRequest) returns (Resource) {
132
+ option (method_option) = 2;
133
+ }
134
+ rpc FindWithRpcFailed (ResourceFindRequest) returns (Resource);
135
+ rpc FindWithSleep (ResourceSleepRequest) returns (Resource);
136
+ rpc FindNotImplemented (ResourceFindRequest) returns (Resource);
137
+ }