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
8 changes: 2 additions & 6 deletions docs/rules/0004/resource-reference-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ message Book {
string path = 1;

// This is not a resource reference; the annotation does not belong.
Author author = 2 [(aep.api.field_info).resource_reference = {
type: "library.googleapis.com/Author"
}];
Author author = 2 [(aep.api.field_info).resource_reference = "library.googleapis.com/Author"];
}
```

Expand All @@ -55,9 +53,7 @@ message Book {
message Book {
string path = 1;

string author = 2 [(aep.api.field_info).resource_reference = {
type: "library.googleapis.com/Author"
}];
string author = 2 [(aep.api.field_info).resource_reference = "library.googleapis.com/Author"];
}
```

Expand Down
12 changes: 6 additions & 6 deletions docs/rules/0121/no-mutable-cycles.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ message Book {

// Incorrect. Creates potential reference cycle.
string author = 2 [
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Author"
(aep.api.field_info).resource_reference = "library.googleapis.com/Author"
];
}

Expand All @@ -47,7 +47,7 @@ message Author {

// Incorrect. Creates potential reference cycle.
string book = 2 [
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Book"
(aep.api.field_info).resource_reference = "library.googleapis.com/Book"
];
}
```
Expand All @@ -65,7 +65,7 @@ message Book {

// Correct because the other reference is OUTPUT_ONLY.
string author = 2 [
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Author"
(aep.api.field_info).resource_reference = "library.googleapis.com/Author"
];
}

Expand All @@ -79,7 +79,7 @@ message Author {

// Correct because an OUTPUT_ONLY reference breaks the mutation cycle.
string book = 2 [
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Book",
(aep.api.field_info).resource_reference = "library.googleapis.com/Book",
(aep.api.field_behavior) = FIELD_BEHAVIOR_OUTPUT_ONLY
];
}
Expand All @@ -102,7 +102,7 @@ message Book {
// (-- api-linter: core::0121::no-mutable-cycles=disabled
// aep.dev/not-precedent: We need to do this because reasons. --)
string author = 2 [
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Author"
(aep.api.field_info).resource_reference = "library.googleapis.com/Author"
];
}

Expand All @@ -117,7 +117,7 @@ message Author {
// (-- api-linter: core::0121::no-mutable-cycles=disabled
// aep.dev/not-precedent: We need to do this because reasons. --)
string book = 2 [
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Book"
(aep.api.field_info).resource_reference = "library.googleapis.com/Book"
];
}
```
Expand Down
12 changes: 3 additions & 9 deletions docs/rules/0122/resource-reference-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ message Book {
string path = 1;

// Resource references should be strings.
Author author = 2 [(aep.api.field_info).resource_reference = {
type: "library.googleapis.com/Author"
}];
Author author = 2 [(aep.api.field_info).resource_reference = "library.googleapis.com/Author"];
}
```

Expand All @@ -41,9 +39,7 @@ message Book {
message Book {
string path = 1;

string author = 2 [(aep.api.field_info).resource_reference = {
type: "library.googleapis.com/Author"
}];
string author = 2 [(aep.api.field_info).resource_reference = "library.googleapis.com/Author"];
}
```

Expand All @@ -69,9 +65,7 @@ message Book {

// (-- api-linter: core::0122::resource-reference-type=disabled
// aep.dev/not-precedent: We need to do this because reasons. --)
Author author = 2 [(aep.api.field_info).resource_reference = {
type: "library.googleapis.com/Author"
}];
Author author = 2 [(aep.api.field_info).resource_reference = "library.googleapis.com/Author"];
}
```

Expand Down
12 changes: 3 additions & 9 deletions docs/rules/0124/reference-same-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ message Book {
package google.example.libray.v1; // Typo: Different package.

message GetBookRequest {
string name = 1 [(aep.api.field_info).resource_reference = {
type: "library.googleapis.com/Book" // Lint warning: package mismatch.
}];
string name = 1 [(aep.api.field_info).resource_reference = "library.googleapis.com/Book"]; // Lint warning: package mismatch.
}
```

Expand All @@ -70,9 +68,7 @@ message Book {
}

