github.com/googleapis/api-linter@v1.65.2/docs/rules/0122/no-self-links.md (about)

     1  ---
     2  rule:
     3    aip: 122
     4    name: [core, '0122', no-self-links]
     5    summary: Resources should not contain self-links.
     6  permalink: /122/no-self-links
     7  redirect_from:
     8    - /0122/no-self-links
     9  ---
    10  
    11  # No self links
    12  
    13  This rule enforces that resource messages do not contain any fields called
    14  `string self_link`, as mandated in [AIP-122][].
    15  
    16  ## Details
    17  
    18  This rule complains if it sees a resource field of type `string` that is also
    19  named `self_link`.
    20  
    21  ## Examples
    22  
    23  **Incorrect** code for this rule:
    24  
    25  ```proto
    26  // Incorrect.
    27  message Book {
    28    option (google.api.resource) = {
    29      type: "library.googleapis.com/Book"
    30      pattern: "books/{book}"
    31    };
    32    string name = 1;
    33  
    34    // Incorrect. Resources should contain self-links.
    35    string self_link = 2;
    36  }
    37  ```
    38  
    39  **Correct** code for this rule:
    40  
    41  ```proto
    42  // Correct.
    43  message Book {
    44    option (google.api.resource) = {
    45      type: "library.googleapis.com/Book"
    46      pattern: "books/{book}"
    47    };
    48    string name = 1;
    49  }
    50  ```
    51  
    52  ## Disabling
    53  
    54  If you need to violate this rule, use a leading comment above the method.
    55  Remember to also include an [aip.dev/not-precedent][] comment explaining why.
    56  
    57  ```proto
    58  // Incorrect.
    59  message Book {
    60    option (google.api.resource) = {
    61      type: "library.googleapis.com/Book"
    62      pattern: "books/{book}"
    63    };
    64    string name = 1;
    65  
    66    // (-- api-linter: core::0122::no-self-links=disabled
    67    //     aip.dev/not-precedent: We need to do this because reasons. --)
    68    string self_link = 2;
    69  }
    70  ```
    71  
    72  If you need to violate this rule for an entire file, place the comment at the
    73  top of the file.
    74  
    75  [aip-122]: https://aip.dev/122
    76  [aip.dev/not-precedent]: https://aip.dev/not-precedent