gapic-generator 0.9.0 → 0.9.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab653b4ab114926d58b96c5326de2a8ece5ad19d2780cb8ec5886ee83a3cb053
4
- data.tar.gz: 733ccb95f513617b9fc653ac8bbc8f02a37fa8be1a8b81c5cec051299d5f7468
3
+ metadata.gz: 61762b2051b75312bfc67ef070e136d8cf95cad1635e1b22270ed8a5b6cfbc99
4
+ data.tar.gz: cd867c0065831c6b5252dc0b5097417f24a74716f4e15cd243a1371ac80e5a5d
5
5
  SHA512:
6
- metadata.gz: 5ceea190fdf3424e89df06130809a21f6cc43b61255e1a9fa143413e4ca197a7f52962dcd060693091317226063ae373cb2c6cfdb55bf516ae06c4d9099d43b4
7
- data.tar.gz: 7558dd6358c2a19e2e9d471270acb9ce12a94696b67980193e4d6dcafb168f79342a408b68d89408606ff208fec5f5ae5bbad35110f81e9398d2eb5a124c5f43
6
+ metadata.gz: b8c833fe9bbb2d35c8fb0e7b307e1f0aeb0f5774fe0f174e2505bc0460fcc13ae06bf6e2761fe1e00d7e44079327fbc761f7423b72c51e58ef23c4f4220edebb
7
+ data.tar.gz: 89e7871eac1c9e01d870c2e367e67e16ac5c49580259d828c922324250a88955da88014496a8da7ff22964e18941046153158df4d8a023a7fb9a158a86c06cea
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release History for gapic-generator
2
2
 
3
+ ### 0.9.1 / 2021-07-07
4
+
5
+ * Detect multiple resource parents for patterns used by multiple resources
6
+
3
7
  ### 0.9.0 / 2021-06-29
4
8
 
5
9
  * Support for configuring the service/method used for the quickstart example
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Gapic
18
18
  module Generator
19
- VERSION = "0.9.0"
19
+ VERSION = "0.9.1"
20
20
  end
21
21
  end
@@ -354,9 +354,14 @@ module Gapic
354
354
  # * A mapping from resource type to resource wrapper is returned.
355
355
  def analyze_resources
356
356
  # In order to set parent_resources, we first populate a mapping from
357
- # parsed pattern to resource mapping (in the patterns variable). This
358
- # is done in one pass along with populating the resource type mapping.
359
- # Then, we go through all resources again, get its expected parent
357
+ # parsed pattern to resources that use it (in the patterns variable).
358
+ # Note that there may be multiple resources associated with a pattern.
359
+ # (This is uncommon, but one example is monitoring v3 which uses
360
+ # "projects/*" for its workspace type as well as inheriting the common
361
+ # project type. We thus map each pattern to an array of resources.)
362
+ # Constructing the patterns mapping is done in one pass along with
363
+ # populating the type mapping (which maps only to single resources.)
364
+ # Then, we go through all resources again, get each's expected parent
360
365
  # patterns, and anything that shows up in the patterns mapping is taken
361
366
  # to be a parent.
362
367
  types = {}
@@ -367,8 +372,8 @@ module Gapic
367
372
  end
368
373
  types.each do |_type, resource|
369
374
  parents = resource.parsed_parent_patterns
370
- .map { |pat| patterns[pat] }
371
- .compact.uniq
375
+ .flat_map { |pat| Array(patterns[pat]) }
376
+ .uniq
372
377
  resource.parent_resources.replace parents
373
378
  end
374
379
  types
@@ -377,7 +382,7 @@ module Gapic
377
382
  def populate_resource_lookups resource, types, patterns
378
383
  types[resource.type] = resource
379
384
  resource.parsed_patterns.each do |pat|
380
- patterns[pat] = resource
385
+ ((patterns[pat] ||= []) << resource).uniq!
381
386
  end
382
387
  end
383
388
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gapic-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernest Landrito
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-06-30 00:00:00.000000000 Z
13
+ date: 2021-07-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: actionpack