|
1 | 1 | --- |
2 | 2 | --- |
3 | 3 |
|
4 | | -# Google API Linter |
| 4 | +# AEP API Linter |
5 | 5 |
|
6 | 6 |  |
7 | 7 |  |
8 | 8 |  |
9 | 9 |
|
10 | | -The API linter provides real-time checks for compliance with many of Google's |
11 | | -API standards, documented using [API Improvement Proposals][]. It operates on |
12 | | -API surfaces defined in [protocol buffers][]. |
| 10 | +The API linter provides real-time checks for compliance with many of the API |
| 11 | +standards, documented using [API Enhancement Proposals][]. It operates on API |
| 12 | +surfaces defined in [protocol buffers][]. For APIs defined in |
| 13 | +[OpenAPI specification][] an equivalent [OpenAPI specification linter][] is |
| 14 | +available. |
13 | 15 |
|
14 | 16 | It identifies common mistakes and inconsistencies in API surfaces: |
15 | 17 |
|
@@ -43,9 +45,6 @@ It will install `api-linter` into your local Go binary directory |
43 | 45 | `$HOME/go/bin`. Ensure that your operating system's `PATH` contains the Go |
44 | 46 | binary directory. |
45 | 47 |
|
46 | | -**Note:** For working in Google-internal source control, you should use the |
47 | | -released binary `/google/bin/releases/api-linter/api-linter`. |
48 | | - |
49 | 48 | ## Usage |
50 | 49 |
|
51 | 50 | ```sh |
@@ -80,12 +79,51 @@ Usage of api-linter: |
80 | 79 | --version Print version and exit. |
81 | 80 | ``` |
82 | 81 |
|
| 82 | +### Usage with Buf |
| 83 | + |
| 84 | +[Buf][] builds tooling to make schema-driven, Protobuf-based API development |
| 85 | +reliable and user-friendly for service producers and consumers. |
| 86 | +This includes the `buf lint` command, which can be used to lint Protobuf files. |
| 87 | +The API linter can be used as a plugin for `buf lint`. |
| 88 | + |
| 89 | +To install the plugin, run: |
| 90 | + |
| 91 | +```sh |
| 92 | +go install github.com/aep-dev/api-linter/cmd/buf-plugin-aep@latest |
| 93 | +``` |
| 94 | + |
| 95 | +It will install `buf-plugin-aep` into your local Go binary directory |
| 96 | +`$HOME/go/bin`. Ensure that your operating system's `PATH` contains the Go |
| 97 | +binary directory. |
| 98 | + |
| 99 | +Then, integrate the following into your `buf.yaml` file: |
| 100 | + |
| 101 | +```yaml |
| 102 | +lint: |
| 103 | + use: |
| 104 | + - AEP |
| 105 | +plugins: |
| 106 | + - plugin: buf-plugin-aep |
| 107 | +``` |
| 108 | +
|
| 109 | +Now, you can run `buf lint` to lint your Protobuf files against the AEP rules. |
| 110 | + |
| 111 | +An example of building and linting with Buf can be found in the |
| 112 | +[example](./example) directory. |
| 113 | + |
| 114 | +More information on using Buf to lint Protobuf files can be found in the |
| 115 | +[Buf lint documentation][]. |
| 116 | + |
83 | 117 | ## License |
84 | 118 |
|
85 | 119 | This software is made available under the [Apache 2.0][] license. |
86 | 120 |
|
87 | 121 | [apache 2.0]: https://www.apache.org/licenses/LICENSE-2.0 |
88 | | -[api improvement proposals]: https://aep.dev/ |
| 122 | +[API Enhancement Proposals]: https://aep.dev/ |
89 | 123 | [configuration]: ./configuration.md |
90 | 124 | [protocol buffers]: https://developers.google.com/protocol-buffers |
91 | 125 | [rule documentation]: ./rules/index.md |
| 126 | +[OpenAPI specification]: https://www.openapis.org/ |
| 127 | +[OpenAPI specification linter]: https://github.com/aep-dev/aep-openapi-linter |
| 128 | +[Buf]: https://buf.build/ |
| 129 | +[Buf lint documentation]: https://buf.build/docs/lint/overview/ |
0 commit comments