gpt4 book ai didi

java - Google Cloud Endpoints 未在 API 资源管理器中显示 map

转载 作者:搜寻专家 更新时间:2023-11-01 03:49:36 24 4
gpt4 key购买 nike

我们受困于 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 浏览器中显示为“空”,我们无法像在日历 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 Explorer 中按预期工作。此外,从 Javascript 客户端调用带有完整 map 的方法是可行的,所以问题实际上只是 map 在 API 资源管理器中不可见。

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

enter image description here

试过注释和扩展 GenericJson,但没有任何帮助。

有谁知道为什么 map 没有显示在 API 资源管理器中?本地开发服务器不工作,也不部署在 GAE 上。使用常规 POST 请求或 Javascript 客户端库调用方法,它工作。

谢谢!

最佳答案

确实,Google 选择不共享上游 Cloud Endpoints 的内部部分。不过与此同时,您可能/可能没有发现您仍然可以输入任意 JSON 数据,只是没有花哨的 UI。

只需将鼠标悬停在有效载荷框中出现的槽口上,然后点击“自由格式编辑器”:

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

关于java - Google Cloud Endpoints 未在 API 资源管理器中显示 map ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32050561/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com