This rule enforces that methods returning long-running operations define their
metadata messages in the same file or a directly-imported file, as mandated in
AEP-151.
Details
This rule looks at any method with a return type of
google.longrunning.Operation, and complains if the message designated by the
metadata_type field are not defined in the same file, or a file directly
imported by the file.
Because these message names are strings, and a string reference does not
require an import statement, defining the metadata types elsewhere can cause
problems for tooling. To prevent this, and also to maintain consistency with
the file layout in AEP-191, the linter complains if the message is not
defined in the same file or a file directly imported by the file.
Examples
Incorrect code for this rule:
In library_service.proto:
In operations.proto:
Correct code for this rule:
Same file:
Separate files:
In library_service.proto:
In operations.proto:
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.
LRO metadata type
LRO metadata type
This rule enforces that methods returning long-running operations specify a
metadata type in the google.longrunning.operation_info annotation, as
mandated in AEP-151.
Details
This rule looks at any method with a return type of
google.longrunning.Operation, and complains if the metadata_type field
google.longrunning.operation_info annotation is not present.
Additionally, it complains if the metadata type is set to
google.protobuf.Empty, and recommends making an blank message instead, to
permit future extensibility.
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.
LRO- Reachable response types
LRO: Reachable response types
This rule enforces that methods returning long-running operations define their
response messages in the same file or a directly-imported file, as mandated in
AEP-151.
Details
This rule looks at any method with a return type of
google.longrunning.Operation, and complains if the message designated by the
response_type field are not defined in the same file, or a file directly
imported by the file.
Because these message names are strings, and a string reference does not
require an import statement, defining the response types elsewhere can cause
problems for tooling. To prevent this, and also to maintain consistency with
the file layout in AEP-191, the linter complains if the message is not
defined in the same file or a file directly imported by the file.
Examples
Incorrect code for this rule:
In library_service.proto:
In operations.proto:
Correct code for this rule:
Same file:
Separate files:
In library_service.proto:
In operations.proto:
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.
LRO response type
LRO response type
This rule enforces that methods returning long-running operations specify a
response type in the google.longrunning.operation_info annotation, as
mandated in AEP-151.
Details
This rule looks at any method with a return type of
google.longrunning.Operation, and complains if the response_type field
google.longrunning.operation_info annotation is not present.
Additionally, it complains if the response type is set to
google.protobuf.Empty, and recommends making an blank message instead, to
permit future extensibility. However, methods with names beginning with
Delete are exempt from this check (see 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 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.
Long-running operation info
Long-running operation info
This rule enforces that methods returning long-running operations include an
annotation specifying their response type and metadata type, as mandated in
AEP-151.
Details
This rule looks at any method with a return type of
google.longrunning.Operation, and complains if the
google.longrunning.operation_info annotation is not 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.
Paginated methods- Unary responses
Paginated methods: Unary responses
This rule enforces that all long-running operation methods use unary responses,
as mandated in AEP-151.
Details
This rule looks at any message returning a google.longrunning.Operation, and
complains if the method uses gRPC server streaming (the stream keyword).
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 or
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.