buf icon indicating copy to clipboard operation
buf copied to clipboard

Ignore http.httpbody response type in buf lint

Open thesiti92 opened this issue 2 years ago • 3 comments

Right now it complains that the response type doesnt have a standard naming convention, but i have to use a plain httpbody proto to use grpc-gateway to send files. I dont want to turn it off for the whole file either since its generally a good linting rule. There are already linter exceptions for other grpc protos like empty ones, so this seems like a reasonable ask.

thesiti92 avatar Mar 09 '23 17:03 thesiti92

Could we take a look at this? I believe this is a fair request.

renevall avatar Aug 21 '23 17:08 renevall

I don't understand the request - can you provide an example?

bufdev avatar Aug 21 '23 17:08 bufdev

e.g. using the example from https://buf.build/googleapis/googleapis/docs/main:google.api#google.api.HttpBody

 service ResourceService {
   rpc GetResource(GetResourceRequest) returns (google.api.HttpBody);
 }

buf lint will raise an error:

api/test.proto:17:49:RPC response type "HttpBody" should be named "GetResourceResponse" or "ResourceServiceGetResourceResponse".

Maybe there is another way to do this? Alias/embedded-struct google.api.HttpBody to GetResourceResponse? Not sure..

foot avatar Sep 26 '23 08:09 foot

We've evaluated this and are closing for now - we don't think an exception is warranted for google.api.HttpBody. However, you can use comment ignores to ignore the rule specifically here:

 service ResourceService {
  // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
  // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
   rpc GetResource(GetResourceRequest) returns (google.api.HttpBody);
 }

That's what we'd recommend for this specific instance.

bufdev avatar Jun 13 '24 21:06 bufdev