More info on Cloud Endpoints return types

后端 未结 1 965
悲哀的现实
悲哀的现实 2020-12-12 01:33

According to the documentation,

the return value type cannot be simple type such as String or int. The return value needs to be a POJO, an array or a

1条回答
  •  醉梦人生
    2020-12-12 01:46

    I think I encountered the same thing recently. I tried returning a collection or array of strings from an endpoint. It appeared to work - it generated my client code without errors and created code that appeared specifically designed to handle the type (in other words, yes, they meant for it to work). However, once deployed it didn't work.

    Eventually I turned up a SO Q/A from the spring (can't find it now) in which Google became aware of the bug, but I guess they still haven't fixed it or changed the docs.

    [edit: I found the post I was thinking of]. In this post from 2013-03, Dan Holevoet of Google initially suggests using a collection of entities, but finds that this doesn't work, so suggests as a work-around that the collection be wrapped in a temporary class. That, plus my experience above (it generated a StringCollection, as I was attempting to use a collection of strings), is what lead me to conclude that it is a known issue.

    0 讨论(0)
提交回复
热议问题