AEP-0135 Linter Rules
Delete methods- force field
Delete methods: force
field
This rule enforces that the standard Delete
method for a resource that parents
other resources in the service have a bool force
field in the request message,
as mandated in AEP-135.
Details
This rule looks at any message matching Delete*Request
for a resource with
child resources in the same service and complains if the force
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 (if
the path
field is missing) or above the field (if it is the wrong type).
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.
Delete methods- No HTTP body
Delete methods: No HTTP body
This rule enforces that all Delete
RPCs omit the HTTP body
, as mandated in
AEP-135.
Details
This rule looks at any message matching beginning with Delete
, 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.
If you need to violate this rule for an entire file, place the comment at the top of the file.
Delete methods- DELETE HTTP verb
Delete methods: DELETE HTTP verb
This rule enforces that all Delete
RPCs use the DELETE
HTTP verb, as
mandated in AEP-135.
Details
This rule looks at any message matching beginning with Delete
, and complains
if the HTTP verb is anything other than DELETE
. 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.
Delete methods- HTTP URI path field
Delete methods: HTTP URI path field
This rule enforces that all Delete
RPCs map the path
field to the HTTP URI,
as mandated in AEP-135.
Details
This rule looks at any message matching beginning with Delete
, and complains
if the path
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.
Delete methods- Method signature
Delete methods: Method signature
This rule enforces that all Delete
standard methods have a
google.api.method_signature
annotation with a value of "path"
, as mandated
in AEP-135.
Details
This rule looks at any method beginning with Delete
, and complains if the
google.api.method_signature
annotation is missing, or if it is set to any
value other than "path"
. 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.
Delete requests- force field
Delete requests: force field
This rule enforces that all Delete
request force
fields have type bool
, as
mandated in AEP-135.
Details
This rule looks at any message matching Delete*Request
that contains a force
field and complains if the field is not a singular bool
.
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.
Delete methods- Request message
Delete methods: Request message
This rule enforces that all Delete
RPCs have a request message name of
Delete*Request
, as mandated in AEP-135.
Details
This rule looks at any message matching beginning with Delete
, 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.
Delete methods- Field behavior
Delete methods: Field behavior
This rule enforces that all Delete
standard methods have
google.api.field_behavior
set to REQUIRED
on their string path
field, as
mandated in AEP-135.
Details
This rule looks at any message matching Delete*Request
and complains if the
path
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.
Delete methods- path field
Delete methods: path field
This rule enforces that all Delete
standard methods have a string path
field in the request message, as mandated in AEP-135.
Details
This rule looks at any message matching Delete*Request
and complains if
either the path
field is missing, or if it 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 message (if
the path
field is missing) or above the field (if it is the wrong type).
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.
Delete methods- Resource reference
Delete methods: Resource reference
This rule enforces that all Delete
standard methods have
google.api.resource_reference
on their string path
field, as mandated in
AEP-135.
Details
This rule looks at the path
field of any message matching Delete*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.
Delete methods- Name field
Delete methods: Name field
This rule enforces that all Delete
standard methods have a string path
field in the request message, as mandated in AEP-135.
Details
This rule looks at any message matching Delete*Request
and complains if
the path
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.
Delete methods- Required fields
Delete methods: Required fields
This rule enforces that all Delete
standard methods do not have unexpected
required fields, as mandated in AEP-135.
Details
This rule looks at any message matching Delete*Request
and complains if it
comes across any required fields other than:
string path
(AEP-135)
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.
Delete methods- Unknown fields
Delete methods: Unknown fields
This rule enforces that all Delete
standard methods do not have unexpected
fields, as mandated in AEP-135.
Details
This rule looks at any message matching Delete*Request
and complains if it
comes across any fields other than:
string path
(AEP-135)bool allow_missing
(AEP-135)bool force
(AEP-135)string etag
(AEP-154)string request_id
(AEP-155)bool validate_only
(AEP-163)
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.
Long-running Delete
Long-running Delete
This rule enforces that declarative-friendly delete methods use long-running operations, as mandated in AEP-135.
Details
This rule looks at any Delete
method connected to a resource with a
google.api.resource
annotation that includes style: DECLARATIVE_FRIENDLY
,
and complains if it does not use long-running operations.
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.
Note: Violations of declarative-friendly rules should be rare, as tools are likely to expect strong consistency.
If you need to violate this rule for an entire file, place the comment at the top of the file.
Delete methods- Response message
Delete methods: Response message
This rule enforces that all Delete
RPCs have a response message of
google.protobuf.Empty
or the resource, as mandated in AEP-135.
Details
This rule looks at any message matching beginning with Delete
, and complains
if the name of the corresponding output message is not one of:
google.protobuf.Empty
- The name of the RPC with the prefix
Delete
removed.
It also permits a response of google.longrunning.Operation
; in this case, it
checks the response_type
in the google.longrunning.operation_info
annotation and ensures that it corresponds to either google.protobuf.Empty
or the name of the RPC with the prefix Delete
removed.
Examples
Standard
Incorrect code for this rule:
Correct code for this rule:
Important: For declarative-friendly resources, only the resource is permitted as a return type (and therefore only the second example is valid).
Long-running operation
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.