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