0
在我的GCP端點v2項目中,我創建了一個返回POJOS集合的服務。 我注意到,當返回一個List或一個CollectionResponse @ApiMethod(name =)不起作用。GCP端點v2:@ApiMethod(name =)返回集合時不起作用
下面的例子:
@ApiMethod(name = "getCountryList",
httpMethod = ApiMethod.HttpMethod.GET)
public CollectionResponse<Country> getCountryList() {
List<Country> countryList = null;
Connection con = null;
try{
con = DbUtils.getConnection();
countryList = CountryApi.getAll(con);
return CollectionResponse.<Country> builder().setItems(countryList).build();
//......
我除了有暴露名爲getCountryList我的方法,而它被這個名爲「collectionresponse_country」暴露
也在這裏是openapi.json文件,該文件是一致的