-
Notifications
You must be signed in to change notification settings - Fork 74
Closed
Labels
🚨This issue needs some love.This issue needs some love.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Asset has a resource path annotated with pattern *
message Asset {
option (google.api.resource) = {
type: "cloudasset.googleapis.com/Asset"
pattern: "*"
};This results in a unhelpful set of resource name helpers:
@staticmethod
def asset_path() -> str:
"""Return a fully-qualified asset string."""
return "*".format()
@staticmethod
def parse_asset_path(path: str) -> Dict[str, str]:
"""Parse a asset path into its component segments."""
m = re.match(r"^*$", path)
return m.groupdict() if m else {}The generated tests break because of the *.
def test_asset_path():
expected = "*".format()
actual = AssetServiceClient.asset_path()
assert expected == actual
def test_parse_asset_path():
expected = {}
path = AssetServiceClient.asset_path(**expected)
# Check that the path construction is reversible.
actual = AssetServiceClient.parse_asset_path(path)
assert expected == actual if not item or item[0][0] is AT:
> raise source.error("nothing to repeat",
source.tell() - here + len(this))
E re.error: nothing to repeat at position 1
../../.pyenv/versions/3.8.1/lib/python3.8/sre_parse.py:668: error
The * pattern is uncommon and this method isn't actually helpful for parsing paths. I'm planning on deleting it from the generated output for now.
Metadata
Metadata
Assignees
Labels
🚨This issue needs some love.This issue needs some love.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.