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

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