github.com/googleapis/api-linter@v1.65.2/docs/rules/0134/request-unknown-fields.md (about)

     1  ---
     2  rule:
     3    aip: 134
     4    name: [core, '0134', request-unknown-fields]
     5    summary: Update RPCs should not have unexpected fields in the request.
     6  permalink: /134/request-unknown-fields
     7  redirect_from:
     8    - /0134/request-unknown-fields
     9  ---
    10  
    11  # Update methods: Unknown fields
    12  
    13  This rule enforces that all `Update` standard methods do not have unexpected
    14  fields, as mandated in [AIP-134][].
    15  
    16  ## Details
    17  
    18  This rule looks at any message matching `Update*Request` and complains if it
    19  comes across any fields other than:
    20  
    21  - `{Resource} {resource}` ([AIP-134][])
    22  - `bool allow_missing` ([AIP-134][])
    23  - `google.protobuf.FieldMask update_mask` ([AIP-134][])
    24  - `string request_id` ([AIP-155][])
    25  
    26  ## Examples
    27  
    28  **Incorrect** code for this rule:
    29  
    30  ```proto
    31  // Incorrect.
    32  message UpdateBookRequest {
    33    Book book = 1;
    34    google.protobuf.FieldMask update_mask = 2;
    35    string library_id = 3;  // Non-standard field.
    36  }
    37  ```
    38  
    39  **Correct** code for this rule:
    40  
    41  ```proto
    42  // Correct.
    43  message UpdateBookRequest {
    44    Book book = 1;
    45    google.protobuf.FieldMask update_mask = 2;
    46  }
    47  ```
    48  
    49  ## Disabling
    50  
    51  If you need to violate this rule, use a leading comment above the field.
    52  Remember to also include an [aip.dev/not-precedent][] comment explaining why.
    53  
    54  ```proto
    55  message UpdateBookRequest {
    56    Book book = 1;
    57    google.protobuf.FieldMask update_mask = 2;
    58    // (-- api-linter: core::0134::request-unknown-fields=disabled
    59    //     aip.dev/not-precedent: We really need this field because reasons. --)
    60    string library_id = 3;  // Non-standard field.
    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-134]: https://aip.dev/134
    68  [aip-155]: https://aip.dev/155
    69  [aip.dev/not-precedent]: https://aip.dev/not-precedent