googleapis / api-linter

A linter for APIs defined in protocol buffers.
https://linter.aip.dev/
Apache License 2.0
599 stars 144 forks source link

Enable api-linter on buf #1095

Open yuga-cb opened 1 year ago

yuga-cb commented 1 year ago

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Is your feature request related to a problem? Please describe. The API linter is a useful way of ensuring API protobuf definitions are AIP-compliant. buf is gradually becoming an industry standard for publishing and managing protobufs, but today: 1) There is no way of natively running aip-linter in buf, and 2) The buf default lint rules contradict AIP lint rules. For example, buf recommends that no two RPC methods return the same message, but AIP recommends Get and Create methods both return the same message.

Describe the solution you'd like Native aip-linter integration into buf as a plugin.

Describe alternatives you've considered Run aip-linter entirely separately, or don't use it at all, if using buf.

Additional context N/A

RealHarshThakur commented 1 year ago

I'd like this too. I'm fine with the linters conflicting tbh. We'll only enforce AIP linter as its more thorough

iamralch commented 1 year ago

You can check my implementation here.

bufdev commented 3 months ago

Buf is currently working on custom lint and breaking change plugins, as well as an SDK to author plugins in Go, which API-linter's rules will fit very easily into. After this capability is released into Buf, it should be trivial to write a Buf lint plugin for AIP based on this codebase with a very small adapter layer.