github.com/googleapis/api-linter@v1.65.2/docs/rules/0136/http-body.md (about) 1 --- 2 rule: 3 aip: 136 4 name: [core, '0136', http-body] 5 summary: Custom methods must have the HTTP body set to `*`. 6 permalink: /136/http-body 7 redirect_from: 8 - /0136/http-body 9 --- 10 11 # Custom methods: HTTP body 12 13 This rule enforces that all custom methods set the HTTP `body` to `*`, as 14 advised in [AIP-136][]. 15 16 ## Details 17 18 This rule looks at any method that is not a standard method, and complains if 19 the HTTP `body` field is not set to `"*"`. It also permits the name of the 20 resource. 21 22 ## Examples 23 24 **Incorrect** code for this rule: 25 26 ```proto 27 // Incorrect. 28 rpc CheckoutBook(CheckoutBookRequest) returns (CheckoutBookResponse) { 29 option (google.api.http) = { 30 post: "/v1/{name=publishers/*/books}:checkout" 31 // `body: "*"` should be included. 32 }; 33 } 34 ``` 35 36 **Correct** code for this rule: 37 38 ```proto 39 // Correct. 40 rpc CheckoutBook(CheckoutBookRequest) returns (CheckoutBookResponse) { 41 option (google.api.http) = { 42 post: "/v1/{name=publishers/*/books}:checkout" 43 body: "*" 44 }; 45 } 46 ``` 47 48 ## Disabling 49 50 If you need to violate this rule, use a leading comment above the method. 51 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 52 53 ```proto 54 // (-- api-linter: core::0136::http-body=disabled 55 // aip.dev/not-precedent: We need to do this because reasons. --) 56 rpc CheckoutBook(CheckoutBookRequest) returns (CheckoutBookResponse) { 57 option (google.api.http) = { 58 post: "/v1/{name=publishers/*/books}:checkout" 59 }; 60 } 61 ``` 62 63 If you need to violate this rule for an entire file, place the comment at the 64 top of the file. 65 66 [aip-136]: https://aip.dev/136 67 [aip.dev/not-precedent]: https://aip.dev/not-precedent