github.com/googleapis/api-linter@v1.65.2/docs/rules/0141/forbidden-types.md (about) 1 --- 2 rule: 3 aip: 141 4 name: [core, '0141', forbidden-types] 5 summary: Fields should avoid unsigned integer types. 6 permalink: /141/forbidden-types 7 redirect_from: 8 - /0141/forbidden-types 9 --- 10 11 # Forbidden types 12 13 This rule enforces that fields do not use unsigned integer types (because many 14 programming languages and systems do not support them well), as mandated in 15 [AIP-141][]. 16 17 ## Details 18 19 This rule scans all fields and complains if it sees any of the following types: 20 21 - `fixed32` 22 - `fixed64` 23 - `uint32` 24 - `uint64` 25 26 It suggests use of `int32` or `int64` instead. 27 28 ## Examples 29 30 **Incorrect** code for this rule: 31 32 ```proto 33 // Incorrect. 34 message Book { 35 string name = 1; 36 uint32 page_count = 2; // Should be `int32`. 37 } 38 ``` 39 40 **Correct** code for this rule: 41 42 ```proto 43 // Correct. 44 message Book { 45 string name = 1; 46 int32 page_count = 2; 47 } 48 ``` 49 50 ## Disabling 51 52 If you need to violate this rule, use a leading comment above the field. 53 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 54 55 ```proto 56 message Book { 57 string name = 1; 58 // (-- api-linter: core::0141::forbidden-types=disabled 59 // aip.dev/not-precedent: We need to do this because reasons. --) 60 uint32 page_count = 2; 61 } 62 ``` 63 64 If you need to violate this rule for an entire file, place the comment at the 65 top of the file. 66 67 [aip-141]: https://aip.dev/141 68 [aip.dev/not-precedent]: https://aip.dev/not-precedent