From dacc03e2fab0f3ee6d08b1e978c54e32ee45c35a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Andreassa?= Date: Tue, 2 Jul 2024 15:49:40 -0700 Subject: [PATCH] feat: Format path pattern variables to snake case (#1086) --- .../lib/gapic/path_pattern/parser.rb | 13 +++++++++++-- .../gapic/presenters/resource_presenter.rb | 7 ++++--- .../test/gapic/annotations/resource_test.rb | 6 +++--- .../presenters/pattern_presenter_test.rb | 8 ++++++++ .../gapic/presenters/service/garbage_test.rb | 2 +- shared/input/garbage_desc.bin | Bin 259859 -> 259855 bytes .../garbage/lib/garbage/garbage_pb.rb | 2 +- .../so/much/trash/garbage_service/paths.rb | 4 ++-- .../much/trash/garbage_service_paths_test.rb | 2 +- shared/protos/garbage/garbage.proto | 2 +- 10 files changed, 32 insertions(+), 14 deletions(-) diff --git a/gapic-generator/lib/gapic/path_pattern/parser.rb b/gapic-generator/lib/gapic/path_pattern/parser.rb index 25146c381..258ed3ca6 100644 --- a/gapic-generator/lib/gapic/path_pattern/parser.rb +++ b/gapic-generator/lib/gapic/path_pattern/parser.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "active_support/inflector" require "gapic/path_pattern/segment" require "gapic/path_pattern/pattern" @@ -39,7 +40,7 @@ def self.parse path_pattern segments << segment end - Pattern.new path_pattern, segments + Pattern.new format_pattern(path_pattern), segments end # @private @@ -117,7 +118,7 @@ def self.try_capture_simple_resource_id_segment url_pattern match = simple_resource_id_regex.match url_pattern segment_pattern = match[:segment_pattern] - resource_name = match[:resource_name] + resource_name = ActiveSupport::Inflector.underscore match[:resource_name] resource_pattern = match[:resource_pattern] if match.names.include? "resource_pattern" resource_patterns = resource_pattern.nil? ? [] : [resource_pattern] @@ -141,6 +142,14 @@ def self.capture_collection_id_segment url_pattern remainder = match.post_match [segment, remainder] end + + # Formats path pattern variables to snake case if nonconforming. + # @private + def self.format_pattern pattern + pattern.gsub(/\{([a-z][a-zA-Z0-9]*)\}/) do |match| + ActiveSupport::Inflector.underscore match + end + end end end end diff --git a/gapic-generator/lib/gapic/presenters/resource_presenter.rb b/gapic-generator/lib/gapic/presenters/resource_presenter.rb index cc51961b0..e9ecc38f6 100644 --- a/gapic-generator/lib/gapic/presenters/resource_presenter.rb +++ b/gapic-generator/lib/gapic/presenters/resource_presenter.rb @@ -15,7 +15,6 @@ # limitations under the License. require "gapic/path_pattern" -require "active_support/inflector" module Gapic module Presenters @@ -58,12 +57,10 @@ def path_helper # class PatternPresenter def initialize pattern_string - @pattern = pattern_string @parsed_pattern = Gapic::PathPattern.parse pattern_string @path_string = build_path_string end - attr_reader :pattern attr_reader :path_string def pattern_template @@ -103,6 +100,10 @@ def expected_path_for_dummy_values end.join "/" end + def pattern + @parsed_pattern.path_pattern + end + private def build_path_string diff --git a/gapic-generator/test/gapic/annotations/resource_test.rb b/gapic-generator/test/gapic/annotations/resource_test.rb index 94922384f..58385b4b9 100644 --- a/gapic-generator/test/gapic/annotations/resource_test.rb +++ b/gapic-generator/test/gapic/annotations/resource_test.rb @@ -53,11 +53,11 @@ def test_garbage_SimpleGarbage resource = message.option_named "resource" assert_kind_of Google::Api::ResourceDescriptor, resource - assert_equal ["projects/{project}/simple_garbage/{simple_garbage}"], resource.pattern + assert_equal ["projects/{project}/simpleGarbage/{simpleGarbage}"], resource.pattern assert_kind_of Gapic::Schema::Resource, message.resource - assert_equal ["projects/{project}/simple_garbage/{simple_garbage}"], message.resource.pattern - assert_equal ["projects/*/simple_garbage/*"], message.resource.parsed_patterns + assert_equal ["projects/{project}/simpleGarbage/{simpleGarbage}"], message.resource.pattern + assert_equal ["projects/*/simpleGarbage/*"], message.resource.parsed_patterns assert_equal ["projects/*"], message.resource.parsed_parent_patterns assert_equal message.resource, garbage.lookup_resource_type("endlesstrash.example.net/SimpleGarbage") diff --git a/gapic-generator/test/gapic/presenters/pattern_presenter_test.rb b/gapic-generator/test/gapic/presenters/pattern_presenter_test.rb index e6e238611..957268cae 100644 --- a/gapic-generator/test/gapic/presenters/pattern_presenter_test.rb +++ b/gapic-generator/test/gapic/presenters/pattern_presenter_test.rb @@ -63,4 +63,12 @@ def test_mixed_segment_pattern assert_equal "hello/value0/world/value1~value2", presenter.expected_path_for_dummy_values assert_equal "hello/\#{foo}/world/\#{world_a}~\#{world_b}", presenter.path_string end + + def test_snake_case_segment_pattern + pattern = "snakeCase/{snakeCase}/patternTest/{patternTest}" + presenter = Gapic::Presenters::ResourcePresenter::PatternPresenter.new pattern + assert_equal ["snake_case", "pattern_test"], presenter.arguments + assert_equal "snakeCase/{snake_case}/patternTest/{pattern_test}", presenter.pattern + assert_equal "snakeCase/\#{snake_case}/patternTest/\#{pattern_test}", presenter.path_string + end end diff --git a/gapic-generator/test/gapic/presenters/service/garbage_test.rb b/gapic-generator/test/gapic/presenters/service/garbage_test.rb index 4572a2af8..4c964d439 100644 --- a/gapic-generator/test/gapic/presenters/service/garbage_test.rb +++ b/gapic-generator/test/gapic/presenters/service/garbage_test.rb @@ -39,7 +39,7 @@ def test_references presenter.references.map(&:name).sort expected_patterns = [ "projects/{project}", - "projects/{project}/simple_garbage/{simple_garbage}", + "projects/{project}/simpleGarbage/{simple_garbage}", "projects/{project}/specific_garbage/{specific_garbage}", "projects/{project}/typical_garbage_1/{typical_garbage_1}" ] diff --git a/shared/input/garbage_desc.bin b/shared/input/garbage_desc.bin index 189caccffa1fe8c14f638124947140d27ef0bb94..50f2bf5db2277f9b33d1652410264f7c87d651a8 100644 GIT binary patch delta 135 zcmbRIj=%pMe?tr77N&(!jO({gNMu%HVQiXyGLA`=CH9qL)bzqECJiPbgXwzJOp*fb riA70?>8bkF#hJMUIjQdL?(t09-Q$@(m`K+P)W>vKbo-BLX6b4GVm~e_ delta 91 zcmeBw$3OWUe?tr77N&(!j2pN2B{HkAFt$uT8ONl`6939EW_o@Wlg4zhCT5fE7HQ0T QM7ML4GPS-Ttn&H<02(nN6aWAK diff --git a/shared/output/gapic/templates/garbage/lib/garbage/garbage_pb.rb b/shared/output/gapic/templates/garbage/lib/garbage/garbage_pb.rb index 86c17c375..5234ff09f 100644 --- a/shared/output/gapic/templates/garbage/lib/garbage/garbage_pb.rb +++ b/shared/output/gapic/templates/garbage/lib/garbage/garbage_pb.rb @@ -13,7 +13,7 @@ require 'google/protobuf/duration_pb' -descriptor_data = "\n\x15garbage/garbage.proto\x12\x15\x65ndless.trash.forever\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/longrunning/operations.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\"V\n\x18GetTypicalGarbageRequest\x12:\n\x04name\x18\x01 \x01(\tB,\xfa\x41)\n\'endlesstrash.example.net/TypicalGarbage\",\n\x19LongRunningGarbageRequest\x12\x0f\n\x07garbage\x18\x01 \x01(\t\"`\n\x1aLongRunningGarbageResponse\x12\x0f\n\x07garbage\x18\x01 \x01(\t\x12\x31\n\x05items\x18\x02 \x03(\x0b\x32\".endless.trash.forever.GarbageItem\"\x9c\x01\n\x1aLongRunningGarbageMetadata\x12\x18\n\x10progress_percent\x18\x01 \x01(\x05\x12.\n\nstart_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x34\n\x10last_update_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"L\n\x12ListGarbageRequest\x12\x36\n\x07garbage\x18\x01 \x01(\tB%\xfa\x41\"\x12 endlesstrash.example.net/Garbage\"Y\n\x13ListGarbageResponse\x12\x0f\n\x07garbage\x18\x01 \x01(\t\x12\x31\n\x05items\x18\x02 \x03(\x0b\x32\".endless.trash.forever.GarbageItem\"g\n\x0bGarbageItem\x12\x36\n\x07garbage\x18\x01 \x01(\tB%\xfa\x41\"\n endlesstrash.example.net/Garbage\x12\x0b\n\x01\x61\x18\x02 \x01(\tH\x00\x12\x0b\n\x01\x62\x18\x03 \x01(\x05H\x00\x42\x06\n\x04item\"\x0e\n\x0c\x45mptyGarbage\"~\n\rSimpleGarbage\x12\x0c\n\x04name\x18\x01 \x01(\t:_\xea\x41\\\n&endlesstrash.example.net/SimpleGarbage\x12\x32projects/{project}/simple_garbage/{simple_garbage}\"s\n\x11SimpleGarbageItem\x12<\n\x07garbage\x18\x01 \x01(\tB+\xfa\x41(\n&endlesstrash.example.net/SimpleGarbage\x12\x0b\n\x01\x61\x18\x02 \x01(\tH\x00\x12\x0b\n\x01\x62\x18\x03 \x01(\x05H\x00\x42\x06\n\x04item\"\x80\x08\n\x0eTypicalGarbage\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x12\n\x05int32\x18\x02 \x01(\x05\x42\x03\xe0\x41\x02\x12\r\n\x05int64\x18\x03 \x01(\x03\x12\x0e\n\x06uint32\x18\x04 \x01(\r\x12\x0e\n\x06uint64\x18\x05 \x01(\x04\x12\x11\n\x04\x62ool\x18\x06 \x01(\x08\x42\x03\xe0\x41\x02\x12\r\n\x05\x66loat\x18\x07 \x01(\x02\x12\x0e\n\x06\x64ouble\x18\x08 \x01(\x01\x12\r\n\x05\x62ytes\x18\t \x01(\x0c\x12+\n\x07timeout\x18\n \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12+\n\x08\x64uration\x18\x0b \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x33\n\x03msg\x18\x0c \x01(\x0b\x32!.endless.trash.forever.GarbageMapB\x03\xe0\x41\x03\x12\x30\n\x04\x65num\x18\r \x01(\x0e\x32\".endless.trash.forever.GarbageEnum\x12=\n\x04\x61map\x18\x0e \x03(\x0b\x32/.endless.trash.forever.TypicalGarbage.AmapEntry\x12\x1c\n\x12oneof_singular_str\x18\x0f \x01(\tH\x00\x12\x1a\n\x10oneof_pair_int32\x18\x10 \x01(\x05H\x01\x12\x1a\n\x10oneof_pair_float\x18\x11 \x01(\x02H\x01\x12J\n\x16oneof_multiple_message\x18\x12 \x01(\x0b\x32(.endless.trash.forever.SimpleGarbageItemH\x02\x12\x1e\n\x14oneof_multiple_bytes\x18\x13 \x01(\x0cH\x02\x12\x41\n\x13oneof_multiple_enum\x18\x14 \x01(\x0e\x32\".endless.trash.forever.GarbageEnumH\x02\x12\x1f\n\x15oneof_multiple_double\x18\x15 \x01(\x01H\x02\x12\x1b\n\x0eoptional_int32\x18\x16 \x01(\x05H\x03\x88\x01\x01\x1a+\n\tAmapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01:\xa1\x01\xea\x41\x9d\x01\n\'endlesstrash.example.net/TypicalGarbage\x12\x38projects/{project}/typical_garbage_1/{typical_garbage_1}\x12\x38projects/{project}/typical_garbage_2/{typical_garbage_2}B\x10\n\x0eoneof_singularB\x0c\n\noneof_pairB\x10\n\x0eoneof_multipleB\x11\n\x0f_optional_int32\"\xb8\x05\n\x0fSpecificGarbage\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\r\n\x05int32\x18\x02 \x01(\x05\x12\r\n\x05int64\x18\x03 \x01(\x03\x12\x0e\n\x06uint32\x18\x04 \x01(\r\x12\x0e\n\x06uint64\x18\x05 \x01(\x04\x12\x0c\n\x04\x62ool\x18\x06 \x01(\x08\x12\r\n\x05\x66loat\x18\x07 \x01(\x02\x12\x0e\n\x06\x64ouble\x18\x08 \x01(\x01\x12\r\n\x05\x62ytes\x18\t \x01(\x0c\x12\x33\n\x03msg\x18\n \x01(\x0b\x32!.endless.trash.forever.GarbageMapB\x03\xe0\x41\x03\x12\x30\n\x04\x65num\x18\x0b \x01(\x0e\x32\".endless.trash.forever.GarbageEnum\x12\x44\n\x06nested\x18\x0c \x01(\x0b\x32\x34.endless.trash.forever.SpecificGarbage.NestedGarbage\x1a\x83\x02\n\rNestedGarbage\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\r\n\x05int32\x18\x02 \x01(\x05\x12\r\n\x05int64\x18\x03 \x01(\x03\x12\x0e\n\x06uint32\x18\x04 \x01(\r\x12\x0e\n\x06uint64\x18\x05 \x01(\x04\x12\x0c\n\x04\x62ool\x18\x06 \x01(\x08\x12\r\n\x05\x66loat\x18\x07 \x01(\x02\x12\x0e\n\x06\x64ouble\x18\x08 \x01(\x01\x12\r\n\x05\x62ytes\x18\t \x01(\x0c\x12\x33\n\x03msg\x18\n \x01(\x0b\x32!.endless.trash.forever.GarbageMapB\x03\xe0\x41\x03\x12\x30\n\x04\x65num\x18\x0b \x01(\x0e\x32\".endless.trash.forever.GarbageEnum:e\xea\x41\x62\n(endlesstrash.example.net/SpecificGarbage\x12\x36projects/{project}/specific_garbage/{specific_garbage}\"\xe8\x02\n\x0fRepeatedGarbage\x12\x1a\n\rrepeated_name\x18\x01 \x03(\tB\x03\xe0\x41\x02\x12\x16\n\x0erepeated_int32\x18\x02 \x03(\x05\x12\x16\n\x0erepeated_int64\x18\x03 \x03(\x03\x12\x17\n\x0frepeated_uint32\x18\x04 \x03(\r\x12\x17\n\x0frepeated_uint64\x18\x05 \x03(\x04\x12\x15\n\rrepeated_bool\x18\x06 \x03(\x08\x12\x16\n\x0erepeated_float\x18\x07 \x03(\x02\x12\x17\n\x0frepeated_double\x18\x08 \x03(\x01\x12\x16\n\x0erepeated_bytes\x18\t \x03(\x0c\x12<\n\x0crepeated_msg\x18\n \x03(\x0b\x32!.endless.trash.forever.GarbageMapB\x03\xe0\x41\x03\x12\x39\n\rrepeated_enum\x18\x0b \x03(\x0e\x32\".endless.trash.forever.GarbageEnum\"}\n\x13PagedGarbageRequest\x12?\n\x07garbage\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&endlesstrash.example.net/SimpleGarbage\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\"b\n\x14PagedGarbageResponse\x12\x31\n\x05items\x18\x01 \x03(\x0b\x32\".endless.trash.forever.GarbageItem\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"\xdd\x02\n\x0e\x43omplexGarbage\x12H\n\x06layer1\x18\x01 \x01(\x0b\x32\x33.endless.trash.forever.ComplexGarbage.Layer1GarbageB\x03\xe0\x41\x02\x1aY\n\rLayer1Garbage\x12H\n\x06layer2\x18\x01 \x01(\x0b\x32\x33.endless.trash.forever.ComplexGarbage.Layer2GarbageB\x03\xe0\x41\x02\x1aY\n\rLayer2Garbage\x12H\n\x06layer3\x18\x01 \x01(\x0b\x32\x33.endless.trash.forever.ComplexGarbage.Layer3GarbageB\x03\xe0\x41\x02\x1aK\n\rLayer3Garbage\x12:\n\x07garbage\x18\x01 \x01(\x0b\x32$.endless.trash.forever.SimpleGarbageB\x03\xe0\x41\x02\"\xbc\x02\n\nGarbageMap\x12O\n\x10map_string_int32\x18\x01 \x03(\x0b\x32\x35.endless.trash.forever.GarbageMap.MapStringInt32Entry\x12K\n\x0emap_string_msg\x18\x02 \x03(\x0b\x32\x33.endless.trash.forever.GarbageMap.MapStringMsgEntry\x1a\x35\n\x13MapStringInt32Entry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1aY\n\x11MapStringMsgEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x33\n\x05value\x18\x02 \x01(\x0b\x32$.endless.trash.forever.SimpleGarbage:\x02\x38\x01\"O\n\x0bGarbageNode\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\t\x12\x32\n\x06parent\x18\x02 \x01(\x0b\x32\".endless.trash.forever.GarbageNode*\\\n\x0bGarbageEnum\x12\x13\n\x0f\x44\x45\x46\x41ULT_GARBAGE\x10\x00\x12\x0f\n\x0bGARBAGE_BAG\x10\x01\x12\x10\n\x0cGARBAGE_HEAP\x10\x02\x12\x0c\n\x08\x44UMPSTER\x10\x03\x12\x07\n\x03\x45ND\x10\x04\x32\xe2\x12\n\x0eGarbageService\x12}\n\x0fGetEmptyGarbage\x12#.endless.trash.forever.EmptyGarbage\x1a#.endless.trash.forever.EmptyGarbage\" \x82\xd3\xe4\x93\x02\x1a\"\x15/v1/empty_garbage:get:\x01*\x12\x81\x01\n\x10GetSimpleGarbage\x12$.endless.trash.forever.SimpleGarbage\x1a$.endless.trash.forever.SimpleGarbage\"!\x82\xd3\xe4\x93\x02\x1b\"\x16/v1/simple_garbage:get:\x01*\x12\x89\x01\n\x12GetSpecificGarbage\x12&.endless.trash.forever.SpecificGarbage\x1a&.endless.trash.forever.SpecificGarbage\"#\x82\xd3\xe4\x93\x02\x1d\"\x18/v1/specific_garbage:get:\x01*\x12\xa1\x01\n\x10GetNestedGarbage\x12\x34.endless.trash.forever.SpecificGarbage.NestedGarbage\x1a\x34.endless.trash.forever.SpecificGarbage.NestedGarbage\"!\x82\xd3\xe4\x93\x02\x1b\"\x16/v1/nested_garbage:get:\x01*\x12\x89\x01\n\x12GetRepeatedGarbage\x12&.endless.trash.forever.RepeatedGarbage\x1a&.endless.trash.forever.RepeatedGarbage\"#\x82\xd3\xe4\x93\x02\x1d\"\x18/v1/repeated_garbage:get:\x01*\x12\x85\x01\n\x11GetTypicalGarbage\x12%.endless.trash.forever.TypicalGarbage\x1a%.endless.trash.forever.TypicalGarbage\"\"\x82\xd3\xe4\x93\x02\x1c\"\x17/v1/typical_garbage:get:\x01*\x12\xa6\x01\n\x1aGetTypicalGarbageByRequest\x12/.endless.trash.forever.GetTypicalGarbageRequest\x1a%.endless.trash.forever.TypicalGarbage\"0\x88\x02\x01\x82\xd3\xe4\x93\x02\'\"\"/v1/typical_garbage_by_request:get:\x01*\x12\x85\x01\n\x11GetComplexGarbage\x12%.endless.trash.forever.ComplexGarbage\x1a%.endless.trash.forever.ComplexGarbage\"\"\x82\xd3\xe4\x93\x02\x1c\"\x17/v1/complex_garbage:get:\x01*\x12y\n\x0eGetGarbageNode\x12\".endless.trash.forever.GarbageNode\x1a\".endless.trash.forever.GarbageNode\"\x1f\x82\xd3\xe4\x93\x02\x19\"\x14/v1/garbage_node:get:\x01*\x12\x8c\x01\n\x0fGetPagedGarbage\x12*.endless.trash.forever.PagedGarbageRequest\x1a+.endless.trash.forever.PagedGarbageResponse\" \x82\xd3\xe4\x93\x02\x1a\"\x15/v1/paged_garbage:get:\x01*\x12\xe0\x01\n\x12LongRunningGarbage\x12\x30.endless.trash.forever.LongRunningGarbageRequest\x1a\x1d.google.longrunning.Operation\"y\xca\x41\\\n,google.garbage.v1.LongRunningGarbageResponse\x12,google.garbage.v1.LongRunningGarbageMetadata\x82\xd3\xe4\x93\x02\x14\"\x0f/v1/garbage:lro:\x01*\x12\x87\x01\n\rClientGarbage\x12).endless.trash.forever.ListGarbageRequest\x1a*.endless.trash.forever.ListGarbageResponse\"\x1d\x82\xd3\xe4\x93\x02\x17\"\x12/v1/garbage:client:\x01*(\x01\x12\x7f\n\rServerGarbage\x12).endless.trash.forever.ListGarbageRequest\x1a\".endless.trash.forever.GarbageItem\"\x1d\x82\xd3\xe4\x93\x02\x17\"\x12/v1/garbage:server:\x01*0\x01\x12`\n\x0b\x42idiGarbage\x12).endless.trash.forever.ListGarbageRequest\x1a\".endless.trash.forever.GarbageItem(\x01\x30\x01\x12\x66\n\x12\x42idiTypicalGarbage\x12%.endless.trash.forever.TypicalGarbage\x1a%.endless.trash.forever.TypicalGarbage(\x01\x30\x01\x12i\n\x04Send\x12#.endless.trash.forever.EmptyGarbage\x1a#.endless.trash.forever.EmptyGarbage\"\x17\x82\xd3\xe4\x93\x02\x11\"\x0c/v1/send:get:\x01*\x1a\xaa\x01\xca\x41\x18\x65ndlesstrash.example.net\xd2\x41\x8b\x01https://endlesstrash.example.net/garbage-admin,https://endlesstrash.example.net/garbage-read,https://endlesstrash.example.net/garbage-write2\xbc\x02\n\x0eRenamedService\x12}\n\x0fGetEmptyGarbage\x12#.endless.trash.forever.EmptyGarbage\x1a#.endless.trash.forever.EmptyGarbage\" \x82\xd3\xe4\x93\x02\x1a\"\x15/v1/empty_garbage:get:\x01*\x1a\xaa\x01\xca\x41\x18\x65ndlesstrash.example.net\xd2\x41\x8b\x01https://endlesstrash.example.net/garbage-admin,https://endlesstrash.example.net/garbage-read,https://endlesstrash.example.net/garbage-write2\xbf\x02\n\x11\x44\x65precatedService\x12|\n\rDeprecatedGet\x12#.endless.trash.forever.EmptyGarbage\x1a#.endless.trash.forever.EmptyGarbage\"!\x82\xd3\xe4\x93\x02\x1b\"\x16/v1/deprecated_get:get:\x01*\x1a\xab\x01\x88\x02\x01\xca\x41\x16\x64\x65precated.example.com\xd2\x41\x8b\x01https://endlesstrash.example.net/garbage-admin,https://endlesstrash.example.net/garbage-read,https://endlesstrash.example.net/garbage-writeB\x84\x03\xea\x02\x0fSo::Much::Trash\xea\x41\xee\x02\n endlesstrash.example.net/Garbage\x12\x32projects/{project}/simple_garbage/{simple_garbage}\x12\x38projects/{project}/typical_garbage_1/{typical_garbage_1}\x12\x38projects/{project}/typical_garbage_2/{typical_garbage_2}\x12\x36projects/{project}/specific_garbage/{specific_garbage}\x12\x32projects/{project}/nested_garbage/{nested_garbage}\x12\x36projects/{project}/repeated_garbage/{repeated_garbage}b\x06proto3" +descriptor_data = "\n\x15garbage/garbage.proto\x12\x15\x65ndless.trash.forever\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/longrunning/operations.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\"V\n\x18GetTypicalGarbageRequest\x12:\n\x04name\x18\x01 \x01(\tB,\xfa\x41)\n\'endlesstrash.example.net/TypicalGarbage\",\n\x19LongRunningGarbageRequest\x12\x0f\n\x07garbage\x18\x01 \x01(\t\"`\n\x1aLongRunningGarbageResponse\x12\x0f\n\x07garbage\x18\x01 \x01(\t\x12\x31\n\x05items\x18\x02 \x03(\x0b\x32\".endless.trash.forever.GarbageItem\"\x9c\x01\n\x1aLongRunningGarbageMetadata\x12\x18\n\x10progress_percent\x18\x01 \x01(\x05\x12.\n\nstart_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x34\n\x10last_update_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"L\n\x12ListGarbageRequest\x12\x36\n\x07garbage\x18\x01 \x01(\tB%\xfa\x41\"\x12 endlesstrash.example.net/Garbage\"Y\n\x13ListGarbageResponse\x12\x0f\n\x07garbage\x18\x01 \x01(\t\x12\x31\n\x05items\x18\x02 \x03(\x0b\x32\".endless.trash.forever.GarbageItem\"g\n\x0bGarbageItem\x12\x36\n\x07garbage\x18\x01 \x01(\tB%\xfa\x41\"\n endlesstrash.example.net/Garbage\x12\x0b\n\x01\x61\x18\x02 \x01(\tH\x00\x12\x0b\n\x01\x62\x18\x03 \x01(\x05H\x00\x42\x06\n\x04item\"\x0e\n\x0c\x45mptyGarbage\"|\n\rSimpleGarbage\x12\x0c\n\x04name\x18\x01 \x01(\t:]\xea\x41Z\n&endlesstrash.example.net/SimpleGarbage\x12\x30projects/{project}/simpleGarbage/{simpleGarbage}\"s\n\x11SimpleGarbageItem\x12<\n\x07garbage\x18\x01 \x01(\tB+\xfa\x41(\n&endlesstrash.example.net/SimpleGarbage\x12\x0b\n\x01\x61\x18\x02 \x01(\tH\x00\x12\x0b\n\x01\x62\x18\x03 \x01(\x05H\x00\x42\x06\n\x04item\"\x80\x08\n\x0eTypicalGarbage\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x12\n\x05int32\x18\x02 \x01(\x05\x42\x03\xe0\x41\x02\x12\r\n\x05int64\x18\x03 \x01(\x03\x12\x0e\n\x06uint32\x18\x04 \x01(\r\x12\x0e\n\x06uint64\x18\x05 \x01(\x04\x12\x11\n\x04\x62ool\x18\x06 \x01(\x08\x42\x03\xe0\x41\x02\x12\r\n\x05\x66loat\x18\x07 \x01(\x02\x12\x0e\n\x06\x64ouble\x18\x08 \x01(\x01\x12\r\n\x05\x62ytes\x18\t \x01(\x0c\x12+\n\x07timeout\x18\n \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12+\n\x08\x64uration\x18\x0b \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x33\n\x03msg\x18\x0c \x01(\x0b\x32!.endless.trash.forever.GarbageMapB\x03\xe0\x41\x03\x12\x30\n\x04\x65num\x18\r \x01(\x0e\x32\".endless.trash.forever.GarbageEnum\x12=\n\x04\x61map\x18\x0e \x03(\x0b\x32/.endless.trash.forever.TypicalGarbage.AmapEntry\x12\x1c\n\x12oneof_singular_str\x18\x0f \x01(\tH\x00\x12\x1a\n\x10oneof_pair_int32\x18\x10 \x01(\x05H\x01\x12\x1a\n\x10oneof_pair_float\x18\x11 \x01(\x02H\x01\x12J\n\x16oneof_multiple_message\x18\x12 \x01(\x0b\x32(.endless.trash.forever.SimpleGarbageItemH\x02\x12\x1e\n\x14oneof_multiple_bytes\x18\x13 \x01(\x0cH\x02\x12\x41\n\x13oneof_multiple_enum\x18\x14 \x01(\x0e\x32\".endless.trash.forever.GarbageEnumH\x02\x12\x1f\n\x15oneof_multiple_double\x18\x15 \x01(\x01H\x02\x12\x1b\n\x0eoptional_int32\x18\x16 \x01(\x05H\x03\x88\x01\x01\x1a+\n\tAmapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01:\xa1\x01\xea\x41\x9d\x01\n\'endlesstrash.example.net/TypicalGarbage\x12\x38projects/{project}/typical_garbage_1/{typical_garbage_1}\x12\x38projects/{project}/typical_garbage_2/{typical_garbage_2}B\x10\n\x0eoneof_singularB\x0c\n\noneof_pairB\x10\n\x0eoneof_multipleB\x11\n\x0f_optional_int32\"\xb8\x05\n\x0fSpecificGarbage\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\r\n\x05int32\x18\x02 \x01(\x05\x12\r\n\x05int64\x18\x03 \x01(\x03\x12\x0e\n\x06uint32\x18\x04 \x01(\r\x12\x0e\n\x06uint64\x18\x05 \x01(\x04\x12\x0c\n\x04\x62ool\x18\x06 \x01(\x08\x12\r\n\x05\x66loat\x18\x07 \x01(\x02\x12\x0e\n\x06\x64ouble\x18\x08 \x01(\x01\x12\r\n\x05\x62ytes\x18\t \x01(\x0c\x12\x33\n\x03msg\x18\n \x01(\x0b\x32!.endless.trash.forever.GarbageMapB\x03\xe0\x41\x03\x12\x30\n\x04\x65num\x18\x0b \x01(\x0e\x32\".endless.trash.forever.GarbageEnum\x12\x44\n\x06nested\x18\x0c \x01(\x0b\x32\x34.endless.trash.forever.SpecificGarbage.NestedGarbage\x1a\x83\x02\n\rNestedGarbage\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\r\n\x05int32\x18\x02 \x01(\x05\x12\r\n\x05int64\x18\x03 \x01(\x03\x12\x0e\n\x06uint32\x18\x04 \x01(\r\x12\x0e\n\x06uint64\x18\x05 \x01(\x04\x12\x0c\n\x04\x62ool\x18\x06 \x01(\x08\x12\r\n\x05\x66loat\x18\x07 \x01(\x02\x12\x0e\n\x06\x64ouble\x18\x08 \x01(\x01\x12\r\n\x05\x62ytes\x18\t \x01(\x0c\x12\x33\n\x03msg\x18\n \x01(\x0b\x32!.endless.trash.forever.GarbageMapB\x03\xe0\x41\x03\x12\x30\n\x04\x65num\x18\x0b \x01(\x0e\x32\".endless.trash.forever.GarbageEnum:e\xea\x41\x62\n(endlesstrash.example.net/SpecificGarbage\x12\x36projects/{project}/specific_garbage/{specific_garbage}\"\xe8\x02\n\x0fRepeatedGarbage\x12\x1a\n\rrepeated_name\x18\x01 \x03(\tB\x03\xe0\x41\x02\x12\x16\n\x0erepeated_int32\x18\x02 \x03(\x05\x12\x16\n\x0erepeated_int64\x18\x03 \x03(\x03\x12\x17\n\x0frepeated_uint32\x18\x04 \x03(\r\x12\x17\n\x0frepeated_uint64\x18\x05 \x03(\x04\x12\x15\n\rrepeated_bool\x18\x06 \x03(\x08\x12\x16\n\x0erepeated_float\x18\x07 \x03(\x02\x12\x17\n\x0frepeated_double\x18\x08 \x03(\x01\x12\x16\n\x0erepeated_bytes\x18\t \x03(\x0c\x12<\n\x0crepeated_msg\x18\n \x03(\x0b\x32!.endless.trash.forever.GarbageMapB\x03\xe0\x41\x03\x12\x39\n\rrepeated_enum\x18\x0b \x03(\x0e\x32\".endless.trash.forever.GarbageEnum\"}\n\x13PagedGarbageRequest\x12?\n\x07garbage\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&endlesstrash.example.net/SimpleGarbage\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\"b\n\x14PagedGarbageResponse\x12\x31\n\x05items\x18\x01 \x03(\x0b\x32\".endless.trash.forever.GarbageItem\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"\xdd\x02\n\x0e\x43omplexGarbage\x12H\n\x06layer1\x18\x01 \x01(\x0b\x32\x33.endless.trash.forever.ComplexGarbage.Layer1GarbageB\x03\xe0\x41\x02\x1aY\n\rLayer1Garbage\x12H\n\x06layer2\x18\x01 \x01(\x0b\x32\x33.endless.trash.forever.ComplexGarbage.Layer2GarbageB\x03\xe0\x41\x02\x1aY\n\rLayer2Garbage\x12H\n\x06layer3\x18\x01 \x01(\x0b\x32\x33.endless.trash.forever.ComplexGarbage.Layer3GarbageB\x03\xe0\x41\x02\x1aK\n\rLayer3Garbage\x12:\n\x07garbage\x18\x01 \x01(\x0b\x32$.endless.trash.forever.SimpleGarbageB\x03\xe0\x41\x02\"\xbc\x02\n\nGarbageMap\x12O\n\x10map_string_int32\x18\x01 \x03(\x0b\x32\x35.endless.trash.forever.GarbageMap.MapStringInt32Entry\x12K\n\x0emap_string_msg\x18\x02 \x03(\x0b\x32\x33.endless.trash.forever.GarbageMap.MapStringMsgEntry\x1a\x35\n\x13MapStringInt32Entry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1aY\n\x11MapStringMsgEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x33\n\x05value\x18\x02 \x01(\x0b\x32$.endless.trash.forever.SimpleGarbage:\x02\x38\x01\"O\n\x0bGarbageNode\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\t\x12\x32\n\x06parent\x18\x02 \x01(\x0b\x32\".endless.trash.forever.GarbageNode*\\\n\x0bGarbageEnum\x12\x13\n\x0f\x44\x45\x46\x41ULT_GARBAGE\x10\x00\x12\x0f\n\x0bGARBAGE_BAG\x10\x01\x12\x10\n\x0cGARBAGE_HEAP\x10\x02\x12\x0c\n\x08\x44UMPSTER\x10\x03\x12\x07\n\x03\x45ND\x10\x04\x32\xe2\x12\n\x0eGarbageService\x12}\n\x0fGetEmptyGarbage\x12#.endless.trash.forever.EmptyGarbage\x1a#.endless.trash.forever.EmptyGarbage\" \x82\xd3\xe4\x93\x02\x1a\"\x15/v1/empty_garbage:get:\x01*\x12\x81\x01\n\x10GetSimpleGarbage\x12$.endless.trash.forever.SimpleGarbage\x1a$.endless.trash.forever.SimpleGarbage\"!\x82\xd3\xe4\x93\x02\x1b\"\x16/v1/simple_garbage:get:\x01*\x12\x89\x01\n\x12GetSpecificGarbage\x12&.endless.trash.forever.SpecificGarbage\x1a&.endless.trash.forever.SpecificGarbage\"#\x82\xd3\xe4\x93\x02\x1d\"\x18/v1/specific_garbage:get:\x01*\x12\xa1\x01\n\x10GetNestedGarbage\x12\x34.endless.trash.forever.SpecificGarbage.NestedGarbage\x1a\x34.endless.trash.forever.SpecificGarbage.NestedGarbage\"!\x82\xd3\xe4\x93\x02\x1b\"\x16/v1/nested_garbage:get:\x01*\x12\x89\x01\n\x12GetRepeatedGarbage\x12&.endless.trash.forever.RepeatedGarbage\x1a&.endless.trash.forever.RepeatedGarbage\"#\x82\xd3\xe4\x93\x02\x1d\"\x18/v1/repeated_garbage:get:\x01*\x12\x85\x01\n\x11GetTypicalGarbage\x12%.endless.trash.forever.TypicalGarbage\x1a%.endless.trash.forever.TypicalGarbage\"\"\x82\xd3\xe4\x93\x02\x1c\"\x17/v1/typical_garbage:get:\x01*\x12\xa6\x01\n\x1aGetTypicalGarbageByRequest\x12/.endless.trash.forever.GetTypicalGarbageRequest\x1a%.endless.trash.forever.TypicalGarbage\"0\x88\x02\x01\x82\xd3\xe4\x93\x02\'\"\"/v1/typical_garbage_by_request:get:\x01*\x12\x85\x01\n\x11GetComplexGarbage\x12%.endless.trash.forever.ComplexGarbage\x1a%.endless.trash.forever.ComplexGarbage\"\"\x82\xd3\xe4\x93\x02\x1c\"\x17/v1/complex_garbage:get:\x01*\x12y\n\x0eGetGarbageNode\x12\".endless.trash.forever.GarbageNode\x1a\".endless.trash.forever.GarbageNode\"\x1f\x82\xd3\xe4\x93\x02\x19\"\x14/v1/garbage_node:get:\x01*\x12\x8c\x01\n\x0fGetPagedGarbage\x12*.endless.trash.forever.PagedGarbageRequest\x1a+.endless.trash.forever.PagedGarbageResponse\" \x82\xd3\xe4\x93\x02\x1a\"\x15/v1/paged_garbage:get:\x01*\x12\xe0\x01\n\x12LongRunningGarbage\x12\x30.endless.trash.forever.LongRunningGarbageRequest\x1a\x1d.google.longrunning.Operation\"y\xca\x41\\\n,google.garbage.v1.LongRunningGarbageResponse\x12,google.garbage.v1.LongRunningGarbageMetadata\x82\xd3\xe4\x93\x02\x14\"\x0f/v1/garbage:lro:\x01*\x12\x87\x01\n\rClientGarbage\x12).endless.trash.forever.ListGarbageRequest\x1a*.endless.trash.forever.ListGarbageResponse\"\x1d\x82\xd3\xe4\x93\x02\x17\"\x12/v1/garbage:client:\x01*(\x01\x12\x7f\n\rServerGarbage\x12).endless.trash.forever.ListGarbageRequest\x1a\".endless.trash.forever.GarbageItem\"\x1d\x82\xd3\xe4\x93\x02\x17\"\x12/v1/garbage:server:\x01*0\x01\x12`\n\x0b\x42idiGarbage\x12).endless.trash.forever.ListGarbageRequest\x1a\".endless.trash.forever.GarbageItem(\x01\x30\x01\x12\x66\n\x12\x42idiTypicalGarbage\x12%.endless.trash.forever.TypicalGarbage\x1a%.endless.trash.forever.TypicalGarbage(\x01\x30\x01\x12i\n\x04Send\x12#.endless.trash.forever.EmptyGarbage\x1a#.endless.trash.forever.EmptyGarbage\"\x17\x82\xd3\xe4\x93\x02\x11\"\x0c/v1/send:get:\x01*\x1a\xaa\x01\xca\x41\x18\x65ndlesstrash.example.net\xd2\x41\x8b\x01https://endlesstrash.example.net/garbage-admin,https://endlesstrash.example.net/garbage-read,https://endlesstrash.example.net/garbage-write2\xbc\x02\n\x0eRenamedService\x12}\n\x0fGetEmptyGarbage\x12#.endless.trash.forever.EmptyGarbage\x1a#.endless.trash.forever.EmptyGarbage\" \x82\xd3\xe4\x93\x02\x1a\"\x15/v1/empty_garbage:get:\x01*\x1a\xaa\x01\xca\x41\x18\x65ndlesstrash.example.net\xd2\x41\x8b\x01https://endlesstrash.example.net/garbage-admin,https://endlesstrash.example.net/garbage-read,https://endlesstrash.example.net/garbage-write2\xbf\x02\n\x11\x44\x65precatedService\x12|\n\rDeprecatedGet\x12#.endless.trash.forever.EmptyGarbage\x1a#.endless.trash.forever.EmptyGarbage\"!\x82\xd3\xe4\x93\x02\x1b\"\x16/v1/deprecated_get:get:\x01*\x1a\xab\x01\x88\x02\x01\xca\x41\x16\x64\x65precated.example.com\xd2\x41\x8b\x01https://endlesstrash.example.net/garbage-admin,https://endlesstrash.example.net/garbage-read,https://endlesstrash.example.net/garbage-writeB\x84\x03\xea\x02\x0fSo::Much::Trash\xea\x41\xee\x02\n endlesstrash.example.net/Garbage\x12\x32projects/{project}/simple_garbage/{simple_garbage}\x12\x38projects/{project}/typical_garbage_1/{typical_garbage_1}\x12\x38projects/{project}/typical_garbage_2/{typical_garbage_2}\x12\x36projects/{project}/specific_garbage/{specific_garbage}\x12\x32projects/{project}/nested_garbage/{nested_garbage}\x12\x36projects/{project}/repeated_garbage/{repeated_garbage}b\x06proto3" pool = Google::Protobuf::DescriptorPool.generated_pool diff --git a/shared/output/gapic/templates/garbage/lib/so/much/trash/garbage_service/paths.rb b/shared/output/gapic/templates/garbage/lib/so/much/trash/garbage_service/paths.rb index fbc2542ee..dabaa5d2f 100644 --- a/shared/output/gapic/templates/garbage/lib/so/much/trash/garbage_service/paths.rb +++ b/shared/output/gapic/templates/garbage/lib/so/much/trash/garbage_service/paths.rb @@ -50,7 +50,7 @@ def project_path project: # # The resource will be in the following format: # - # `projects/{project}/simple_garbage/{simple_garbage}` + # `projects/{project}/simpleGarbage/{simple_garbage}` # # @param project [String] # @param simple_garbage [String] @@ -59,7 +59,7 @@ def project_path project: def simple_garbage_path project:, simple_garbage: raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - "projects/#{project}/simple_garbage/#{simple_garbage}" + "projects/#{project}/simpleGarbage/#{simple_garbage}" end ## diff --git a/shared/output/gapic/templates/garbage/test/so/much/trash/garbage_service_paths_test.rb b/shared/output/gapic/templates/garbage/test/so/much/trash/garbage_service_paths_test.rb index 00ebf9aed..fe70faa0f 100644 --- a/shared/output/gapic/templates/garbage/test/so/much/trash/garbage_service_paths_test.rb +++ b/shared/output/gapic/templates/garbage/test/so/much/trash/garbage_service_paths_test.rb @@ -61,7 +61,7 @@ def test_simple_garbage_path end path = client.simple_garbage_path project: "value0", simple_garbage: "value1" - assert_equal "projects/value0/simple_garbage/value1", path + assert_equal "projects/value0/simpleGarbage/value1", path end end diff --git a/shared/protos/garbage/garbage.proto b/shared/protos/garbage/garbage.proto index 0aef3dae5..fff6c49cf 100644 --- a/shared/protos/garbage/garbage.proto +++ b/shared/protos/garbage/garbage.proto @@ -258,7 +258,7 @@ message EmptyGarbage {} message SimpleGarbage { option (google.api.resource) = { type: "endlesstrash.example.net/SimpleGarbage" - pattern: "projects/{project}/simple_garbage/{simple_garbage}" + pattern: "projects/{project}/simpleGarbage/{simpleGarbage}" }; // The name of this garbage.