Skip to content

AIP-162 description for rollback does not match API linter rules #1611

@SoMuchForSubtlety

Description

@SoMuchForSubtlety

The AIP description1 gives the following example for a rollback request message, note that the name fields references library.googleapis.com/BookRevision and there is no separate revision_id field.

message RollbackBookRequest {
  // The revision that the book should be rolled back to.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "library.googleapis.com/BookRevision"
    }];
}

The API linter gives this as a valid rollback request message. It references library.googleapis.com/Book and has a separate revision_id.2

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];
}

The RPC response message does also not match. According to the AIP description a rollback operation should return a revision object1

rpc RollbackBook(RollbackBookRequest) returns (BookRevision) {
  option (google.api.http) = {
    post: "/v1/{name=publishers/*/books/*/revisions/*}:rollback"
    body: "*"
  };
}

The API linter also disagrees here, and gives the following as a valid example.3

rpc RollbackBook(RollbackBookRequest) returns (Book) {
  option (google.api.http) = {
    post: "/v1/{name=publishers/*/books/*}:rollback"
    body: "*"
  };
}

Footnotes

  1. https://google.aip.dev/162#rollback 2

  2. https://linter.aip.dev/162/rollback-request-revision-id-field

  3. https://linter.aip.dev/162/rollback-response-message-name

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions