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

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