| rule |
|
|||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| permalink | /131/request-path-reference | |||||||||
| redirect_from |
|
This rule enforces that all Get standard methods have
(aep.api.field_info).resource_reference on their string path field, as mandated in
AEP-131.
This rule looks at the path field of any message matching Get*Request and
complains if it does not have a (aep.api.field_info).resource_reference annotation.
Incorrect code for this rule:
// Incorrect.
message GetBookRequest {
// The `(aep.api.field_info).resource_reference` annotation should also be included.
string path = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];
}Correct code for this rule:
// Correct.
message GetBookRequest {
string path = 1 [
(aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED,
(aep.api.field_info).resource_reference = "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-reference=disabled
// aep.dev/not-precedent: We need to do this because reasons. --)
string path = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];
}If you need to violate this rule for an entire file, place the comment at the top of the file.