github.com/googleapis/api-linter@v1.65.2/docs/rules/0158/response-plural-first-field.md (about)

     1  ---
     2  rule:
     3    aip: 158
     4    name: [core, '0158', response-plural-first-field]
     5    summary: First field of Paginated RPCs' response should be plural.
     6  permalink: /158/response-plural-first-field
     7  redirect_from:
     8    - /0158/response-plural-first-field
     9  ---
    10  
    11  # Paginated methods: Page token field
    12  
    13  This rule enforces that all `List` and `Search` methods have a plural name
    14  repeatable field as a first field in the response message, as mandated in
    15  [AIP-158][].
    16  
    17  ## Details
    18  
    19  This rule looks at any message matching `List*Response` or `Search*Response`
    20  that has `next_page_token` field and complains if the first field's name is not
    21  plural.
    22  
    23  ## Examples
    24  
    25  **Incorrect** code for this rule:
    26  
    27  ```proto
    28  // Incorrect
    29  message ListBooksResponse {
    30    // Field name should be `books`.
    31    repeated Book book = 1;
    32    string next_page_token = 2;
    33  }
    34  ```
    35  
    36  **Correct** code for this rule:
    37  
    38  ```proto
    39  // Correct.
    40  message ListBooksResponse {
    41    repeated Book books = 1;
    42    string next_page_token = 2;
    43  }
    44  ```
    45  
    46  ## Disabling
    47  
    48  If you need to violate this rule, use a leading comment above the message or
    49  above the field. Remember to also include an [aip.dev/not-precedent][] comment
    50  explaining why.
    51  
    52  ```proto
    53  // (-- api-linter: core::0158::response-plural-first-field=disabled
    54  //     aip.dev/not-precedent: We need to do this because reasons. --)
    55  message ListBooksResponse {
    56    repeated Book book = 1;
    57    string next_page_token = 2;
    58  }
    59  ```
    60  
    61  If you need to violate this rule for an entire file, place the comment at the
    62  top of the file.
    63  
    64  [aip-158]: https://aip.dev/158
    65  [aip.dev/not-precedent]: https://aip.dev/not-precedent