| rule |
|
|||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| permalink | /131/request-path-behavior | |||||||||
| redirect_from |
|
This rule enforces that all Get standard methods have
aep.api.field_behavior set to FIELD_BEHAVIOR_REQUIRED on their string path field, as
mandated in AEP-131.
This rule looks at any message matching Get*Request and complains if the
path field does not have a aep.api.field_behavior annotation with a
value of FIELD_BEHAVIOR_REQUIRED.
Incorrect code for this rule:
// Incorrect.
message GetBookRequest {
// The `aep.api.field_behavior` annotation should also be included.
string path = 1 [(google.api.resource_reference) = {
type: "library.googleapis.com/Book"
}];
}Correct code for this rule:
// Correct.
message GetBookRequest {
string path = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(google.api.resource_reference).type = "library.googleapis.com/Book"
];
}If you need to violate this rule, use a leading comment above the field. 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 [(google.api.resource_reference) = {
type: "library.googleapis.com/Book"
}];
}If you need to violate this rule for an entire file, place the comment at the top of the file.