首页 文章

Google Cloud Endpoints未在API资源管理器中显示 Map

提问于
浏览
4

我们坚持使用Google Cloud Endpoints . 根据Google Calendar API资源管理器(https://developers.google.com/apis-explorer/#p/calendar/v3/calendar.events.update),应该可以在Google API资源管理器中使用java.util.Map,如下所示'extendedProperties'的'shared'属性:

enter image description here

但是,当我们使用Map时,它只是在API资源管理器中显示为“空”,我们无法像在Calendar API中那样添加条目:

enter image description here

这是该字段的代码:

private java.util.Map<String, String>  impactedCustomersPrivate;

public Map<String, String> getImpactedCustomersPrivate() {
    return impactedCustomersPrivate;
}

public void setImpactedCustomersPrivate(Map<String, String> impactedCustomersPrivate) {
    this.impactedCustomersPrivate = impactedCustomersPrivate;
}

类中的所有其他字段,如字符串,长整数,甚至列表,都在API资源管理器中按预期工作 . 此外,从Javascript客户端调用带有完整Map的方法是有效的,所以问题实际上只是从API资源管理器中看不到Map .

我一直在查看Calendar API Java客户端(https://developers.google.com/api-client-library/java/apis/calendar/v3/java)的源代码,他们使用Map for ExtendedProperties,请参见屏幕截图:

enter image description here

使用注释和扩展GenericJson,但没有任何帮助 .

有没有人知道为什么 Map 没有出现在API浏览器中?不能在本地开发服务器上运行,也不在GAE上部署 . 使用常规POST请求或Javascript客户端库调用该方法,它可以工作 .

谢谢!

1 回答

  • 0

    事实上,似乎Google上游的 Cloud 终端内部部分是谷歌选择不共享的 . 与此同时,您可能/可能没有发现您仍然可以输入任意JSON数据,只是没有花哨的UI .

    只需将鼠标悬停在有效负载框中出现的缺口上,然后点击“Freeform编辑器”:

    这让你输入任何你该死的JSON . 这是希望Google有一天可以共享他们用于UI的任何代码(以及覆盖API资源管理器中的小图标的方法) .
    enter image description here

相关问题