github.com/googleapis/api-linter@v1.65.2/docs/rules/0158/request-page-token-field.md (about)

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