github.com/googleapis/api-linter@v1.65.2/docs/rules/0133/http-body.md (about)

     1  ---
     2  rule:
     3    aip: 133
     4    name: [core, '0133', http-body]
     5    summary: Create methods must have the HTTP body set to the resource.
     6  permalink: /133/http-body
     7  redirect_from:
     8    - /0133/http-body
     9  ---
    10  
    11  # Create methods: HTTP body
    12  
    13  This rule enforces that all `Create` RPCs set the HTTP `body` to the resource,
    14  as mandated in [AIP-133][].
    15  
    16  ## Details
    17  
    18  This rule looks at any message matching beginning with `Create`, and complains
    19  if the HTTP `body` field is not set to the resource being created.
    20  
    21  Note that any `additional_bindings` need their own `body` field.
    22  
    23  ## Examples
    24  
    25  **Incorrect** code for this rule:
    26  
    27  ```proto
    28  // Incorrect.
    29  rpc CreateBook(CreateBookRequest) returns (Book) {
    30    option (google.api.http) = {
    31      post: "/v1/{parent=publishers/*}/books"
    32      body: "*"  // This should be "book".
    33    };
    34  }
    35  ```
    36  
    37  ```proto
    38  // Incorrect.
    39  rpc CreateBook(CreateBookRequest) returns (Book) {
    40    option (google.api.http) = {
    41      post: "/v1/{parent=publishers/*}/books"
    42      body: "book"
    43      additional_bindings: {
    44        post: "/v1/books"
    45        // There should be a "body" here too.
    46      }
    47    };
    48  }
    49  ```
    50  
    51  **Correct** code for this rule:
    52  
    53  ```proto
    54  // Correct.
    55  rpc CreateBook(CreateBookRequest) returns (Book) {
    56    option (google.api.http) = {
    57      post: "/v1/{parent=publishers/*}/books"
    58      body: "book"
    59    };
    60  }
    61  ```
    62  
    63  
    64  ```proto
    65  // Correct.
    66  rpc CreateBook(CreateBookRequest) returns (Book) {
    67    option (google.api.http) = {
    68      post: "/v1/{parent=publishers/*}/books"
    69      body: "book"
    70      additional_bindings: {
    71        post: "/v1/books"
    72        body: "book"
    73      }
    74    };
    75  }
    76  ```
    77  
    78  ## Disabling
    79  
    80  If you need to violate this rule, use a leading comment above the method.
    81  Remember to also include an [aip.dev/not-precedent][] comment explaining why.
    82  
    83  ```proto
    84  // (-- api-linter: core::0133::http-body=disabled
    85  //     aip.dev/not-precedent: We need to do this because reasons. --)
    86  rpc CreateBook(CreateBookRequest) returns (Book) {
    87    option (google.api.http) = {
    88      post: "/v1/{parent=publishers/*}/books"
    89      body: "*"
    90    };
    91  }
    92  ```
    93  
    94  If you need to violate this rule for an entire file, place the comment at the
    95  top of the file.
    96  
    97  [aip-133]: https://aip.dev/133
    98  [aip.dev/not-precedent]: https://aip.dev/not-precedent