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:
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
}
If there is no id for book_author, should this pattern be
pattern: "publishers/{publisher}/books/{book}/authors/{book_author}", or
According to AIP-124 and AIP-144: we expect add association for book author like:
I have two questions:
it seems not quite clear how to include message BookAuthor as in AddAuthorRequest. Should it be like
If there is no id for book_author, should this pattern be
pattern: "publishers/{publisher}/books/{book}/authors/{book_author}"
, orpattern: "publishers/{publisher}/books/{book}/authors/{author}"