github.com/googleapis/api-linter@v1.65.2/docs/rules/0140/reserved-words.md (about)

     1  ---
     2  rule:
     3    aip: 140
     4    name: [core, '0140', reserved-words]
     5    summary: Field names must not be reserved words.
     6  permalink: /140/reserved-words
     7  redirect_from:
     8    - /0140/reserved-words
     9  ---
    10  
    11  # Field names: Reserved words
    12  
    13  This rule enforces that field names are not reserved words, as mandated in
    14  [AIP-140][].
    15  
    16  ## Details
    17  
    18  This rule looks at each field and complains if it the name is a reserved word
    19  in a common programming lanaguge.
    20  
    21  Currently, the linter checks all the reserved words in Java, JavaScript, and
    22  Python 3. The exhaustive list of reserved words is found in [the code][].
    23  
    24  **Note:** Reserved words in Golang are permitted because Golang's variable
    25  casing rules avoids a conflict.
    26  
    27  ## Examples
    28  
    29  **Incorrect** code for this rule:
    30  
    31  ```proto
    32  // Incorrect.
    33  message Book {
    34    string name = 1;
    35    bool public = 2;  // Reserved word in Java, JavaScript
    36  }
    37  ```
    38  
    39  **Correct** code for this rule:
    40  
    41  ```proto
    42  // Correct.
    43  message Book {
    44    string name = 1;
    45    bool is_public = 2;
    46  }
    47  ```
    48  
    49  ## Disabling
    50  
    51  If you need to violate this rule, use a leading comment above the field.
    52  Remember to also include an [aip.dev/not-precedent][] comment explaining why.
    53  
    54  ```proto
    55  message Book {
    56    string name = 1;
    57    // (-- api-linter: core::0140::reserved-words=disabled
    58    //     aip.dev/not-precedent: We need to do this because reasons. --)
    59    bool public = 2;  // Reserved word in Java, JavaScript
    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  <!-- prettier-ignore-start -->
    67  [aip-140]: https://aip.dev/140
    68  [aip.dev/not-precedent]: https://aip.dev/not-precedent
    69  [the code]: https://github.com/googleapis/api-linter/blob/main/rules/aip0140/reserved_words.go
    70  <!-- prettier-ignore-end -->