github.com/googleapis/api-linter@v1.65.2/docs/rules/0216/value-synonyms.md (about) 1 --- 2 rule: 3 aip: 216 4 name: [core, '0216', value-synonyms] 5 summary: Enforce common state values. 6 permalink: /216/value-synonyms 7 redirect_from: 8 - /0216/value-synonyms 9 --- 10 11 # Value synonyms 12 13 This rule enforces the use of state values enumerated in [AIP-216][] over 14 common synonyms. 15 16 ## Details 17 18 This rule iterates over enumerations that end in `State` and looks for enum 19 values that are common synonyms or alternate spellings of the states listed at 20 the end of [AIP-216][], and suggests the use of the canonical value instead. 21 22 ## Examples 23 24 **Incorrect** code for this rule: 25 26 ```proto 27 // Incorrect. 28 enum State { 29 STATE_UNSPECIFIED = 0; 30 SUCCESSFUL = 1; // Should be `SUCCEEDED`. 31 } 32 ``` 33 34 **Correct** code for this rule: 35 36 ```proto 37 // Correct. 38 enum State { 39 STATE_UNSPECIFIED = 0; 40 SUCCEEDED = 1; 41 } 42 ``` 43 44 ## Disabling 45 46 If you need to violate this rule, use a leading comment above the enum value. 47 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 48 49 ```proto 50 // Incorrect. 51 enum State { 52 STATE_UNSPECIFIED = 0; 53 // (-- api-linter: core::0216::value-synonyms=disabled 54 // aip.dev/not-precedent: We need to do this because reasons. --) 55 SUCCESSFUL = 1; // Should be `SUCCEEDED`. 56 } 57 ``` 58 59 If you need to violate this rule for an entire file, place the comment at the 60 top of the file. 61 62 [aip-216]: https://aip.dev/216 63 [aip.dev/not-precedent]: https://aip.dev/not-precedent