github.com/googleapis/api-linter@v1.65.2/docs/rules/0133/request-unknown-fields.md (about)

     1  ---
     2  rule:
     3    aip: 133
     4    name: [core, '0133', request-unknown-fields]
     5    summary: Create RPCs should not have unexpected fields in the request.
     6  permalink: /133/request-unknown-fields
     7  redirect_from:
     8    - /0133/request-unknown-fields
     9  ---
    10  
    11  # Create methods: Unknown fields
    12  
    13  This rule enforces that all `Create` standard methods do not have unexpected
    14  fields, as mandated in [AIP-133][].
    15  
    16  ## Details
    17  
    18  This rule looks at any message matching `Create*Request` and complains if it
    19  comes across any fields other than:
    20  
    21  - `string parent` ([AIP-133][])
    22  - `{Resource} {resource}` ([AIP-133][])
    23  - `string {resource}_id` ([AIP-133][])
    24  - `string request_id` ([AIP-155][])
    25  
    26  ## Examples
    27  
    28  **Incorrect** code for this rule:
    29  
    30  ```proto
    31  // Incorrect.
    32  message CreateBookRequest {
    33    string parent = 1;
    34    Book book = 2;
    35    string book_id = 3;
    36    string library_id = 4;  // Non-standard field.
    37  }
    38  ```
    39  
    40  **Correct** code for this rule:
    41  
    42  ```proto
    43  // Correct.
    44  message CreateBookRequest {
    45    string parent = 1;
    46    Book book = 2;
    47    string book_id = 3;
    48  }
    49  ```
    50  
    51  ## Disabling
    52  
    53  If you need to violate this rule, use a leading comment above the field.
    54  Remember to also include an [aip.dev/not-precedent][] comment explaining why.
    55  
    56  ```proto
    57  message CreateBookRequest {
    58    string parent = 1;
    59    Book book = 2;
    60    string book_id = 3;
    61  
    62    // (-- api-linter: core::0133::request-unknown-fields=disabled
    63    //     aip.dev/not-precedent: We really need this field because reasons. --)
    64    string library_id = 4;  // Non-standard field.
    65  }
    66  ```
    67  
    68  If you need to violate this rule for an entire file, place the comment at the
    69  top of the file.
    70  
    71  [aip-133]: https://aip.dev/133
    72  [aip-155]: https://aip.dev/155
    73  [aip.dev/not-precedent]: https://aip.dev/not-precedent