AEP-0132 Linter Rules
List methods- No HTTP body
List methods: No HTTP body
This rule enforces that all List
RPCs omit the HTTP body
, as mandated in
AEP-132.
Details
This rule looks at any message beginning with List
, and complains if
the HTTP body
field is set.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the method. Remember to also include an aep.dev/not-precedent comment explaining why.
Important: HTTP GET
requests are unable to have an HTTP body, due to the
nature of the protocol. The only valid way to include a body is to also use a
different HTTP method (as depicted above).
If you need to violate this rule for an entire file, place the comment at the top of the file.
List methods- GET HTTP verb
List methods: GET HTTP verb
This rule enforces that all List
RPCs use the GET
HTTP verb, as mandated in
AEP-132.
Details
This rule looks at any message beginning with List
, and complains if
the HTTP verb is anything other than GET
. It does check additional bindings
if they are present.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the method. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
List methods- HTTP URI parent field
List methods: HTTP URI parent field
This rule enforces that all List
RPCs map the parent
field to the HTTP
URI, as mandated in AEP-132.
Details
This rule looks at any message beginning with List
, and complains
if the parent
variable is not included in the URI. It does check additional
bindings if they are present.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the method. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
List methods- Method signature
List methods: Method signature
This rule enforces that all List
standard methods have a
google.api.method_signature
annotation with a value of "parent"
, as
mandated in AEP-132.
Details
This rule looks at any method beginning with List
, and complains if the
google.api.method_signature
annotation is missing, or if it is set to any
value other than "parent"
. Additional method signatures, if present, are
ignored.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the method. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
List methods- Unknown fields
List methods: Unknown fields
This rule enforces that all List
standard methods use the correct type for
any optional fields described in AEP-132.
Details
This rule looks at the fields in any message matching List*Request
and
complains if finds fields with the names below that do not have the correct
type:
string filter
string order_by
bool show_deleted
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
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.
If you need to violate this rule for an entire file, place the comment at the top of the file.
List methods- Request message
List methods: Request message
This rule enforces that all List
RPCs have a request message name of
List*Request
, as mandated in AEP-132.
Details
This rule looks at any message matching beginning with List
, and complains if
the name of the corresponding input message does not match the name of the RPC
with the suffix Request
appended.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the method. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
List methods- Field behavior
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,
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
.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
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.
If you need to violate this rule for an entire file, place the comment at the top of the file.
List methods- Parent field
List methods: Parent field
This rule enforces that all List
standard methods have a string parent
field in the request message, as mandated in AEP-132.
Details
This rule looks at any message matching List*Request
and complains if the
parent
field has any type other than string
.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
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.
If you need to violate this rule for an entire file, place the comment at the top of the file.
List methods- Resource reference
List methods: Resource reference
This rule enforces that all List
standard methods have
google.api.resource_reference
on their string parent
field, as mandated in
AEP-132.
Details
This rule looks at the parent
field of any message matching List*Request
and complains if it does not have a google.api.resource_reference
annotation.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
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.
If you need to violate this rule for an entire file, place the comment at the top of the file.
List methods- Parent field
List methods: Parent field
This rule enforces that all List
standard methods have a string parent
field in the request message, as mandated in AEP-132.
Details
This rule looks at any message matching List*Request
and complains if
the parent
field is missing.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the message. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
List methods- Resource reference
List methods: Resource reference
This rule enforces that all List
standard methods reference a resource other
than the resource being listed with the google.api.resource_reference
on
their string parent
field, as mandated in AEP-132.
Details
This rule looks at the parent
field of any message matching List*Request
and complains if the google.api.resource_reference
annotation references
the resource being listed.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
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.
If you need to violate this rule for an entire file, place the comment at the top of the file.
List methods- Required fields
List methods: Required fields
This rule enforces that all List
standard methods do not have unexpected
required fields, as mandated in AEP-132.
Details
This rule looks at any message matching List*Request
and complains if it
comes across any required fields other than:
string parent
(AEP-132)
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
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.
If you need to violate this rule for an entire file, place the comment at the top of the file.
List methods- show_deleted field
List methods: show_deleted
field
This rule enforces that all List
standard methods have a bool show_deleted
field in the request message if the resource supports soft delete, as mandated
in AEP-132.
Details
This rule looks at any message matching List*Request
and complains if the
show_deleted
field is missing and the corresponding resource has an
Undelete
method.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the message. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
List methods- Unknown fields (Request)
List methods: Unknown fields (Request)
This rule enforces that all List
standard methods do not have unexpected
fields, as mandated in AEP-132.
Details
This rule looks at any message matching List*Request
and complains if it
comes across any fields other than:
string parent
(AEP-132)int32 max_page_size
(AEP-158)string page_token
(AEP-158)int32 skip
(AEP-158)string filter
(AEP-132)string order_by
(AEP-132)bool show_deleted
(AEP-132)string request_id
(AEP-155)google.protobuf.FieldMask read_mask
(AEP-157)View view
(AEP-157)
It only checks field names; it does not validate type correctness. This is handled by other rules, such as request field types.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
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.
If you need to violate this rule for an entire file, place the comment at the top of the file.
List methods- Parent field resource reference
List methods: Parent field resource reference
This rule enforces that all List
standard methods with a string parent
field use a proper google.api.resource_reference
, that being either a
child_type
referring to the pagianted resource or a type
referring directly
to the parent resource, as mandated in AEP-132.
Details
This rule looks at any message matching List*Request
and complains if the
google.api.resource_reference
on the parent
field refers to the wrong
resource.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
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.
If you need to violate this rule for an entire file, place the comment at the top of the file.
List methods- Response message
List methods: Response message
This rule enforces that all List
RPCs have a response message name of
List*Response
, as mandated in AEP-132.
Details
This rule looks at any message matching beginning with List
, and complains if
the name of the corresponding returned message does not match the name of the
RPC with the suffix Response
appended.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
If you need to violate this rule, use a leading comment above the method. Remember to also include an aep.dev/not-precedent comment explaining why.
If you need to violate this rule for an entire file, place the comment at the top of the file.
List methods- Unknown fields (Response)
List methods: Unknown fields (Response)
This rule enforces that all List
standard methods do not have unexpected
fields, as mandated in AEP-132.
Details
This rule looks at any message matching List*Response
and complains if it
comes across any fields other than:
- The resource.
int32/int64 total_size
(AEP-132)string next_page_token
(AEP-158)repeated string unavailable
([AEP-217][])
It only checks field names; it does not validate type correctness or repeated-ness.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
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.
If you need to violate this rule for an entire file, place the comment at the top of the file.