-
Notifications
You must be signed in to change notification settings - Fork 144
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
feat(AIP-123): lint for pattern segments matching the singular. #1146
Comments
@andrei-scripniciuc this would be a good starter rule to work on if you are interested. I'll detail the requirements a bit more in this issue in a bit. |
Guidance from AIP-123 is as follows:
Given a
Example: message FooBar {
option (google.api.resource) = {
type: "foo.googleapis.com/FooBar"
singular: "fooBar"
plural: "fooBars"
// Valid because it contains `fooBars` as the collection ID
// and {foo_bar} (singular: fooBar -> foo_bar) as the resource ID variable segment
pattern: "projects/{project}/fooBars/{foo_bar}"
// Invalid because it doesn't contain `fooBars` and doesn't contain `{foo_bar}`
pattern: "organizations/{organization}/foobars/{foo_bar_id}"
}
} These should be separate rules (this issue I guess was opened for
|
@andrei-scripniciuc just remove yourself if you don't have time :) |
Oh, here is a "demo" PR for adding a new rule: https://github.com/googleapis/api-linter/pull/968/files Notice that there are markdown files required for documentation. |
Note that this goes against the guidance in AIP-122 for shortening names of nested collections:
|
Thanks for pointing that out @SanjayVas ! I actually implemented the rule with that exact edge case in mind - just forgot this issue existed - but we are on the same page! |
From @noahdietz (#1143 (comment))
The text was updated successfully, but these errors were encountered: