Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AIP-144] Creation with complex resource associations (Or custom request AddAuthorRequest) #1390

Open
yji-github opened this issue Jul 24, 2024 · 0 comments

Comments

@yji-github
Copy link

yji-github commented Jul 24, 2024

According to AIP-124 and AIP-144: we expect add association for book author like:

// From AIP-124
message BookAuthor {
  // The resource pattern for BookAuthor indicates that Book is the
  // canonical parent.
  option (google.api.resource) = {
    type: "library.googleapis.com/BookAuthor"
    pattern: "publishers/{publisher}/books/{book}/authors/{book_author}"
  };

  // The resource name for the book-author association.
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // The resource name for the author.
  string author = 2 [(google.api.resource_reference) = {
    type: "library.googleapis.com/Author"
  }];

  // Other fields...
}
// From AIP-144
rpc AddAuthor(AddAuthorRequest) returns (Book) {
  option (google.api.http) = {
    post: "/v1/{book=publishers/*/books/*}:addAuthor"
    body: "*"
  };
}

message AddAuthorRequest {
  // The name of the book to add an author to.
  string book = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference).type = "library.googleapis.com/Book"
  ];

  string author = 2 [(google.api.field_behavior) = REQUIRED];
}

I have two questions:

  1. it seems not quite clear how to include message BookAuthor as in AddAuthorRequest. Should it be like
message AddAuthorRequest {
  // The name of the book to add an author to.
  string book = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference).type = "library.googleapis.com/Book"
  ];

  string author = 2 [(google.api.field_behavior) = REQUIRED];

  BookAuthor book_author = 3 [(google.api.field_behavior) = REQUIRED]; // newly added
}
  1. If there is no id for book_author, should this pattern be
    • pattern: "publishers/{publisher}/books/{book}/authors/{book_author}", or
    • pattern: "publishers/{publisher}/books/{book}/authors/{author}"
@yji-github yji-github changed the title [AIP] Creation with complex resource associations (Or Custom AddBookAuthor) [AIP-144] Creation with complex resource associations (Or Custom AddBookAuthor) Jul 25, 2024
@yji-github yji-github changed the title [AIP-144] Creation with complex resource associations (Or Custom AddBookAuthor) [AIP-144] Creation with complex resource associations (Or custom request AddAuthorRequest) Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant