Skip to content
Open
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
2 changes: 1 addition & 1 deletion docs/rules/0121/no-mutable-cycles.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ message Author {
// Correct because an OUTPUT_ONLY reference breaks the mutation cycle.
string book = 2 [
(google.api.resource_reference).type = "library.googleapis.com/Book",
(google.api.field_behavior) = OUTPUT_ONLY
(aep.api.field_behavior) = FIELD_BEHAVIOR_OUTPUT_ONLY
];
}
```
Expand Down
8 changes: 4 additions & 4 deletions docs/rules/0122/resource-id-output-only.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ message Book {
pattern: "books/{book}"
};
string path = 1;
// Should have `(google.api.field_behavior) = OUTPUT_ONLY`.
// Should have `(aep.api.field_behavior) = FIELD_BEHAVIOR_OUTPUT_ONLY`.
string book_id = 2;
// Should have `(google.api.field_behavior) = OUTPUT_ONLY`.
// Should have `(aep.api.field_behavior) = FIELD_BEHAVIOR_OUTPUT_ONLY`.
string uid = 3;
}
```
Expand All @@ -47,8 +47,8 @@ message Book {
pattern: "books/{book}"
};
string path = 1;
string book_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
string book_id = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY];
string uid = 3 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY];
}
```

Expand Down
12 changes: 6 additions & 6 deletions docs/rules/0131/request-path-behavior.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ rule:
aep: 131
name: [core, '0131', request-path-behavior]
summary: |
Get RPCs should annotate the `path` field with `google.api.field_behavior`.
Get RPCs should annotate the `path` field with `aep.api.field_behavior`.
permalink: /131/request-path-behavior
redirect_from:
- /0131/request-path-behavior
Expand All @@ -12,14 +12,14 @@ redirect_from:
# Get methods: Field behavior

This rule enforces that all `Get` standard methods have
`google.api.field_behavior` set to `REQUIRED` on their `string path` field, as
`aep.api.field_behavior` set to `FIELD_BEHAVIOR_REQUIRED` on their `string path` field, as
mandated in [AEP-131][].

## Details

This rule looks at any message matching `Get*Request` and complains if the
`path` field does not have a `google.api.field_behavior` annotation with a
value of `REQUIRED`.
`path` field does not have a `aep.api.field_behavior` annotation with a
value of `FIELD_BEHAVIOR_REQUIRED`.

## Examples

Expand All @@ -28,7 +28,7 @@ value of `REQUIRED`.
```proto
// Incorrect.
message GetBookRequest {
// The `google.api.field_behavior` annotation should also be included.
// The `aep.api.field_behavior` annotation should also be included.
string path = 1 [(google.api.resource_reference) = {
type: "library.googleapis.com/Book"
}];
Expand All @@ -41,7 +41,7 @@ message GetBookRequest {
// Correct.
message GetBookRequest {
string path = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference).type = "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 @@ -32,7 +32,7 @@ message GetBookRequest {
// The `google.api.resource_reference` annotation should be a direct `type`
// reference.
string path = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference).child_type = "library.googleapis.com/Book"
];
}
Expand All @@ -44,7 +44,7 @@ message GetBookRequest {
// Correct.
message GetBookRequest {
string path = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference).type = "library.googleapis.com/Book"
];
}
Expand All @@ -60,7 +60,7 @@ message GetBookRequest {
// (-- api-linter: core::0131::request-path-reference-type=disabled
// aep.dev/not-precedent: We need to do this because reasons. --)
string path = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference).child_type = "library.googleapis.com/Book"
];
}
Expand Down
6 changes: 3 additions & 3 deletions docs/rules/0131/request-path-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ complains if it does not have a `google.api.resource_reference` annotation.
// Incorrect.
message GetBookRequest {
// The `google.api.resource_reference` annotation should also be included.
string path = 1 [(google.api.field_behavior) = REQUIRED];
string path = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];
}
```

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

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 @@ -26,7 +26,7 @@ the `path` field is missing.
// Incorrect.
message GetBookRequest {
string book = 1 [ // Field path should be `path`.
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference).type = "library.googleapis.com/Book"
];
}
Expand All @@ -38,7 +38,7 @@ message GetBookRequest {
// Correct.
message GetBookRequest {
string path = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference).type = "library.googleapis.com/Book"
];
}
Expand All @@ -54,7 +54,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why.
// aep.dev/not-precedent: This is named "book" for historical reasons. --)
message GetBookRequest {
string book = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference).type = "library.googleapis.com/Book"
];
}
Expand Down
12 changes: 6 additions & 6 deletions docs/rules/0131/request-required-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ message GetBookRequest {
// The path of the book to retrieve.
// Format: publishers/{publisher}/books/{book}
string path = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference) = {
type: "library.googleapis.com/Book"
}];

// Non-standard required field.
google.protobuf.FieldMask read_mask = 2 [(google.api.field_behavior) = REQUIRED];
google.protobuf.FieldMask read_mask = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];
}
```

Expand All @@ -48,12 +48,12 @@ message GetBookRequest {
// The path of the book to retrieve.
// Format: publishers/{publisher}/books/{book}
string path = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference) = {
type: "library.googleapis.com/Book"
}];

google.protobuf.FieldMask read_mask = 2 [(google.api.field_behavior) = OPTIONAL];
google.protobuf.FieldMask read_mask = 2 [(aep.api.field_info).field_behavior = OPTIONAL];
}
```

Expand All @@ -67,15 +67,15 @@ message GetBookRequest {
// The path of the book to retrieve.
// Format: publishers/{publisher}/books/{book}
string path = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference) = {
type: "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
// reasons. --)
google.protobuf.FieldMask read_mask = 2 [(google.api.field_behavior) = REQUIRED];
google.protobuf.FieldMask read_mask = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];
}
```

Expand Down
12 changes: 6 additions & 6 deletions docs/rules/0132/request-parent-behavior.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ rule:
aep: 132
name: [core, '0132', request-parent-behavior]
summary: |
List RPCs should annotate the `parent` field with `google.api.field_behavior`.
List RPCs should annotate the `parent` field with `aep.api.field_behavior`.
permalink: /132/request-parent-behavior
redirect_from:
- /0132/request-parent-behavior
Expand All @@ -12,14 +12,14 @@ redirect_from:
# List methods: Field behavior

This rule enforces that all `List` standard methods have
`google.api.field_behavior` set to `REQUIRED` on their `string parent` field,
`aep.api.field_behavior` set to `FIELD_BEHAVIOR_REQUIRED` on their `string parent` field,
as mandated in [AEP-132][].

## Details

This rule looks at any message matching `List*Request` and complains if the
`parent` field does not have a `google.api.field_behavior` annotation with a
value of `REQUIRED`.
`parent` field does not have a `aep.api.field_behavior` annotation with a
value of `FIELD_BEHAVIOR_REQUIRED`.

## Examples

Expand All @@ -28,7 +28,7 @@ value of `REQUIRED`.
```proto
// Incorrect.
message ListBooksRequest {
// The `google.api.field_behavior` annotation should also be included.
// The `aep.api.field_behavior` annotation should also be included.
string parent = 1 [(google.api.resource_reference) = {
type: "library.googleapis.com/Publisher"
}];
Expand All @@ -43,7 +43,7 @@ message ListBooksRequest {
// Correct.
message ListBooksRequest {
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference).type = "library.googleapis.com/Publisher"
];
int32 page_size = 2;
Expand Down
6 changes: 3 additions & 3 deletions docs/rules/0132/request-parent-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ and complains if it does not have a `google.api.resource_reference` annotation.
// Incorrect.
message ListBooksRequest {
// The `google.api.resource_reference` annotation should also be included.
string parent = 1 [(google.api.field_behavior) = REQUIRED];
string parent = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];
int32 page_size = 2;
string page_token = 3;
}
Expand All @@ -40,7 +40,7 @@ message ListBooksRequest {
// Correct.
message ListBooksRequest {
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference).type = "library.googleapis.com/Publisher"
];
int32 page_size = 2;
Expand All @@ -57,7 +57,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why.
// (-- api-linter: core::0132::request-parent-reference=disabled
// aep.dev/not-precedent: We need to do this because reasons. --)
message ListBooksRequest {
string parent = 1 [(google.api.field_behavior) = REQUIRED];
string parent = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];
}
```

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 @@ -32,7 +32,7 @@ message ListBooksRequest {
// The `google.api.resource_reference` should not reference the resource
// being listed.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference).type = "library.googleapis.com/Book"
];
int32 page_size = 2;
Expand All @@ -46,7 +46,7 @@ message ListBooksRequest {
// Correct.
message ListBooksRequest {
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference).child_type = "library.googleapis.com/Book"
];
int32 page_size = 2;
Expand All @@ -64,7 +64,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why.
// aep.dev/not-precedent: We need to do this because reasons. --)
message ListBooksRequest {
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference).type = "library.googleapis.com/Book"
];
}
Expand Down
12 changes: 6 additions & 6 deletions docs/rules/0132/request-required-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ message ListBooksRequest {
// The parent, which owns this collection of books.
// Format: publishers/{publisher}
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference) = {
child_type: "library.googleapis.com/Book"
}];

// Non-standard required field.
int32 page_size = 2 [(google.api.field_behavior) = REQUIRED]
int32 page_size = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]
}
```

Expand All @@ -48,12 +48,12 @@ message ListBooksRequest {
// The parent, which owns this collection of books.
// Format: publishers/{publisher}
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference) = {
child_type: "library.googleapis.com/Book"
}];

int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]
int32 page_size = 2 [(aep.api.field_info).field_behavior = OPTIONAL]
}
```

Expand All @@ -67,15 +67,15 @@ message ListBooksRequest {
// The parent, which owns this collection of books.
// Format: publishers/{publisher}
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.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
// reasons. --)
int32 page_size = 2 [(google.api.field_behavior) = REQUIRED]
int32 page_size = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]
}
```

Expand Down
Loading
Loading