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

     1  ---
     2  rule:
     3    aip: 135
     4    name: [core, '0135', request-name-reference]
     5    summary: |
     6      Delete RPCs should annotate the `name` field with `google.api.resource_reference`.
     7  permalink: /135/request-name-reference
     8  redirect_from:
     9    - /0135/request-name-reference
    10  ---
    11  
    12  # Delete methods: Resource reference
    13  
    14  This rule enforces that all `Delete` standard methods have
    15  `google.api.resource_reference` on their `string name` field, as mandated in
    16  [AIP-135][].
    17  
    18  ## Details
    19  
    20  This rule looks at the `name` field of any message matching `Delete*Request`
    21  and complains if it does not have a `google.api.resource_reference` annotation.
    22  
    23  ## Examples
    24  
    25  **Incorrect** code for this rule:
    26  
    27  ```proto
    28  // Incorrect.
    29  message DeleteBookRequest {
    30    // The `google.api.resource_reference` annotation should also be included.
    31    string name = 1 [(google.api.field_behavior) = REQUIRED];
    32  }
    33  ```
    34  
    35  **Correct** code for this rule:
    36  
    37  ```proto
    38  // Correct.
    39  message DeleteBookRequest {
    40    string name = 1 [
    41      (google.api.field_behavior) = REQUIRED,
    42      (google.api.resource_reference).type = "library.googleapis.com/Book"
    43    ];
    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 DeleteBookRequest {
    54    // (-- api-linter: core::0135::request-name-reference=disabled
    55    //     aip.dev/not-precedent: We need to do this because reasons. --)
    56    string name = 1 [(google.api.field_behavior) = REQUIRED];
    57  }
    58  ```
    59  
    60  If you need to violate this rule for an entire file, place the comment at the
    61  top of the file.
    62  
    63  [aip-135]: https://aip.dev/135
    64  [aip.dev/not-precedent]: https://aip.dev/not-precedent