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

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