github.com/googleapis/api-linter@v1.65.2/docs/rules/0154/field-type.md (about) 1 --- 2 rule: 3 aip: 154 4 name: [core, '0154', field-type] 5 summary: Etag fields must be strings. 6 permalink: /154/field-type 7 redirect_from: 8 - /0154/field-type 9 --- 10 11 # Etag field type 12 13 This rule enforces that `etag` fields are strings, as mandated in [AIP-154][]. 14 15 ## Details 16 17 This rule looks at any field named `etag` and complains if the type is anything 18 other than `string`. 19 20 ## Examples 21 22 **Incorrect** code for this rule: 23 24 ```proto 25 // Incorrect. 26 message DeleteBookRequest { 27 string name = 1 [(google.api.resource_reference) = { 28 type: "library.googleapis.com/Book" 29 }]; 30 bytes etag = 2; // Should be string. 31 } 32 ``` 33 34 **Correct** code for this rule: 35 36 ```proto 37 // Correct. 38 message DeleteBookRequest { 39 string name = 1 [(google.api.resource_reference) = { 40 type: "library.googleapis.com/Book" 41 }]; 42 string etag = 2; 43 } 44 ``` 45 46 ## Disabling 47 48 If you need to violate this rule, use a leading comment above the field. 49 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 50 51 ```proto 52 message DeleteBookRequest { 53 string name = 1 [(google.api.resource_reference) = { 54 type: "library.googleapis.com/Book" 55 }]; 56 // (-- api-linter: core::0154::field-type=disabled 57 // aip.dev/not-precedent: We need to do this because reasons. --) 58 bytes etag = 2; 59 } 60 ``` 61 62 If you need to violate this rule for an entire file, place the comment at the 63 top of the file. 64 65 [aip-154]: https://aip.dev/154 66 [aip.dev/not-precedent]: https://aip.dev/not-precedent