Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AIP-122: consider warning if a string looks like it should be a resource reference but has no annotation #1117

Open
toumorokoshi opened this issue Mar 14, 2023 · 3 comments

Comments

@toumorokoshi
Copy link
Contributor

AIP-122 provides guidance on resource reference format, but it's difficult to identify this field, because resource references can be an arbitrary noun.

Here's an example of a string that should be a resource reference:

  // The name of the Pub/Sub topic. Format:
  // `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.
  string topic = 1;

Perhaps we could use a heuristic here to ask the user to double-check if their field should be a resource reference?

Some possible heuristics:

  • "name of" in the string, since name should be a resource name most of the time.
  • "Format:" with a pathed format following it.
@shwoodard
Copy link
Collaborator

+1

I think we could use a regex on the comment to see if there is something that matches something like,

([^\/]+\/\{[^}]+\}\/?)+

@ibelle
Copy link

ibelle commented Mar 14, 2023

Ensuring this is consistent across services would be of great benefit to tools looking to build automation.

@toumorokoshi
Copy link
Contributor Author

moving to the next set to deliberate some more, and the backlog on the existing set is pretty long.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants