Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/rules/0004/duplicate-resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ redirect_from:
# Resource annotation presence

This rule enforces that the same resource type doesn't appear in more than one
`google.api.resource` annotation, as described in [AEP-004][].
`aep.api.resource` annotation, as described in [AEP-004][].

## Details

This rule complains about messages that have the same `type` for the
`google.api.resource` annotation, which frequently occur due to copy-paste
`aep.api.resource` annotation, which frequently occur due to copy-paste
errors and messages spread across multiple files and/or packages. Duplicate
resource definitions can cause compilation problems in generated client code.

Expand All @@ -26,7 +26,7 @@ resource definitions can cause compilation problems in generated client code.

```proto
message Book {
option (google.api.resource) = {
option (aep.api.resource) = {
type: "library.googleapis.com/Book"
pattern: "publishers/{publisher}/books/{book}"
};
Expand All @@ -35,7 +35,7 @@ message Book {
}

message Author {
option (google.api.resource) = {
option (aep.api.resource) = {
// Incorrect: should be "library.googleapis.com/Author".
type: "library.googleapis.com/Book"
pattern: "authors/{author}"
Expand All @@ -50,7 +50,7 @@ message Author {
```proto
// Correct.
message Book {
option (google.api.resource) = {
option (aep.api.resource) = {
type: "library.googleapis.com/Book"
pattern: "publishers/{publisher}/books/{book}"
};
Expand All @@ -59,7 +59,7 @@ message Book {
}

message Author {
option (google.api.resource) = {
option (aep.api.resource) = {
type: "library.googleapis.com/Author"
pattern: "authors/{author}"
};
Expand All @@ -79,7 +79,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why.
syntax = "proto3";

message Book {
option (google.api.resource) = {
option (aep.api.resource) = {
type: "library.googleapis.com/Book"
pattern: "publishers/{publisher}/books/{book}"
};
Expand All @@ -88,7 +88,7 @@ message Book {
}

message Author {
option (google.api.resource) = {
option (aep.api.resource) = {
type: "library.googleapis.com/Book"
pattern: "authors/{author}"
};
Expand Down
8 changes: 4 additions & 4 deletions docs/rules/0004/path-never-optional.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ proto3_optional.

## Details

This rule scans for messages with a `google.api.resource` annotation and ensures
This rule scans for messages with a `aep.api.resource` annotation and ensures
that the configured path field (either `path` or whichever field specified via
`path_field`) is not labeled as `optional`.

Expand All @@ -26,7 +26,7 @@ that the configured path field (either `path` or whichever field specified via
```proto
// Incorrect.
message Book {
option (google.api.resource) = {
option (aep.api.resource) = {
type: "library.googleapis.com/Book"
pattern: "publishers/{publisher}/books/{book}"
};
Expand All @@ -41,7 +41,7 @@ message Book {
```proto
// Correct.
message Book {
option (google.api.resource) = {
option (aep.api.resource) = {
type: "library.googleapis.com/Book"
pattern: "publishers/{publisher}/books/{book}"
};
Expand All @@ -58,7 +58,7 @@ If you need to violate this rule, use a leading comment above the message.
// (-- api-linter: core::04::path-never-optional=disabled
// aep.dev/not-precedent: We need to do this because reasons. --)
message Book {
option (google.api.resource) = {
option (aep.api.resource) = {
type: "library.googleapis.com/Book"
pattern: "publishers/{publisher}/books/{book}"
};
Expand Down
10 changes: 5 additions & 5 deletions docs/rules/0004/resource-annotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
rule:
aep: 4
name: [core, '4', resource-annotation]
summary: Resource messages should be annotated with `google.api.resource`.
summary: Resource messages should be annotated with `aep.api.resource`.
permalink: /4/resource-annotation
redirect_from:
- /4/resource-annotation
Expand All @@ -11,13 +11,13 @@ redirect_from:
# Resource annotation presence

This rule enforces that top-level messages that appear to represent resources
have a `google.api.resource` annotation, as described in [AEP-4][].
have a `aep.api.resource` annotation, as described in [AEP-4][].

## Details

This rule scans all top-level messages, and assumes that messages with a
`string path` field are resources unless the message name ends with `Request`.
For messages that are resources, it complains if the `google.api.resource`
For messages that are resources, it complains if the `aep.api.resource`
annotation is missing.

## Examples
Expand All @@ -27,7 +27,7 @@ annotation is missing.
```proto
// Incorrect.
message Book {
// A `google.api.resource` annotation should be here.
// A `aep.api.resource` annotation should be here.
string path = 1;
}
```
Expand All @@ -37,7 +37,7 @@ message Book {
```proto
// Correct.
message Book {
option (google.api.resource) = {
option (aep.api.resource) = {
type: "library.googleapis.com/Book"
pattern: "publishers/{publisher}/books/{book}"
};
Expand Down
88 changes: 0 additions & 88 deletions docs/rules/0004/resource-definition-pattern.md

This file was deleted.

68 changes: 0 additions & 68 deletions docs/rules/0004/resource-definition-type-name.md

This file was deleted.

88 changes: 0 additions & 88 deletions docs/rules/0004/resource-definition-variables.md

This file was deleted.

Loading