protobuf-cucumber 3.10.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/.rubocop.yml +70 -0
- data/.rubocop_todo.yml +145 -0
- data/.travis.yml +40 -0
- data/.yardopts +5 -0
- data/CHANGES.md +344 -0
- data/CONTRIBUTING.md +16 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +64 -0
- data/bin/protoc-gen-ruby +22 -0
- data/bin/rpc_server +5 -0
- data/install-protobuf.sh +28 -0
- data/lib/protobuf.rb +129 -0
- data/lib/protobuf/cli.rb +257 -0
- data/lib/protobuf/code_generator.rb +120 -0
- data/lib/protobuf/decoder.rb +28 -0
- data/lib/protobuf/deprecation.rb +117 -0
- data/lib/protobuf/descriptors.rb +3 -0
- data/lib/protobuf/descriptors/google/protobuf/compiler/plugin.pb.rb +62 -0
- data/lib/protobuf/descriptors/google/protobuf/descriptor.pb.rb +301 -0
- data/lib/protobuf/encoder.rb +11 -0
- data/lib/protobuf/enum.rb +365 -0
- data/lib/protobuf/exceptions.rb +9 -0
- data/lib/protobuf/field.rb +74 -0
- data/lib/protobuf/field/base_field.rb +380 -0
- data/lib/protobuf/field/base_field_object_definitions.rb +504 -0
- data/lib/protobuf/field/bool_field.rb +64 -0
- data/lib/protobuf/field/bytes_field.rb +78 -0
- data/lib/protobuf/field/double_field.rb +25 -0
- data/lib/protobuf/field/enum_field.rb +61 -0
- data/lib/protobuf/field/field_array.rb +104 -0
- data/lib/protobuf/field/field_hash.rb +122 -0
- data/lib/protobuf/field/fixed32_field.rb +25 -0
- data/lib/protobuf/field/fixed64_field.rb +28 -0
- data/lib/protobuf/field/float_field.rb +43 -0
- data/lib/protobuf/field/int32_field.rb +21 -0
- data/lib/protobuf/field/int64_field.rb +34 -0
- data/lib/protobuf/field/integer_field.rb +23 -0
- data/lib/protobuf/field/message_field.rb +51 -0
- data/lib/protobuf/field/sfixed32_field.rb +27 -0
- data/lib/protobuf/field/sfixed64_field.rb +28 -0
- data/lib/protobuf/field/signed_integer_field.rb +29 -0
- data/lib/protobuf/field/sint32_field.rb +21 -0
- data/lib/protobuf/field/sint64_field.rb +21 -0
- data/lib/protobuf/field/string_field.rb +51 -0
- data/lib/protobuf/field/uint32_field.rb +21 -0
- data/lib/protobuf/field/uint64_field.rb +21 -0
- data/lib/protobuf/field/varint_field.rb +77 -0
- data/lib/protobuf/generators/base.rb +85 -0
- data/lib/protobuf/generators/enum_generator.rb +39 -0
- data/lib/protobuf/generators/extension_generator.rb +27 -0
- data/lib/protobuf/generators/field_generator.rb +193 -0
- data/lib/protobuf/generators/file_generator.rb +262 -0
- data/lib/protobuf/generators/group_generator.rb +122 -0
- data/lib/protobuf/generators/message_generator.rb +104 -0
- data/lib/protobuf/generators/option_generator.rb +17 -0
- data/lib/protobuf/generators/printable.rb +160 -0
- data/lib/protobuf/generators/service_generator.rb +50 -0
- data/lib/protobuf/lifecycle.rb +33 -0
- data/lib/protobuf/logging.rb +39 -0
- data/lib/protobuf/message.rb +260 -0
- data/lib/protobuf/message/fields.rb +233 -0
- data/lib/protobuf/message/serialization.rb +85 -0
- data/lib/protobuf/optionable.rb +70 -0
- data/lib/protobuf/rpc/buffer.rb +78 -0
- data/lib/protobuf/rpc/client.rb +140 -0
- data/lib/protobuf/rpc/connectors/base.rb +221 -0
- data/lib/protobuf/rpc/connectors/ping.rb +89 -0
- data/lib/protobuf/rpc/connectors/socket.rb +78 -0
- data/lib/protobuf/rpc/connectors/zmq.rb +319 -0
- data/lib/protobuf/rpc/dynamic_discovery.pb.rb +50 -0
- data/lib/protobuf/rpc/env.rb +60 -0
- data/lib/protobuf/rpc/error.rb +28 -0
- data/lib/protobuf/rpc/error/client_error.rb +31 -0
- data/lib/protobuf/rpc/error/server_error.rb +43 -0
- data/lib/protobuf/rpc/middleware.rb +25 -0
- data/lib/protobuf/rpc/middleware/exception_handler.rb +40 -0
- data/lib/protobuf/rpc/middleware/logger.rb +95 -0
- data/lib/protobuf/rpc/middleware/request_decoder.rb +79 -0
- data/lib/protobuf/rpc/middleware/response_encoder.rb +83 -0
- data/lib/protobuf/rpc/middleware/runner.rb +18 -0
- data/lib/protobuf/rpc/rpc.pb.rb +64 -0
- data/lib/protobuf/rpc/rpc_method.rb +16 -0
- data/lib/protobuf/rpc/server.rb +39 -0
- data/lib/protobuf/rpc/servers/socket/server.rb +121 -0
- data/lib/protobuf/rpc/servers/socket/worker.rb +56 -0
- data/lib/protobuf/rpc/servers/socket_runner.rb +46 -0
- data/lib/protobuf/rpc/servers/zmq/broker.rb +194 -0
- data/lib/protobuf/rpc/servers/zmq/server.rb +321 -0
- data/lib/protobuf/rpc/servers/zmq/util.rb +48 -0
- data/lib/protobuf/rpc/servers/zmq/worker.rb +105 -0
- data/lib/protobuf/rpc/servers/zmq_runner.rb +70 -0
- data/lib/protobuf/rpc/service.rb +172 -0
- data/lib/protobuf/rpc/service_directory.rb +261 -0
- data/lib/protobuf/rpc/service_dispatcher.rb +45 -0
- data/lib/protobuf/rpc/service_filters.rb +250 -0
- data/lib/protobuf/rpc/stat.rb +119 -0
- data/lib/protobuf/socket.rb +21 -0
- data/lib/protobuf/tasks.rb +1 -0
- data/lib/protobuf/tasks/compile.rake +80 -0
- data/lib/protobuf/varint.rb +20 -0
- data/lib/protobuf/varint_pure.rb +31 -0
- data/lib/protobuf/version.rb +3 -0
- data/lib/protobuf/wire_type.rb +10 -0
- data/lib/protobuf/zmq.rb +21 -0
- data/profile.html +5103 -0
- data/proto/dynamic_discovery.proto +44 -0
- data/proto/google/protobuf/compiler/plugin.proto +147 -0
- data/proto/google/protobuf/descriptor.proto +779 -0
- data/proto/rpc.proto +69 -0
- data/protobuf-cucumber.gemspec +57 -0
- data/spec/benchmark/tasks.rb +143 -0
- data/spec/bin/protoc-gen-ruby_spec.rb +23 -0
- data/spec/encoding/all_types_spec.rb +103 -0
- data/spec/encoding/extreme_values_spec.rb +0 -0
- data/spec/functional/class_inheritance_spec.rb +52 -0
- data/spec/functional/code_generator_spec.rb +58 -0
- data/spec/functional/socket_server_spec.rb +59 -0
- data/spec/functional/zmq_server_spec.rb +105 -0
- data/spec/lib/protobuf/cli_spec.rb +317 -0
- data/spec/lib/protobuf/code_generator_spec.rb +87 -0
- data/spec/lib/protobuf/enum_spec.rb +307 -0
- data/spec/lib/protobuf/field/bool_field_spec.rb +91 -0
- data/spec/lib/protobuf/field/double_field_spec.rb +9 -0
- data/spec/lib/protobuf/field/enum_field_spec.rb +44 -0
- data/spec/lib/protobuf/field/field_array_spec.rb +105 -0
- data/spec/lib/protobuf/field/field_hash_spec.rb +168 -0
- data/spec/lib/protobuf/field/fixed32_field_spec.rb +7 -0
- data/spec/lib/protobuf/field/fixed64_field_spec.rb +7 -0
- data/spec/lib/protobuf/field/float_field_spec.rb +90 -0
- data/spec/lib/protobuf/field/int32_field_spec.rb +120 -0
- data/spec/lib/protobuf/field/int64_field_spec.rb +7 -0
- data/spec/lib/protobuf/field/message_field_spec.rb +132 -0
- data/spec/lib/protobuf/field/sfixed32_field_spec.rb +9 -0
- data/spec/lib/protobuf/field/sfixed64_field_spec.rb +9 -0
- data/spec/lib/protobuf/field/sint32_field_spec.rb +9 -0
- data/spec/lib/protobuf/field/sint64_field_spec.rb +9 -0
- data/spec/lib/protobuf/field/string_field_spec.rb +79 -0
- data/spec/lib/protobuf/field/uint32_field_spec.rb +7 -0
- data/spec/lib/protobuf/field/uint64_field_spec.rb +7 -0
- data/spec/lib/protobuf/field_spec.rb +192 -0
- data/spec/lib/protobuf/generators/base_spec.rb +154 -0
- data/spec/lib/protobuf/generators/enum_generator_spec.rb +82 -0
- data/spec/lib/protobuf/generators/extension_generator_spec.rb +42 -0
- data/spec/lib/protobuf/generators/field_generator_spec.rb +197 -0
- data/spec/lib/protobuf/generators/file_generator_spec.rb +119 -0
- data/spec/lib/protobuf/generators/message_generator_spec.rb +0 -0
- data/spec/lib/protobuf/generators/service_generator_spec.rb +99 -0
- data/spec/lib/protobuf/lifecycle_spec.rb +94 -0
- data/spec/lib/protobuf/message_spec.rb +944 -0
- data/spec/lib/protobuf/optionable_spec.rb +265 -0
- data/spec/lib/protobuf/rpc/client_spec.rb +66 -0
- data/spec/lib/protobuf/rpc/connectors/base_spec.rb +226 -0
- data/spec/lib/protobuf/rpc/connectors/ping_spec.rb +69 -0
- data/spec/lib/protobuf/rpc/connectors/socket_spec.rb +34 -0
- data/spec/lib/protobuf/rpc/connectors/zmq_spec.rb +110 -0
- data/spec/lib/protobuf/rpc/middleware/exception_handler_spec.rb +62 -0
- data/spec/lib/protobuf/rpc/middleware/logger_spec.rb +49 -0
- data/spec/lib/protobuf/rpc/middleware/request_decoder_spec.rb +115 -0
- data/spec/lib/protobuf/rpc/middleware/response_encoder_spec.rb +91 -0
- data/spec/lib/protobuf/rpc/servers/socket_server_spec.rb +38 -0
- data/spec/lib/protobuf/rpc/servers/zmq/server_spec.rb +43 -0
- data/spec/lib/protobuf/rpc/servers/zmq/util_spec.rb +55 -0
- data/spec/lib/protobuf/rpc/servers/zmq/worker_spec.rb +35 -0
- data/spec/lib/protobuf/rpc/service_directory_spec.rb +293 -0
- data/spec/lib/protobuf/rpc/service_dispatcher_spec.rb +35 -0
- data/spec/lib/protobuf/rpc/service_filters_spec.rb +517 -0
- data/spec/lib/protobuf/rpc/service_spec.rb +162 -0
- data/spec/lib/protobuf/rpc/stat_spec.rb +101 -0
- data/spec/lib/protobuf/varint_spec.rb +29 -0
- data/spec/lib/protobuf_spec.rb +105 -0
- data/spec/spec_helper.rb +42 -0
- data/spec/support/all.rb +6 -0
- data/spec/support/packed_field.rb +23 -0
- data/spec/support/protos/all_types.data.bin +0 -0
- data/spec/support/protos/all_types.data.txt +119 -0
- data/spec/support/protos/enum.pb.rb +63 -0
- data/spec/support/protos/enum.proto +37 -0
- data/spec/support/protos/extreme_values.data.bin +0 -0
- data/spec/support/protos/google_unittest.bin +0 -0
- data/spec/support/protos/google_unittest.pb.rb +798 -0
- data/spec/support/protos/google_unittest.proto +884 -0
- data/spec/support/protos/google_unittest_custom_options.bin +0 -0
- data/spec/support/protos/google_unittest_custom_options.pb.rb +361 -0
- data/spec/support/protos/google_unittest_custom_options.proto +424 -0
- data/spec/support/protos/google_unittest_import.pb.rb +55 -0
- data/spec/support/protos/google_unittest_import.proto +73 -0
- data/spec/support/protos/google_unittest_import_public.pb.rb +31 -0
- data/spec/support/protos/google_unittest_import_public.proto +41 -0
- data/spec/support/protos/map-test.bin +157 -0
- data/spec/support/protos/map-test.pb.rb +85 -0
- data/spec/support/protos/map-test.proto +68 -0
- data/spec/support/protos/multi_field_extensions.pb.rb +59 -0
- data/spec/support/protos/multi_field_extensions.proto +35 -0
- data/spec/support/protos/resource.pb.rb +172 -0
- data/spec/support/protos/resource.proto +137 -0
- data/spec/support/resource_service.rb +23 -0
- data/spec/support/server.rb +65 -0
- data/spec/support/test_app_file.rb +2 -0
- data/varint_prof.rb +82 -0
- 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
|
+
}
|