github.com/googleapis/api-linter@v1.65.2/docs/rules/0203/unordered-list-repeated.md (about)

     1  ---
     2  rule:
     3    aip: 203
     4    name: [core, '0203', unordered-list-repeated]
     5    summary: Only repeated fields may be annotated with `UNORDERED_LIST`.
     6  permalink: /203/unordered-list-repeated
     7  redirect_from:
     8    - /0203/unordered-list-repeated
     9  ---
    10  
    11  # Repeated fields: Unordered
    12  
    13  This rule enforces that only repeated fields, not singular ones, are annotated
    14  with `(google.api.field_behavior) = UNORDERED_LIST`, as mandated by [AIP-203][].
    15  
    16  ## Details
    17  
    18  This rule looks at any field with a `(google.api.field_behavior) =
    19  UNORDERED_LIST` annotation and complains if it is not a repeated field.
    20  
    21  ## Examples
    22  
    23  **Incorrect** code for this rule:
    24  
    25  ```proto
    26  message Book {
    27    // UNORDERED_LIST only applies to repeated fields.
    28    string name = 1 [(google.api.field_behavior) = UNORDERED_LIST];
    29  
    30    repeated string genres = 2 [(google.api.field_behavior) = UNORDERED_LIST];
    31  }
    32  ```
    33  
    34  **Correct** code for this rule:
    35  
    36  ```proto
    37  // Correct.
    38  message Book {
    39    string name = 1;
    40  
    41    repeated string genres = 2 [(google.api.field_behavior) = UNORDERED_LIST];
    42  }
    43  ```
    44  
    45  ## Disabling
    46  
    47  If you need to violate this rule, use a leading comment above the field.
    48  Remember to also include an [aip.dev/not-precedent][] comment explaining why.
    49  
    50  ```proto
    51  message Book {
    52    // (-- api-linter: core::0203::unordered-list-repeated=disabled
    53    //     aip.dev/not-precedent: We need to do this because reasons. --)
    54    string name = 1 [(google.api.field_behavior) = UNORDERED_LIST];
    55  
    56    repeated string genres = 2 [(google.api.field_behavior) = UNORDERED_LIST];
    57  }
    58  ```
    59  
    60  If you need to violate this rule for an entire file, place the comment at the
    61  top of the file.
    62  
    63  [aip-203]: https://aip.dev/203
    64  [aip.dev/not-precedent]: https://aip.dev/not-precedent