github.com/googleapis/api-linter@v1.65.2/docs/rules/0165/response-message-name.md (about)

     1  ---
     2  rule:
     3    aip: 165
     4    name: [core, '0165', response-message-name]
     5    summary: Purge methods must return a long-running operation.
     6  permalink: /165/response-message-name
     7  redirect_from:
     8    - /0165/response-message-name
     9  ---
    10  
    11  # Purge methods: Response message
    12  
    13  This rule enforces that all `Purge` RPCs return a long-running operation that
    14  resolves to a response with a corresponding name, as mandated in [AIP-165][].
    15  
    16  ## Details
    17  
    18  This rule looks at any message beginning with `Purge`, and complains if the
    19  response is not a long-running operation that resolves to a response matching
    20  the name of the method with a `Response` suffix.
    21  
    22  ## Examples
    23  
    24  **Incorrect** code for this rule:
    25  
    26  ```proto
    27  // Incorrect.
    28  // Should be `google.longrunning.Operation`.
    29  rpc PurgeBooks(PurgeBooksRequest) returns (PurgeBooksResponse) {
    30    option (google.api.http) = {
    31      post: "/v1/{parent=publishers/*}/books:purge"
    32      body: "*"
    33    };
    34  }
    35  ```
    36  
    37  **Incorrect** code for this rule:
    38  
    39  ```proto
    40  // Incorrect.
    41  rpc PurgeBooks(PurgeBooksRequest) returns (google.longrunning.Operation) {
    42    option (google.api.http) = {
    43      post: "/v1/{parent=publishers/*}/books:purge"
    44      body: "*"
    45    };
    46    option (google.longrunning.operation_info) = {
    47      // Should be "PurgeBooksResponse".
    48      response_type: "Book"
    49      metadata_type: "PurgeBooksMetadata"
    50    };
    51  }
    52  ```
    53  
    54  **Correct** code for this rule:
    55  
    56  ```proto
    57  // Correct.
    58  rpc PurgeBooks(PurgeBooksRequest) returns (google.longrunning.Operation) {
    59    option (google.api.http) = {
    60      post: "/v1/{parent=publishers/*}/books:purge"
    61      body: "*"
    62    };
    63    option (google.longrunning.operation_info) = {
    64      response_type: "PurgeBooksResponse"
    65      metadata_type: "PurgeBooksMetadata"
    66    };
    67  }
    68  ```
    69  
    70  ## Disabling
    71  
    72  If you need to violate this rule, use a leading comment above the method.
    73  Remember to also include an [aip.dev/not-precedent][] comment explaining why.
    74  
    75  ```proto
    76  // (-- api-linter: core::0165::response-message-name=disabled
    77  //     aip.dev/not-precedent: We need to do this because reasons. --)
    78  rpc PurgeBooks(PurgeBooksRequest) returns (PurgeBooksResponse) {
    79    option (google.api.http) = {
    80      post: "/v1/{parent=publishers/*}/books:purge"
    81      body: "*"
    82    };
    83  }
    84  ```
    85  
    86  If you need to violate this rule for an entire file, place the comment at the
    87  top of the file.
    88  
    89  [aip-165]: https://aip.dev/165
    90  [aip.dev/not-precedent]: https://aip.dev/not-precedent