message GetBookRequest {
string name = 1 [(aep.api.field_info).resource_reference = {
type: "library.googleapis.com/Book"
}];
string name = 1 [(aep.api.field_info).resource_reference = "library.googleapis.com/Book"];
}
```

Expand All @@ -98,9 +94,7 @@ package google.example.library.v1;
message GetBookRequest {
// (-- api-linter: core::0124::reference-same-package=disabled
// aep.dev/not-precedent: We need to do this because reasons. --)
string name = 1 [(aep.api.field_info).resource_reference = {
type: "library.googleapis.com/Book"
}];
string name = 1 [(aep.api.field_info).resource_reference = "library.googleapis.com/Book"];
}
```

Expand Down
4 changes: 2 additions & 2 deletions docs/rules/0127/http-template-pattern.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ rpc GetBook(GetBookRequest) returns (Book) {
}
message GetBookRequest {
string path = 1 [
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Book"
(aep.api.field_info).resource_reference = "library.googleapis.com/Book"
];
}
message Book {
Expand All @@ -61,7 +61,7 @@ rpc GetBook(GetBookRequest) returns (Book) {
}
message GetBookRequest {
string path = 1 [
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Book"
(aep.api.field_info).resource_reference = "library.googleapis.com/Book"
];
}
message Book {
Expand Down
10 changes: 3 additions & 7 deletions docs/rules/0131/request-path-behavior.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ value of `FIELD_BEHAVIOR_REQUIRED`.
// Incorrect.
message GetBookRequest {
// The `aep.api.field_behavior` annotation should also be included.
string path = 1 [(aep.api.field_info).resource_reference = {
type: "library.googleapis.com/Book"
}];
string path = 1 [(aep.api.field_info).resource_reference = "library.googleapis.com/Book"];
}
```

Expand All @@ -42,7 +40,7 @@ message GetBookRequest {
message GetBookRequest {
string path = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Book"
(aep.api.field_info).resource_reference = "library.googleapis.com/Book"
];
}
```
Expand All @@ -56,9 +54,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why.
message GetBookRequest {
// (-- api-linter: core::0131::request-path-behavior=disabled
// aep.dev/not-precedent: We need to do this because reasons. --)
string path = 1 [(aep.api.field_info).resource_reference = {
type: "library.googleapis.com/Book"
}];
string path = 1 [(aep.api.field_info).resource_reference = "library.googleapis.com/Book"];
}
```

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/0131/request-path-reference-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ message GetBookRequest {
// reference.
string path = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference.child_type = "library.googleapis.com/Book"
(aep.api.field_info).resource_reference_child_type = "library.googleapis.com/Book"
];
}
```
Expand All @@ -45,7 +45,7 @@ message GetBookRequest {
message GetBookRequest {
string path = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Book"
(aep.api.field_info).resource_reference = "library.googleapis.com/Book"
];
}
```
Expand All @@ -61,7 +61,7 @@ message GetBookRequest {
// aep.dev/not-precedent: We need to do this because reasons. --)
string path = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference.child_type = "library.googleapis.com/Book"
(aep.api.field_info).resource_reference_child_type = "library.googleapis.com/Book"
];
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/0131/request-path-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ message GetBookRequest {
message GetBookRequest {
string path = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Book"
(aep.api.field_info).resource_reference = "library.googleapis.com/Book"
];
}
```
Expand Down
6 changes: 3 additions & 3 deletions docs/rules/0131/request-path-required.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ the `path` field is missing.
message GetBookRequest {
string book = 1 [ // Field path should be `path`.
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Book"
(aep.api.field_info).resource_reference = "library.googleapis.com/Book"
];
}
```
Expand All @@ -39,7 +39,7 @@ message GetBookRequest {
message GetBookRequest {
string path = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Book"
(aep.api.field_info).resource_reference = "library.googleapis.com/Book"
];
}
```
Expand All @@ -55,7 +55,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why.
message GetBookRequest {
string book = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Book"
(aep.api.field_info).resource_reference = "library.googleapis.com/Book"
];
}
```
Expand Down
12 changes: 3 additions & 9 deletions docs/rules/0131/request-required-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ message GetBookRequest {
// Format: publishers/{publisher}/books/{book}
string path = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference = {
type: "library.googleapis.com/Book"
}];
(aep.api.field_info).resource_reference = "library.googleapis.com/Book"];

// Non-standard required field.
google.protobuf.FieldMask read_mask = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];
Expand All @@ -49,9 +47,7 @@ message GetBookRequest {
// Format: publishers/{publisher}/books/{book}
string path = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference = {
type: "library.googleapis.com/Book"
}];
(aep.api.field_info).resource_reference = "library.googleapis.com/Book"];

google.protobuf.FieldMask read_mask = 2 [(aep.api.field_info).field_behavior = OPTIONAL];
}
Expand All @@ -68,9 +64,7 @@ message GetBookRequest {
// Format: publishers/{publisher}/books/{book}
string path = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference = {
type: "library.googleapis.com/Book"
}];
(aep.api.field_info).resource_reference = "library.googleapis.com/Book"];

// (-- api-linter: core::0131::request-required-fields=disabled
// aep.dev/not-precedent: We really need this field to be required because
Expand Down
10 changes: 3 additions & 7 deletions docs/rules/0132/request-parent-behavior.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ value of `FIELD_BEHAVIOR_REQUIRED`.
// Incorrect.
message ListBooksRequest {
// The `aep.api.field_behavior` annotation should also be included.
string parent = 1 [(aep.api.field_info).resource_reference = {
type: "library.googleapis.com/Publisher"
}];
string parent = 1 [(aep.api.field_info).resource_reference = "library.googleapis.com/Publisher"];
int32 page_size = 2;
string page_token = 3;
}
Expand All @@ -44,7 +42,7 @@ message ListBooksRequest {
message ListBooksRequest {
string parent = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Publisher"
(aep.api.field_info).resource_reference = "library.googleapis.com/Publisher"
];
int32 page_size = 2;
string page_token = 3;
Expand All @@ -60,9 +58,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why.
// (-- api-linter: core::0132::request-parent-behavior=disabled
// aep.dev/not-precedent: We need to do this because reasons. --)
message ListBooksRequest {
string parent = 1 [(aep.api.field_info).resource_reference = {
type: "library.googleapis.com/Publisher"
}];
string parent = 1 [(aep.api.field_info).resource_reference = "library.googleapis.com/Publisher"];
int32 page_size = 2;
string page_token = 3;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/0132/request-parent-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ message ListBooksRequest {
message ListBooksRequest {
string parent = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Publisher"
(aep.api.field_info).resource_reference = "library.googleapis.com/Publisher"
];
int32 page_size = 2;
string page_token = 3;
Expand Down
6 changes: 3 additions & 3 deletions docs/rules/0132/request-parent-valid-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ message ListBooksRequest {
// being listed.
string parent = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Book"
(aep.api.field_info).resource_reference = "library.googleapis.com/Book"
];
int32 page_size = 2;
string page_token = 3;
Expand All @@ -47,7 +47,7 @@ message ListBooksRequest {
message ListBooksRequest {
string parent = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference.child_type = "library.googleapis.com/Book"
(aep.api.field_info).resource_reference_child_type = "library.googleapis.com/Book"
];
int32 page_size = 2;
string page_token = 3;
Expand All @@ -65,7 +65,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why.
message ListBooksRequest {
string parent = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference.type = "library.googleapis.com/Book"
(aep.api.field_info).resource_reference = "library.googleapis.com/Book"
];
}
```
Expand Down
15 changes: 6 additions & 9 deletions docs/rules/0132/request-required-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ message ListBooksRequest {
// Format: publishers/{publisher}
string parent = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference = {
child_type: "library.googleapis.com/Book"
}];
(aep.api.field_info).resource_reference_child_type = "library.googleapis.com/Book"
];

// Non-standard required field.
int32 page_size = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]
Expand All @@ -49,9 +48,8 @@ message ListBooksRequest {
// Format: publishers/{publisher}
string parent = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference = {
child_type: "library.googleapis.com/Book"
}];
(aep.api.field_info).resource_reference_child_type = "library.googleapis.com/Book"
];

int32 page_size = 2 [(aep.api.field_info).field_behavior = OPTIONAL]
}
Expand All @@ -68,9 +66,8 @@ message ListBooksRequest {
// Format: publishers/{publisher}
string parent = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference = {
child_type: "library.googleapis.com/Book"
}];
(aep.api.field_info).resource_reference_child_type = "library.googleapis.com/Book"
];

// (-- api-linter: core::0132::request-required-fields=disabled
// aep.dev/not-precedent: We really need this field to be required because
Expand Down
Loading