github.com/googleapis/api-linter@v1.65.2/docs/rules/0123/resource-type-name.md (about)

     1  ---
     2  rule:
     3    aip: 123
     4    name: [core, '0123', resource-type-name]
     5    summary: Resource type names must be of the form {Service Name}/{Type}.
     6  permalink: /123/resource-type-name
     7  redirect_from:
     8    - /0123/resource-type-name
     9  ---
    10  
    11  # Resource type name
    12  
    13  This rule enforces that messages that have a `google.api.resource` annotation,
    14  have a properly formatted `type`, as described in [AIP-123][].
    15  
    16  ## Details
    17  
    18  This rule scans messages with a `google.api.resource` annotation, and validates
    19  the format of the `type` field conforms to `{Service Name}/{Type}`.
    20  
    21  ## Examples
    22  
    23  **Incorrect** code for this rule:
    24  
    25  ```proto
    26  // Incorrect.
    27  message Book {
    28    option (google.api.resource) = {
    29      // Should not have more than one separating '/'.
    30      type: "library.googleapis.com/Genre/Mystery/Book"
    31      pattern: "publishers/{publisher}/books/{book}"
    32    };
    33  
    34    string name = 1;
    35  }
    36  ```
    37  
    38  **Correct** code for this rule:
    39  
    40  ```proto
    41  // Correct.
    42  message Book {
    43    option (google.api.resource) = {
    44      type: "library.googleapis.com/Book"
    45      pattern: "publishers/{publisher}/books/{book}"
    46    };
    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 message.
    55  
    56  ```proto
    57  // (-- api-linter: core::0123::resource-type-name=disabled
    58  //     aip.dev/not-precedent: We need to do this because reasons. --)
    59  message Book {
    60    option (google.api.resource) = {
    61      type: "library.googleapis.com/Genre/Mystery/Book"
    62      pattern: "publishers/{publisher}/books/{book}"
    63    };
    64  
    65    string name = 1;
    66  }
    67  ```
    68  
    69  If you need to violate this rule for an entire file, place the comment at the
    70  top of the file.
    71  
    72  [aip-123]: http://aip.dev/123
    73  [aip.dev/not-precedent]: https://aip.dev/not-precedent