gapic-generator 0.5.1 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +32 -0
  3. data/gem_templates/dockerfile.erb +1 -1
  4. data/gem_templates/entrypoint.erb +1 -0
  5. data/gem_templates/gemspec.erb +0 -1
  6. data/lib/gapic/file_formatter.rb +1 -2
  7. data/lib/gapic/generator/version.rb +1 -1
  8. data/lib/gapic/generators/default_generator.rb +3 -3
  9. data/lib/gapic/{path_template.rb → path_pattern.rb} +9 -8
  10. data/lib/gapic/path_pattern/parser.rb +146 -0
  11. data/lib/gapic/path_pattern/pattern.rb +80 -0
  12. data/lib/gapic/path_pattern/segment.rb +276 -0
  13. data/lib/gapic/presenters/field_presenter.rb +12 -0
  14. data/lib/gapic/presenters/gem_presenter.rb +39 -3
  15. data/lib/gapic/presenters/method_presenter.rb +10 -5
  16. data/lib/gapic/presenters/package_presenter.rb +4 -3
  17. data/lib/gapic/presenters/resource_presenter.rb +23 -31
  18. data/lib/gapic/presenters/service_presenter.rb +14 -7
  19. data/lib/gapic/runner.rb +3 -1
  20. data/lib/gapic/schema/wrappers.rb +24 -20
  21. data/lib/gapic/uri_template.rb +36 -0
  22. data/lib/gapic/uri_template/parser.rb +50 -0
  23. data/lib/google/protobuf/compiler/plugin.pb.rb +5 -1
  24. data/lib/google/protobuf/descriptor.pb.rb +1 -0
  25. data/templates/default/gem/gemfile.erb +0 -3
  26. data/templates/default/gem/gemspec.erb +4 -5
  27. data/templates/default/lib/_service.erb +2 -0
  28. data/templates/default/service/client/_client.erb +2 -0
  29. data/templates/default/service/client/_config.erb +1 -1
  30. data/templates/default/service/client/resource/_doc.erb +1 -1
  31. data/templates/default/service/client/resource/_multi.erb +4 -0
  32. data/templates/default/service/test/client.erb +1 -3
  33. data/templates/default/service/test/client_operations.erb +1 -3
  34. data/templates/default/service/test/client_paths.erb +1 -3
  35. data/templates/default/service/test/method/_bidi.erb +10 -2
  36. data/templates/default/service/test/method/_client.erb +10 -2
  37. data/templates/default/service/test/method/_normal.erb +6 -0
  38. data/templates/default/service/test/method/_server.erb +9 -1
  39. data/templates/default/service/test/method/_setup.erb +2 -2
  40. metadata +10 -21
  41. data/lib/gapic/path_template/parser.rb +0 -83
  42. data/lib/gapic/path_template/segment.rb +0 -74
@@ -1,74 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright 2019 Google LLC
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # https://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- module Gapic
18
- module PathTemplate
19
- # A segment in a URI path template.
20
- #
21
- # @see https://tools.ietf.org/html/rfc6570 URI Template
22
- #
23
- # @!attribute [r] name
24
- # @return [String, Integer] The name of a named segment, or the position
25
- # of a positional segment.
26
- # @!attribute [r] pattern
27
- # @return [String, nil] The pattern of the segment, nil if not set.
28
- class Segment
29
- attr_reader :name, :pattern
30
-
31
- def initialize name, pattern
32
- @name = name
33
- @pattern = pattern
34
- end
35
-
36
- # Determines if the segment is positional (has a number for a name).
37
- #
38
- # @return [Boolean]
39
- def positional?
40
- name.is_a? Integer
41
- end
42
-
43
- # Determines if the segment is named (has a string for a name).
44
- #
45
- # @return [Boolean]
46
- def named?
47
- !positional?
48
- end
49
-
50
- # Determines if the segment has a pattern. Positional segments always
51
- # have a pattern. Named segments may have a pattern if provided in the
52
- # URI path template.
53
- #
54
- # @return [Boolean]
55
- def pattern?
56
- !@pattern.nil?
57
- end
58
-
59
- # Determines if the segment has a nontrivial pattern (i.e. not `*` or `**`).
60
- #
61
- # @return [Boolean]
62
- def nontrivial_pattern?
63
- @pattern && @pattern != "*" && @pattern != "**"
64
- end
65
-
66
- # @private
67
- def == other
68
- return false unless other.is_a? self.class
69
-
70
- (name == other.name) && (pattern == other.pattern)
71
- end
72
- end
73
- end
74
- end