我正在使用Google的可扩展服务代理在gRPC和REST之间为我的API转码。
我有一个看起来像这样的RPC:
// Get a portfolio by ID.
rpc GetPortfolio(PortfolioId) returns (Portfolio) {
option (google.api.http) = {
get: "/v1/portfolios/{own_id.uuid}"
additional_bindings {
get: "/v1/organisations/{organisation_id.uuid}/portfolio"
}
additional_bindings {
get: "/v1/nations/{nation_id.uuid}/portfolio"
}
additional_bindings {
get: "/v1/associations/{association_id.uuid}"
}
};
}
,PortfolioId
消息如下:
// A resource used to identify portfolios
// User-generated portfolios have their own ID
// Organisational and national portfolios connect to the organisation or nation respectively
// WGA and SIL portfolios are both singletons and can be identified by booleans
// The way in which a portfolio is identified also indicates which type of portfolio it is.
message PortfolioId {
// To identify a portfolio no more than one of these will be set
oneof id {
// The user-generated portfolio ID
Id own_id = 5;
// The ID of the organisation the organisational portfolio is for
Id organisation_id = 7;
// The ID of the nation the national portfolio is for
Id nation_id = 9;
// The ID of the association the association portfolio is for
Id association_id = 12;
}
}
注释的additional_bindings
部分似乎不起作用。它没有显示在我的开发人员门户中,当我尝试使用它们时,出现method does not exist
错误。
第一个绑定get: "/v1/portfolios/{own_id.uuid}"
有效。
我做错什么了吗?
ESP来自这里:
gcr.io/endpoints-release/endpoints-runtime:1.32