-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix resource path args for paths with =** (#1089)
Some resources have `=**` in the segment. . A segment with `=**` is not matched by the current regex: ```py Python 3.9.5 (default, Jul 27 2021, 22:06:04) [GCC 10.2.1 20210110] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import re >>> pattern = re.compile(r"\{([a-zA-Z0-9_-]+)\}") >>> pattern.search("projects/{project}/metricDescriptors/{metric_descriptor=**}").groups() ('project',) ``` This pattern shows up in the some real APIs ([monitoring protos](https://github.com/googleapis/googleapis/blob/3b9c98eda3bded7bb01e2f5f5c7d20f4a5d3e121/google/monitoring/v3/metric_service.proto#L39-L46), `google/cloud/iap/v1`, `google/cloud/iap/v1beta1`, `google/cloud/recommendationengine/v1beta1`, `google/devtools/remoteworkers/v1test2`, `google/home/graph/v1`, `google/iam/v1`). `**` is mentioned in passing in [Resource Names](https://cloud.google.com/apis/design/resource_names#q_how_should_i_generate_and_parse_resource_names). I was not able to find an explanation of what wildcards are considered valid in https://google.aip.dev/122 or https://google.aip.dev/client-libraries/4231. Monitoring Proto Example: ```proto option (google.api.resource_definition) = { type: "monitoring.googleapis.com/MetricDescriptor" pattern: "projects/{project}/metricDescriptors/{metric_descriptor=**}" pattern: "organizations/{organization}/metricDescriptors/{metric_descriptor=**}" pattern: "folders/{folder}/metricDescriptors/{metric_descriptor=**}" pattern: "*" history: ORIGINALLY_SINGLE_PATTERN }; ```
- Loading branch information
1 parent
7ea436f
commit 309cc66
Showing
6 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters