github.com/googleapis/api-linter@v1.65.2/docs/rules/0128/resource-reconciling-field.md (about) 1 --- 2 rule: 3 aip: 128 4 name: [core, '0128', resource-reconciling-field] 5 summary: Declarative-friendly resources must have a `reconciling` field. 6 permalink: /128/resource-reconciling-field 7 redirect_from: 8 - /0128/resource-reconciling-field 9 --- 10 11 # Declarative-friendly resources: Reconciling field 12 13 This rule enforces that all declarative-friendly resources have a `bool 14 reconciling` field, as mandated in [AIP-128][]. 15 16 ## Details 17 18 This rule looks at any message with a `google.api.resource` annotation that 19 includes `style: DECLARATIVE_FRIENDLY`, and complains if the `reconciling` field 20 is missing or if it has any type other than `bool`. 21 22 ## Examples 23 24 **Incorrect** code for this rule: 25 26 ```proto 27 // Incorrect. 28 // The `reconciling` field is missing. 29 message Book { 30 option (google.api.resource) = { 31 type: "library.googleapis.com/Book" 32 pattern: "publishers/{publisher}/books/{book}" 33 style: DECLARATIVE_FRIENDLY 34 }; 35 36 string name = 1; 37 } 38 ``` 39 40 ```proto 41 // Incorrect. 42 message Book { 43 option (google.api.resource) = { 44 type: "library.googleapis.com/Book" 45 pattern: "publishers/{publisher}/books/{book}" 46 style: DECLARATIVE_FRIENDLY 47 }; 48 49 string name = 1; 50 int32 reconciling = 2; // Type should be `bool`. 51 } 52 ``` 53 54 **Correct** code for this rule: 55 56 ```proto 57 // Correct. 58 message Book { 59 option (google.api.resource) = { 60 type: "library.googleapis.com/Book" 61 pattern: "publishers/{publisher}/books/{book}" 62 style: DECLARATIVE_FRIENDLY 63 }; 64 65 string name = 1; 66 bool reconciling = 2; 67 } 68 ``` 69 70 ## Disabling 71 72 If you need to violate this rule, use a leading comment above the message (if 73 the `reconciling` field is missing) or above the field (if it is the wrong 74 type). Remember to also include an [aip.dev/not-precedent][] comment explaining 75 why. 76 77 ```proto 78 // (-- api-linter: core::0128::resource-reconciling-field=disabled 79 // aip.dev/not-precedent: We need to do this because reasons. --) 80 message Book { 81 option (google.api.resource) = { 82 type: "library.googleapis.com/Book" 83 pattern: "publishers/{publisher}/books/{book}" 84 style: DECLARATIVE_FRIENDLY 85 }; 86 87 string name = 1; 88 } 89 ``` 90 91 If you need to violate this rule for an entire file, place the comment at the 92 top of the file. 93 94 [aip-128]: https://aip.dev/128 95 [aip.dev/not-precedent]: https://aip.dev/not-precedent