GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: fix resource path args for paths with =** by busunkim96 · Pull Request #1089 · googleapis/gapic-generator-python

This repository was archived by the owner on Aug 25, 2026. It is now read-only.

Conversation

@busunkim96

@busunkim96 busunkim96 commented Nov 17, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Some resources have =** in the segment. . A segment with =** is not matched by the current regex:

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, 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. 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:

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
};

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@busunkim96
fix(snippetgen): fix snippets for resources with =**
9b726f6
@busunkim96
busunkim96 requested a review from software-dov November 17, 2021 16:23
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Nov 17, 2021
@busunkim96 busunkim96 changed the title fix(snippetgen): fix resource path args for paths with =** fix: fix resource path args for paths with =** Nov 17, 2021
@busunkim96
busunkim96 marked this pull request as ready for review November 17, 2021 16:26
@busunkim96
busunkim96 requested review from a team November 17, 2021 16:26
busunkim96
busunkim96 commented Nov 17, 2021
View reviewed changes
Comment thread gapic/samplegen/samplegen.py

# Resource patterns look something like
# kingdom/{kingdom}/phylum/{phylum}/class/{class}
RESOURCE_RE = re.compile(r"\{([^}/]+)\}")

@busunkim96 busunkim96 Nov 17, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This regex seemed to be serving the same purpose as the one in wrappers.py

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
tseaver
tseaver approved these changes Nov 17, 2021
View reviewed changes
software-dov
software-dov approved these changes Nov 17, 2021
View reviewed changes
@busunkim96 busunkim96 added the automerge Merge the pull request once unit tests and other checks pass. label Nov 18, 2021
@busunkim96
Merge branch 'master' into fix-snippetgen-resource-pattern
cf651aa
@busunkim96 busunkim96 removed the automerge Merge the pull request once unit tests and other checks pass. label Nov 18, 2021
@busunkim96
fix: remove stray * in pattern
eb1de0b
@busunkim96 busunkim96 added the automerge Merge the pull request once unit tests and other checks pass. label Nov 18, 2021
@gcf-merge-on-green
gcf-merge-on-green Bot merged commit 309cc66 into master Nov 18, 2021
@gcf-merge-on-green
gcf-merge-on-green Bot deleted the fix-snippetgen-resource-pattern branch November 18, 2021 18:34
@gcf-merge-on-green gcf-merge-on-green Bot removed the automerge Merge the pull request once unit tests and other checks pass. label Nov 18, 2021
gcf-merge-on-green Bot pushed a commit that referenced this pull request Dec 8, 2021
@release-please
chore: release 0.58.0 (#1097)
6d78f5e
🤖 I have created a release \*beep\* \*boop\*
---
## [0.58.0](https://www.github.com/googleapis/gapic-generator-python/compare/v0.57.0...v0.58.0) (2021-12-07)


### Features

* add support for long-running operations with rest transport. ([#1094](https://www.github.com/googleapis/gapic-generator-python/issues/1094)) ([e89fd23](https://www.github.com/googleapis/gapic-generator-python/commit/e89fd23609625c5aa49acd6c6ee67f87fce324fd))


### Bug Fixes

* ensure rest unit tests have complete coverage ([#1098](https://www.github.com/googleapis/gapic-generator-python/issues/1098)) ([0705d9c](https://www.github.com/googleapis/gapic-generator-python/commit/0705d9c5dbbea793867551e64991be37d8339c6b))
* fix resource path args for paths with =** ([#1089](https://www.github.com/googleapis/gapic-generator-python/issues/1089)) ([309cc66](https://www.github.com/googleapis/gapic-generator-python/commit/309cc66e880e07940866864b03c744310ef56762))
* **snippetgen:** don't create duplicate requests for required oneofs ([#1088](https://www.github.com/googleapis/gapic-generator-python/issues/1088)) ([5531795](https://www.github.com/googleapis/gapic-generator-python/commit/55317956397370a91b1a06ecd476e55f58789807))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This was referenced Jan 18, 2022
chore(master): release reverted #1133
Merged
chore(master): release 0.40.0 #1138
Closed
@busunkim96 busunkim96 mentioned this pull request Jan 20, 2022
Resource patterns with wildcard '*' results in failing test for parse_path #701
Closed
This was referenced Jan 21, 2022
chore(master): release 0.39.1 #1146
Closed
chore(main): release 0.39.1 #1160
Closed
chore(main): release 0.39.1 #1162
Closed
chore(main): release 0.61.0 #1163
Merged
@meredithslota meredithslota mentioned this pull request Oct 16, 2023
Investigate removing workaround re: broken metric_descriptor path #1815
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@tseaver tseaver tseaver approved these changes
@software-dov software-dov software-dov approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@busunkim96 @tseaver @software-dov
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.