|
1 | | -# Google API Linter |
| 1 | +# AEP Protobuf Linter |
2 | 2 |
|
3 | 3 | [](https://github.com/aep-dev/api-linter/actions/workflows/ci.yaml) |
4 | 4 |  |
5 | 5 |  |
6 | 6 |
|
7 | 7 | The API linter provides real-time checks for compliance with many of the API |
8 | | -standards, documented using [API Enhancement Proposals][]. It operates on API |
9 | | -surfaces defined in [protocol buffers][]. For APIs defined in |
10 | | -[OpenAPI specification][] an equivalent [OpenAPI specification linter][] is |
| 8 | +standards, documented using [API Enhancement Proposals](https://aep.dev). It operates on API |
| 9 | +surfaces defined in [protocol buffers][]. |
| 10 | + |
| 11 | +For APIs using the |
| 12 | +[OpenAPI Specification][], an equivalent [OpenAPI linter](https://github.com/aep-dev/aep-openapi-linter) is |
11 | 13 | available. |
12 | 14 |
|
13 | 15 | It identifies common mistakes and inconsistencies in API surfaces: |
14 | 16 |
|
15 | 17 | ```proto |
16 | | -// Incorrect. |
| 18 | +// Incorrect: Do not use the resource type as the field name here. |
17 | 19 | message GetBookRequest { |
18 | | - // This is wrong; it should be spelled `name`. |
| 20 | + // Field names for resource identifiers in Get requests must be `name`. |
| 21 | + // Tools and standards expect this for consistency and interoperability. |
19 | 22 | string book = 1; |
20 | 23 | } |
21 | 24 | ``` |
22 | | - |
23 | 25 | When able, it also offers a suggestion for the correct fix. |
| 26 | +```proto |
| 27 | +// Correct: This version follows AEP-148, which requires resource identifiers in Get requests to use the field name `name`. |
| 28 | +// See https://aep.dev/148/ for details. |
| 29 | +message GetBookRequest { |
| 30 | + // The name of the book to retrieve. |
| 31 | + // Format: publishers/{publisher}/books/{book} |
| 32 | + string name = 1; |
| 33 | +} |
| 34 | +``` |
24 | 35 |
|
25 | 36 | [_Read more ≫_](docs/index.md) |
26 | 37 |
|
|
0 commit comments