AEP-0127 Linter Rules
HTTP URI case
HTTP URI case
This rule enforces that the HTTP annotation is present on all non-bidi-streaming methods and absent on streaming methods, as mandated in AEP-127.
Details
This rule scans all methods that a google.api.http
annotation is present on
all non-streaming methods, as well as methods that only use streaming in one
direction. It complains if an annotation is not found.
For bidi-streaming methods, it complains if a google.api.http
annotation is
found.
Examples
Unary methods
Incorrect code for this rule:
Correct code for this rule:
Bidi-streaming methods
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.
HTTP Pattern Variables
HTTP Pattern Variables
This rule enforces that any HTTP annotations that reference a resource must match one of the pattern strings defined by that resource, as mandated in AEP-127.
Details
This rule ensures that google.api.http
path template variables that represent
a resource path match one of the resource path patterns of the resource that the
field being referenced represents.
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.
HTTP Pattern Variables
HTTP Pattern Variables
This rule enforces that HTTP annotation patterns follow the path template syntax rules, as mandated in AEP-127.
Details
This rule ensures that google.api.http
patterns adhere to the following
syntax rules.
Examples
Incorrect code for this rule:
Incorrect code for this rule:
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.
HTTP URI case
HTTP URI case
This rule enforces that HTTP annotations pull whole resource paths into variables, and not just the ID components, as mandated in AEP-127.
Details
This rule scans all methods and complains if it finds a URI with a variable
whose value is *
.
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.
URI Forward Slashes
URI Forward Slashes
This rule enforces that URIs must begin with a forward slash, as mandated in AEP-127.
Details
This rule scans all methods and complains if it finds a URI that does not start
with /
.
Examples
Incorrect code for this rule:
Correct code for this rule:
Disabling
Do not violate this rule. This would create an invalid URL.