googleapis / googleapis/api-linter

core::0136::http-uri-suffix naivety

Open
#1,021 5 comments 0 reactions 0 assignees View on GitHub
priority: p3 type: question
Dominant language
Go
Stars
765
Forks
181
Avg merge
2d 12h
Merged PRs (30d)
3

Description

[core::0136::http-uri-suffix](https://linter.aip.dev/136/http-uri-suffix) has a `Known limitations` section which states:

> This rule naïvely assumes that the verb is always one word (the “noun” may be any number of words; they often include adjectives). This may cause some false positives, and the rule may be disabled in these situations.
>
> > Note: Before disabling the rule, consider whether the verb is properly represented as a single word. A common occurrence here is for words like “Signup”, “Rollout”, etc., which should prefer their single-word form.

Is there a reason for this? The [relevant code](https://github.com/googleapis/api-linter/blob/main/rules/aip0136/http_uri_suffix.go#L60-L61) seems to be:

```
rpcSlice := strings.Split(strcase.SnakeCase(m.GetName()), "_")
want = ":" + rpcSlice[0]
```

It seems like it should be possible to fix this code not to have this limitation. For example, shorten `rpcSlice` to exclude the last element if it matches the resource name (and rpcSlice has length > 1), and then set `want` to a joined/camelCased `rpcSlice`.

I can send a PR, but first want to check whether there's a reason it doesn't already work like this.

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.