github.com/googleapis/api-linter@v1.65.2/docs/rules/0134/response-lro.md (about)

     1  ---
     2  rule:
     3    aip: 134
     4    name: [core, '0134', response-lro]
     5    summary: |
     6      Declarative-friendly Update methods should use long-running operations.
     7  permalink: /134/response-lro
     8  redirect_from:
     9    - /0134/response-lro
    10  ---
    11  
    12  # Long-running Update
    13  
    14  This rule enforces that declarative-friendly update methods use long-running
    15  operations, as mandated in [AIP-134][].
    16  
    17  ## Details
    18  
    19  This rule looks at any `Update` method connected to a resource with a
    20  `google.api.resource` annotation that includes `style: DECLARATIVE_FRIENDLY`,
    21  and complains if it does not use long-running operations.
    22  
    23  ## Examples
    24  
    25  **Incorrect** code for this rule:
    26  
    27  ```proto
    28  // Incorrect.
    29  // Assuming that Book is styled declarative-friendly, UpdateBook should
    30  // return a long-running operation.
    31  rpc UpdateBook(UpdateBookRequest) returns (Book) {
    32    option (google.api.http) = {
    33      patch: "/v1/{book.name=publishers/*/books/*}"
    34      body: "book"
    35    };
    36  }
    37  ```
    38  
    39  **Correct** code for this rule:
    40  
    41  ```proto
    42  // Correct.
    43  // Assuming that Book is styled declarative-friendly...
    44  rpc UpdateBook(UpdateBookRequest) returns (google.longrunning.Operation) {
    45    option (google.api.http) = {
    46      patch: "/v1/{book.name=publishers/*/books/*}"
    47      body: "book"
    48    };
    49    option (google.longrunning.operation_info) = {
    50      response_type: "Book"
    51      metadata_type: "OperationMetadata"
    52    };
    53  }
    54  ```
    55  
    56  ## Disabling
    57  
    58  If you need to violate this rule, use a leading comment above the message.
    59  Remember to also include an [aip.dev/not-precedent][] comment explaining why.
    60  
    61  ```proto
    62  // (-- api-linter: core::0134::response-lro=disabled
    63  //     aip.dev/not-precedent: We need to do this because reasons. --)
    64  rpc UpdateBook(UpdateBookRequest) returns (Book) {
    65    option (google.api.http) = {
    66      patch: "/v1/{book.name=publishers/*/books/*}"
    67      body: "book"
    68    };
    69  }
    70  ```
    71  
    72  **Note:** Violations of declarative-friendly rules should be rare, as tools are
    73  likely to expect strong consistency.
    74  
    75  If you need to violate this rule for an entire file, place the comment at the
    76  top of the file.
    77  
    78  [aip-134]: https://aip.dev/134
    79  [aip.dev/not-precedent]: https://aip.dev/not-precedent