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

Update lints for parent-less batch methods #615

Closed
apasel422 opened this issue Aug 31, 2020 · 4 comments · Fixed by #619 or #629
Closed

Update lints for parent-less batch methods #615

apasel422 opened this issue Aug 31, 2020 · 4 comments · Fixed by #619 or #629
Assignees

Comments

@lukesneeringer
Copy link
Contributor

Starting to work on this, but why is the AIP-136 rule affected? (I can not see any obvious change to make.)

@apasel422
Copy link
Contributor Author

if strings.Contains(httpRule.URI, "{name=") || strings.Contains(httpRule.URI, "{parent=") {
rpcSlice := strings.Split(strcase.SnakeCase(m.GetName()), "_")
if rpcSlice[0] == "batch" {
want = ":" + strcase.LowerCamelCase(rpcSlice[0]+"_"+rpcSlice[1])
} else {
want = ":" + rpcSlice[0]
}
}
doesn't work right if the batch method doesn't have the parent field in the URI.

@lukesneeringer
Copy link
Contributor

Got it, thanks. Added to #619.

@apasel422
Copy link
Contributor Author

This issue should be reopened, as the http-uri-suffix rules for AIPs 231, 233, and 234 weren't updated to account for parent-less paths. For example, the following still triggers a lint error:

service Library {
  rpc BatchGetBooks(BatchGetBooksRequest) returns (BatchGetBooksResponse) {
    option (google.api.http) = {
      get: "/v1/books:batchGet"
    }
  }
}

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