AEP-0162 Linter Rules
Commit methods- HTTP body
Commit methods: HTTP body
This rule enforces that all Commit
RPCs use *
as the HTTP body
, as mandated in
AEP-162.
Details
This rule looks at any method beginning with Commit
, and complains
if the HTTP body
field is anything other than *
.
Examples
Incorrect code for this rule:
// Incorrect.rpc CommitBook(CommitBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:commit" // body: "*" should be set. };}
Correct code for this rule:
// Correct.rpc CommitBook(CommitBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:commit" body: "*" };}
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.
// (-- api-linter: core::0162::commit-http-body=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc CommitBook(CommitBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:commit" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Commit methods- POST HTTP verb
Commit methods: POST HTTP verb
This rule enforces that all Commit
RPCs use the POST
HTTP verb, as
mandated in AEP-162.
Details
This rule looks at any method beginning with Commit
, and complains
if the HTTP verb is anything other than POST
. It does check additional
bindings if they are present.
Examples
Incorrect code for this rule:
// Incorrect.rpc CommitBook(CommitBookRequest) returns (Book) { option (google.api.http) = { get: "/v1/{name=publishers/*/books/*}:commit" // Should be `post:`. };}
Correct code for this rule:
// Correct.rpc CommitBook(CommitBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:commit" body: "*" };}
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.
// (-- api-linter: core::0162::commit-http-method=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc CommitBook(CommitBookRequest) returns (Book) { option (google.api.http) = { get: "/v1/{name=publishers/*/books/*}:commit" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Commit methods- URI suffix
Commit methods: URI suffix
This rule enforces that Commit
methods include the :commit
suffix
in the REST URI, as mandated in AEP-162.
Details
This rule looks at any method beginning with Commit
, and
complains if the HTTP URI does not end with :commit
.
Examples
Incorrect code for this rule:
// Incorrect.rpc CommitBook(CommitBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:save" // Should end with `:commit` body: "*" };}
Correct code for this rule:
// Correct.rpc CommitBook(CommitBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:commit" body: "*" };}
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.
// (-- api-linter: core::0162::commit-http-uri-suffix=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc Commit(CommitBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:save" body: "*" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Commit methods- Request message
Commit methods: Request message
This rule enforces that all Commit
RPCs have a request message name of
Commit*Request
, as mandated in AEP-162.
Details
This rule looks at any method beginning with Commit
, 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:
// Incorrect.// Should be `CommitBookRequest`.rpc CommitBook(SaveBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:commit" body: "*" };}
Correct code for this rule:
// Correct.rpc CommitBook(CommitBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:commit" body: "*" };}
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.
// (-- api-linter: core::0162::commit-request-message-name=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc CommitBook(SaveBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:commit" body: "*" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Commit requests- Name field behavior
Commit requests: Name field behavior
This rule enforces that all Commit
requests have
google.api.field_behavior
set to REQUIRED
on their string name
field, as
mandated in AEP-162.
Details
This rule looks at any message matching Commit*Request
and complains if the
name
field does not have a google.api.field_behavior
annotation with a
value of REQUIRED
.
Examples
Incorrect code for this rule:
// Incorrect.message CommitBookRequest { // The `google.api.field_behavior` annotation should also be included. string name = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Book" ];}
Correct code for this rule:
// Correct.message CommitBookRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];}
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.
message CommitBookRequest { // (-- api-linter: core::0162::commit-request-name-behavior=disabled // aep.dev/not-precedent: We need to do this because reasons. --) string name = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Book" ];}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Commit requests- Name field
Commit requests: Name field
This rule enforces that all Commit
methods have a string name
field in the request message, as mandated in AEP-162.
Details
This rule looks at any message matching Commit*Request
and complains if
either the name
field is missing or it has any type other than string
.
Examples
Incorrect code for this rule:
// Incorrect.// Should include a `string name` field.message CommitBookRequest {}
// Incorrect.message CommitBookRequest { // Field type should be `string`. bytes name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];}
Correct code for this rule:
// Correct.message CommitBookRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];}
Disabling
If you need to violate this rule, use a leading comment above the message (if
the name
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.
message CommitBookRequest { // (-- api-linter: core::0162::commit-request-name-field=disabled // aep.dev/not-precedent: We need to do this because reasons. --) bytes name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Commit requests- Name resource reference
Commit requests: Name resource reference
This rule enforces that all Commit
requests have
google.api.resource_reference
on their string name
field, as mandated in
AEP-162.
Details
This rule looks at the name
field of any message matching Commit*Request
and complains if it does not have a google.api.resource_reference
annotation.
Examples
Incorrect code for this rule:
// Incorrect.message CommitBookRequest { // The `google.api.resource_reference` annotation should also be included. string name = 1 [(google.api.field_behavior) = REQUIRED];}
Correct code for this rule:
// Correct.message CommitBookRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];}
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.
message CommitBookRequest { // (-- api-linter: core::0162::commit-request-name-reference=disabled // aep.dev/not-precedent: We need to do this because reasons. --) string name = 1 [(google.api.field_behavior) = REQUIRED];}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Commit methods- Response message
Commit methods: Response message
This rule enforces that all Commit
RPCs have a response message of the
resource, as mandated in AEP-162.
Details
This rule looks at any method beginning with Commit
, and complains
if the name of the corresponding output message does not match the name of the
RPC with the prefix Commit
removed.
Examples
Incorrect code for this rule:
// Incorrect.// Should return `Book`.rpc CommitBook(CommitBookRequest) returns (CommitBookResponse) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:commit" body: "*" };}
Correct code for this rule:
// Correct.rpc CommitBook(CommitBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:commit" body: "*" };}
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.
// (-- api-linter: core::0162::commit-response-message-name=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc CommitBook(CommitBookRequest) returns (CommitBookResponse) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:commit" body: "*" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Delete Revision methods- HTTP body
Delete Revision methods: HTTP body
This rule enforces that all Delete Revision RPCs have no HTTP body
, as mandated in
AEP-162.
Details
This rule looks at any method matching Delete*Revision
, and complains
if it has an HTTP body
.
Examples
Incorrect code for this rule:
// Incorrect.rpc DeleteBookRevision(DeleteBookRevisionRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{name=publishers/*/books/*}:deleteRevision" body: "*" // This should be removed. };}
Correct code for this rule:
// Correct.rpc DeleteBookRevision(DeleteBookRevisionRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{name=publishers/*/books/*}:deleteRevision" };}
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.
// (-- api-linter: core::0162::delete-revision-http-body=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc DeleteBookRevision(DeleteBookRevisionRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{name=publishers/*/books/*}:deleteRevision" body: "*" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Delete Revision methods- POST HTTP verb
Delete Revision methods: POST HTTP verb
This rule enforces that all Delete Revision RPCs use the DELETE
HTTP verb, as
mandated in AEP-162.
Details
This rule looks at any method matching Delete*Revision
, 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:
// Incorrect.rpc DeleteBookRevision(DeleteBookRevisionRequest) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:deleteRevision" // Should be `delete:`. };}
Correct code for this rule:
// Correct.rpc DeleteBookRevision(DeleteBookRevisionRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{name=publishers/*/books/*}:deleteRevision" };}
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.
// (-- api-linter: core::0162::delete-revision-http-method=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc DeleteBookRevision(DeleteBookRevisionRequest) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:deleteRevision" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Delete Revision methods- URI suffix
Delete Revision methods: URI suffix
This rule enforces that Delete Revision methods include the :deleteRevision
suffix
in the REST URI, as mandated in AEP-162.
Details
This rule looks at any method matching Delete*Revision
, and
complains if the HTTP URI does not end with :deleteRevision
.
Examples
Incorrect code for this rule:
// Incorrect.rpc DeleteBookRevision(DeleteBookRevisionRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{name=publishers/*/books/*}:delete" // Should end with `:deleteRevision` };}
Correct code for this rule:
// Correct.rpc DeleteBookRevision(DeleteBookRevisionRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{name=publishers/*/books/*}:deleteRevision" };}
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.
// (-- api-linter: core::0162::delete-revision-http-uri-suffix=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc DeleteBookRevision(DeleteBookRevisionRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{name=publishers/*/books/*}:delete" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Delete Revision methods- Request message
Delete Revision methods: Request message
This rule enforces that all Delete Revision RPCs have a request message name of
Delete*RevisionRequest
, as mandated in AEP-162.
Details
This rule looks at any method matching Delete*Revision
, 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:
// Incorrect.// Should be `DeleteBookRevisionRequest`.rpc DeleteBookRevision(DeleteBookRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{name=publishers/*/books/*}:deleteRevision" };}
Correct code for this rule:
// Correct.rpc DeleteBookRevision(DeleteBookRevisionRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{name=publishers/*/books/*}:deleteRevision" };}
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.
// (-- api-linter: core::0162::delete-revision-request-message-name=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc DeleteBookRevision(DeleteBookRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{name=publishers/*/books/*}:deleteRevision" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Delete Revision requests- Name field behavior
Delete Revision requests: Name field behavior
This rule enforces that all Delete Revision requests have
google.api.field_behavior
set to REQUIRED
on their string name
field, as
mandated in AEP-162.
Details
This rule looks at any message matching Delete*RevisionRequest
and complains if the
name
field does not have a google.api.field_behavior
annotation with a
value of REQUIRED
.
Examples
Incorrect code for this rule:
// Incorrect.message DeleteBookRevisionRequest { // The `google.api.field_behavior` annotation should also be included. string name = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Book" ];}
Correct code for this rule:
// Correct.message DeleteBookRevisionRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];}
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.
message DeleteBookRevisionRequest { // (-- api-linter: core::0162::delete-revision-request-name-behavior=disabled // aep.dev/not-precedent: We need to do this because reasons. --) string name = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Book" ];}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Delete Revision requests- Name field
Delete Revision requests: Name field
This rule enforces that all Delete Revision methods have a string name
field in the request message, as mandated in AEP-162.
Details
This rule looks at any message matching Delete*RevisionRequest
and complains if
either the name
field is missing or it has any type other than string
.
Examples
Incorrect code for this rule:
// Incorrect.// Should include a `string name` field.message DeleteBookRevisionRequest {}
// Incorrect.message DeleteBookRevisionRequest { // Field type should be `string`. bytes name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];}
Correct code for this rule:
// Correct.message DeleteBookRevisionRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];}
Disabling
If you need to violate this rule, use a leading comment above the message (if
the name
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.
message DeleteBookRevisionRequest { // (-- api-linter: core::0162::delete-revision-request-name-field=disabled // aep.dev/not-precedent: We need to do this because reasons. --) bytes name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Delete Revision requests- Name resource reference
Delete Revision requests: Name resource reference
This rule enforces that all Delete Revision requests have
google.api.resource_reference
on their string name
field, as mandated in
AEP-162.
Details
This rule looks at the name
field of any message matching Delete*RevisionRequest
and complains if it does not have a google.api.resource_reference
annotation.
Examples
Incorrect code for this rule:
// Incorrect.message DeleteBookRevisionRequest { // The `google.api.resource_reference` annotation should also be included. string name = 1 [(google.api.field_behavior) = REQUIRED];}
Correct code for this rule:
// Correct.message DeleteBookRevisionRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];}
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.
message DeleteBookRevisionRequest { // (-- api-linter: core::0162::delete-revision-request-name-reference=disabled // aep.dev/not-precedent: We need to do this because reasons. --) string name = 1 [(google.api.field_behavior) = REQUIRED];}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Delete Revision methods- Response message
Delete Revision methods: Response message
This rule enforces that all Delete Revision RPCs have a response message of the resource, as mandated in AEP-162.
Details
This rule looks at any message matching Delete*Revision
, and complains
if the corresponding output message does not match the name of the RPC with the
prefix Delete
and suffix Revision
removed.
Examples
Incorrect code for this rule:
// Incorrect.// Should return `Book`.rpc DeleteBookRevision(DeleteBookRevisionRequest) returns (DeleteBookRevisionResponse) { option (google.api.http) = { delete: "/v1/{name=publishers/*/books/*}:deleteRevision" };}
Correct code for this rule:
// Correct.rpc DeleteBookRevision(DeleteBookRevisionRequest) returns (Book) { option (google.api.http) = { delete: "/v1/{name=publishers/*/books/*}:deleteRevision" };}
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.
// (-- api-linter: core::0162::delete-revision-response-message-name=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc DeleteBookRevision(DeleteBookRevisionRequest) returns (DeleteBookRevisionResponse) { option (google.api.http) = { delete: "/v1/{name=publishers/*/books/*}:deleteRevision" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Rollback methods- HTTP body
Rollback methods: HTTP body
This rule enforces that all Rollback
RPCs use *
as the HTTP body
, as mandated in
AEP-162.
Details
This rule looks at any method beginning with Rollback
, and complains
if the HTTP body
field is anything other than *
.
Examples
Incorrect code for this rule:
// Incorrect.rpc RollbackBook(RollbackBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:rollback" // body: "*" should be set. };}
Correct code for this rule:
// Correct.rpc RollbackBook(RollbackBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:rollback" body: "*" };}
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.
// (-- api-linter: core::0162::rollback-http-body=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc RollbackBook(RollbackBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:rollback" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Rollback methods- POST HTTP verb
Rollback methods: POST HTTP verb
This rule enforces that all Rollback
RPCs use the POST
HTTP verb, as
mandated in AEP-162.
Details
This rule looks at any method beginning with Rollback
, and complains
if the HTTP verb is anything other than POST
. It does check additional
bindings if they are present.
Examples
Incorrect code for this rule:
// Incorrect.rpc RollbackBook(RollbackBookRequest) returns (Book) { option (google.api.http) = { get: "/v1/{name=publishers/*/books/*}:rollback" // Should be `post:`. };}
Correct code for this rule:
// Correct.rpc RollbackBook(RollbackBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:rollback" body: "*" };}
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.
// (-- api-linter: core::0162::rollback-http-method=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc RollbackBook(RollbackBookRequest) returns (Book) { option (google.api.http) = { get: "/v1/{name=publishers/*/books/*}:rollback" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Rollback methods- URI suffix
Rollback methods: URI suffix
This rule enforces that Rollback
methods include the :rollback
suffix
in the REST URI, as mandated in AEP-162.
Details
This rule looks at any method beginning with Rollback
, and
complains if the HTTP URI does not end with :rollback
.
Examples
Incorrect code for this rule:
// Incorrect.rpc RollbackBook(RollbackBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:undo" // Should end with `:rollback` body: "*" };}
Correct code for this rule:
// Correct.rpc RollbackBook(RollbackBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:rollback" body: "*" };}
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.
// (-- api-linter: core::0162::rollback-http-uri-suffix=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc RollbackBook(RollbackBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:undo" body: "*" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Rollback methods- Request message
Rollback methods: Request message
This rule enforces that all Rollback
RPCs have a request message name of
Rollback*Request
, as mandated in AEP-162.
Details
This rule looks at any method beginning with Rollback
, 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:
// Incorrect.// Should be `RollbackBookRequest`.rpc RollbackBook(UndoBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:rollback" body: "*" };}
Correct code for this rule:
// Correct.rpc RollbackBook(RollbackBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:rollback" body: "*" };}
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.
// (-- api-linter: core::0162::rollback-request-message-name=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc RollbackBook(UndoBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:rollback" body: "*" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Rollback requests- Name field behavior
Rollback requests: Name field behavior
This rule enforces that all Rollback
requests have
google.api.field_behavior
set to REQUIRED
on their string name
field, as
mandated in AEP-162.
Details
This rule looks at any message matching Rollback*Request
and complains if the
name
field does not have a google.api.field_behavior
annotation with a
value of REQUIRED
.
Examples
Incorrect code for this rule:
// Incorrect.message RollbackBookRequest { // The `google.api.field_behavior` annotation should also be included. string name = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string revision_id = 2 [(google.api.field_behavior) = REQUIRED];}
Correct code for this rule:
// Correct.message RollbackBookRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string revision_id = 2 [(google.api.field_behavior) = REQUIRED];}
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.
message RollbackBookRequest { // (-- api-linter: core::0162::rollback-request-name-behavior=disabled // aep.dev/not-precedent: We need to do this because reasons. --) string name = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string revision_id = 2 [(google.api.field_behavior) = REQUIRED];}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Rollback requests- Name field
Rollback requests: Name field
This rule enforces that all Rollback
methods have a string name
field in the request message, as mandated in AEP-162.
Details
This rule looks at any message matching Rollback*Request
and complains if
either the name
field is missing or it has any type other than string
.
Examples
Incorrect code for this rule:
// Incorrect.// Should include a `string name` field.message RollbackBookRequest { string revision_id = 2 [(google.api.field_behavior) = REQUIRED];}
// Incorrect.message RollbackBookRequest { // Field type should be `string`. bytes name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string revision_id = 2 [(google.api.field_behavior) = REQUIRED];}
Correct code for this rule:
// Correct.message RollbackBookRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string revision_id = 2 [(google.api.field_behavior) = REQUIRED];}
Disabling
If you need to violate this rule, use a leading comment above the message (if
the name
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.
message RollbackBookRequest { // (-- api-linter: core::0162::rollback-request-name-field=disabled // aep.dev/not-precedent: We need to do this because reasons. --) bytes name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string revision_id = 2 [(google.api.field_behavior) = REQUIRED];}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Rollback requests- Name resource reference
Rollback requests: Name resource reference
This rule enforces that all Rollback
requests have
google.api.resource_reference
on their string name
field, as mandated in
AEP-162.
Details
This rule looks at the name
field of any message matching Rollback*Request
and complains if it does not have a google.api.resource_reference
annotation.
Examples
Incorrect code for this rule:
// Incorrect.message RollbackBookRequest { // The `google.api.resource_reference` annotation should also be included. string name = 1 [(google.api.field_behavior) = REQUIRED];
string revision_id = 2 [(google.api.field_behavior) = REQUIRED];}
Correct code for this rule:
// Correct.message RollbackBookRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string revision_id = 2 [(google.api.field_behavior) = REQUIRED];}
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.
message RollbackBookRequest { // (-- api-linter: core::0162::rollback-request-name-reference=disabled // aep.dev/not-precedent: We need to do this because reasons. --) string name = 1 [(google.api.field_behavior) = REQUIRED];
string revision_id = 2 [(google.api.field_behavior) = REQUIRED];}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Rollback requests- Revision ID field behavior
Rollback requests: Revision ID field behavior
This rule enforces that all Rollback
requests have
google.api.field_behavior
set to REQUIRED
on their string revision_id
field, as
mandated in AEP-162.
Details
This rule looks at any message matching Rollback*Request
and complains if the
revision_id
field does not have a google.api.field_behavior
annotation with a
value of REQUIRED
.
Examples
Incorrect code for this rule:
// Incorrect.message RollbackBookRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
// The `google.api.field_behavior` annotation should be included. string revision_id = 2;}
Correct code for this rule:
// Correct.message RollbackBookRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string revision_id = 2 [(google.api.field_behavior) = REQUIRED];}
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.
message RollbackBookRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
// (-- api-linter: core::0162::rollback-request-revision-id-behavior=disabled // aep.dev/not-precedent: We need to do this because reasons. --) string revision_id = 2;}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Rollback requests- Revision ID field
Rollback requests: Revision ID field
This rule enforces that all Rollback
methods have a string revision_id
field in the request message, as mandated in AEP-162.
Details
This rule looks at any message matching Rollback*Request
and complains if
either the revision_id
field is missing or it has any type other than string
.
Examples
Incorrect code for this rule:
// Incorrect.// Should include a `string revision_id` field.message RollbackBookRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];}
// Incorrect.message RollbackBookRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
// Field type should be `string`. bytes revision_id = 2 [(google.api.field_behavior) = REQUIRED];}
Correct code for this rule:
// Correct.message RollbackBookRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string revision_id = 2 [(google.api.field_behavior) = REQUIRED];}
Disabling
If you need to violate this rule, use a leading comment above the message (if
the name
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.
message RollbackBookRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
// (-- api-linter: core::0162::rollback-request-revision-id-field=disabled // aep.dev/not-precedent: We need to do this because reasons. --) bytes revision_id = 2 [(google.api.field_behavior) = REQUIRED];}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Rollback methods- Response message
Rollback methods: Response message
This rule enforces that all Rollback
RPCs have a response message of the
resource, as mandated in AEP-162.
Details
This rule looks at any method beginning with Rollback
, and complains
if the name of the corresponding output message does not match the name of the
RPC with the prefix Rollback
removed.
Examples
Incorrect code for this rule:
// Incorrect.// Should return `Book`.rpc RollbackBook(RollbackBookRequest) returns (RollbackBookResponse) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:rollback" body: "*" };}
Correct code for this rule:
// Correct.rpc RollbackBook(RollbackBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:rollback" body: "*" };}
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.
// (-- api-linter: core::0162::rollback-response-message-name=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc RollbackBook(RollbackBookRequest) returns (RollbackBookResponse) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:rollback" body: "*" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Tag Revision methods- HTTP body
Tag Revision methods: HTTP body
This rule enforces that all Tag Revision RPCs use *
as the HTTP body
, as mandated in
AEP-162.
Details
This rule looks at any method matching Tag*Revision
, and complains
if the HTTP body
field is anything other than *
.
Examples
Incorrect code for this rule:
// Incorrect.rpc TagBookRevision(TagBookRevisionRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:tagRevision" // body: "*" should be set. };}
Correct code for this rule:
// Correct.rpc TagBookRevision(TagBookRevisionRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:tagRevision" body: "*" };}
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.
// (-- api-linter: core::0162::tag-revision-http-body=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc TagBookRevision(TagBookRevisionRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:tagRevision" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Tag Revision methods- POST HTTP verb
Tag Revision methods: POST HTTP verb
This rule enforces that all Tag Revision RPCs use the POST
HTTP verb, as
mandated in AEP-162.
Details
This rule looks at any method matching Tag*Revision
, and complains
if the HTTP verb is anything other than POST
. It does check additional
bindings if they are present.
Examples
Incorrect code for this rule:
// Incorrect.rpc TagBookRevision(TagBookRevisionRequest) returns (Book) { option (google.api.http) = { get: "/v1/{name=publishers/*/books/*}:tagRevision" // Should be `post:`. };}
Correct code for this rule:
// Correct.rpc TagBookRevision(TagBookRevisionRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:tagRevision" body: "*" };}
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.
// (-- api-linter: core::0162::tag-revision-http-method=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc TagBookRevision(TagBookRevisionRequest) returns (Book) { option (google.api.http) = { get: "/v1/{name=publishers/*/books/*}:tagRevision" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Tag Revision methods- URI suffix
Tag Revision methods: URI suffix
This rule enforces that Tag Revision methods include the :tagRevision
suffix
in the REST URI, as mandated in AEP-162.
Details
This rule looks at any method matching Tag*Revision
, and
complains if the HTTP URI does not end with :tagRevision
.
Examples
Incorrect code for this rule:
// Incorrect.rpc TagBookRevision(TagBookRevisionRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:tag" // Should end with `:tagRevision` body: "*" };}
Correct code for this rule:
// Correct.rpc TagBookRevision(TagBookRevisionRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:tagRevision" body: "*" };}
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.
// (-- api-linter: core::0162::tag-revision-http-uri-suffix=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc TagBookRevision(TagBookRevisionRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:tag" body: "*" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Tag Revision methods- Request message
Tag Revision methods: Request message
This rule enforces that all Tag Revision RPCs have a request message name of
Tag*RevisionRequest
, as mandated in AEP-162.
Details
This rule looks at any method matching Tag*Revision
, 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:
// Incorrect.// Should be `TagBookRevisionRequest`.rpc TagBookRevision(TagBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:tagRevision" body: "*" };}
Correct code for this rule:
// Correct.rpc TagBookRevision(TagBookRevisionRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:tagRevision" body: "*" };}
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.
// (-- api-linter: core::0162::tag-revision-request-message-name=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc TagBookRevision(TagBookRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:tagRevision" body: "*" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Tag Revision requests- Name field behavior
Tag Revision requests: Name field behavior
This rule enforces that all Tag Revision requests have
google.api.field_behavior
set to REQUIRED
on their string name
field, as
mandated in AEP-162.
Details
This rule looks at any message matching Tag*RevisionRequest
and complains if the
name
field does not have a google.api.field_behavior
annotation with a
value of REQUIRED
.
Examples
Incorrect code for this rule:
// Incorrect.message TagBookRevisionRequest { // The `google.api.field_behavior` annotation should also be included. string name = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string tag = 2 [(google.api.field_behavior) = REQUIRED];}
Correct code for this rule:
// Correct.message TagBookRevisionRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string tag = 2 [(google.api.field_behavior) = REQUIRED];}
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.
message TagBookRevisionRequest { // (-- api-linter: core::0162::tag-revision-request-name-behavior=disabled // aep.dev/not-precedent: We need to do this because reasons. --) string name = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string tag = 2 [(google.api.field_behavior) = REQUIRED];}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Tag Revision requests- Name field
Tag Revision requests: Name field
This rule enforces that all Tag Revision methods have a string name
field in the request message, as mandated in AEP-162.
Details
This rule looks at any message matching Tag*RevisionRequest
and complains if
either the name
field is missing or it has any type other than string
.
Examples
Incorrect code for this rule:
// Incorrect.// Should include a `string name` field.message TagBookRevisionRequest { string tag = 2 [(google.api.field_behavior) = REQUIRED];}
// Incorrect.message TagBookRevisionRequest { // Field type should be `string`. bytes name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string tag = 2 [(google.api.field_behavior) = REQUIRED];}
Correct code for this rule:
// Correct.message TagBookRevisionRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string tag = 2 [(google.api.field_behavior) = REQUIRED];}
Disabling
If you need to violate this rule, use a leading comment above the message (if
the name
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.
message TagBookRevisionRequest { // (-- api-linter: core::0162::tag-revision-request-name-field=disabled // aep.dev/not-precedent: We need to do this because reasons. --) bytes name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string tag = 2 [(google.api.field_behavior) = REQUIRED];}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Tag Revision requests- Name resource reference
Tag Revision requests: Name resource reference
This rule enforces that all Tag Revision requests have
google.api.resource_reference
on their string name
field, as mandated in
AEP-162.
Details
This rule looks at the name
field of any message matching Tag*RevisionRequest
and complains if it does not have a google.api.resource_reference
annotation.
Examples
Incorrect code for this rule:
// Incorrect.message TagBookRevisionRequest { // The `google.api.resource_reference` annotation should also be included. string name = 1 [(google.api.field_behavior) = REQUIRED];
string tag = 2 [(google.api.field_behavior) = REQUIRED];}
Correct code for this rule:
// Correct.message TagBookRevisionRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string tag = 2 [(google.api.field_behavior) = REQUIRED];}
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.
message TagBookRevisionRequest { // (-- api-linter: core::0162::tag-revision-request-name-reference=disabled // aep.dev/not-precedent: We need to do this because reasons. --) string name = 1 [(google.api.field_behavior) = REQUIRED];
string tag = 2 [(google.api.field_behavior) = REQUIRED];}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Tag Revision requests- Tag field behavior
Tag Revision requests: Tag field behavior
This rule enforces that all Tag Revision requests have
google.api.field_behavior
set to REQUIRED
on their string tag
field, as
mandated in AEP-162.
Details
This rule looks at any message matching Tag*RevisionRequest
and complains if the
tag
field does not have a google.api.field_behavior
annotation with a
value of REQUIRED
.
Examples
Incorrect code for this rule:
// Incorrect.message TagBookRevisionRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
// The `google.api.field_behavior` annotation should be included. string tag = 2;}
Correct code for this rule:
// Correct.message TagBookRevisionRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string tag = 2 [(google.api.field_behavior) = REQUIRED];}
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.
message TagBookRevisionRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
// (-- api-linter: core::0162::tag-revision-request-tag-behavior=disabled // aep.dev/not-precedent: We need to do this because reasons. --) string tag = 2;}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Tag Revision requests- Tag field
Tag Revision requests: Tag field
This rule enforces that all Tag Revision methods have a string tag
field in the request message, as mandated in AEP-162.
Details
This rule looks at any message matching Tag*RevisionRequest
and complains if
either the tag
field is missing or it has any type other than string
.
Examples
Incorrect code for this rule:
// Incorrect.// Should include a `string tag` field.message TagBookRevisionRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];}
// Incorrect.message TagBookRevisionRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
// Field type should be `string`. bytes tag = 2 [(google.api.field_behavior) = REQUIRED];}
Correct code for this rule:
// Correct.message TagBookRevisionRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
string tag = 2 [(google.api.field_behavior) = REQUIRED];}
Disabling
If you need to violate this rule, use a leading comment above the message (if
the tag
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.
message TagBookRevisionRequest { string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ];
// (-- api-linter: core::0162::tag-revision-request-tag-field=disabled // aep.dev/not-precedent: We need to do this because reasons. --) bytes tag = 2 [(google.api.field_behavior) = REQUIRED];}
If you need to violate this rule for an entire file, place the comment at the top of the file.
Tag Revision methods- Response message
Tag Revision methods: Response message
This rule enforces that all Tag Revision RPCs have a response message of the resource, as mandated in AEP-162.
Details
This rule looks at any method matching Tag*Revision
, and complains
if the name of the corresponding output message does not match the name of the
RPC with the prefix Tag
and suffix Revision
removed.
Examples
Incorrect code for this rule:
// Incorrect.// Should return `Book`.rpc TagBookRevision(TagBookRevisionRequest) returns (TagBookRevisionResponse) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:tagRevision" body: "*" };}
Correct code for this rule:
// Correct.rpc TagBookRevision(TagBookRevisionRequest) returns (Book) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:tagRevision" body: "*" };}
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.
// (-- api-linter: core::0162::tag-revision-response-message-name=disabled// aep.dev/not-precedent: We need to do this because reasons. --)rpc TagBookRevision(TagBookRevisionRequest) returns (TagBookRevisionResponse) { option (google.api.http) = { post: "/v1/{name=publishers/*/books/*}:tagRevision" body: "*" };}
If you need to violate this rule for an entire file, place the comment at the top of the file.