【问题标题】:Add description to google cloud endpoints variables向谷歌云端点变量添加描述
【发布时间】:2014-07-11 06:42:24
【问题描述】:

如何向谷歌云端点变量添加描述字符串,以便在谷歌的 API 资源管理器中可见? 我能够使用 cmets """ """ 向方法添加描述。例如:

@endpoints.method(LocationRequestMessage, LocationResponseMessage, path='location', http_method='POST',
                  name='location.create')
def location_create(self, request):
    """
    Creates a location
    """

这是我想要实现的一个示例: https://developers.google.com/apis-explorer/#p/calendar/v3/calendar.acl.insert

输入字段:

calendarId--> 日历标识符

请求正文:

范围--> 规则的范围

我必须在哪里添加粗体描述文本才能显示它?

【问题讨论】:

    标签: google-app-engine google-api google-cloud-endpoints


    【解决方案1】:

    cmets 在发现文件 (APPLICATION-NAME-rest.discovery) 中定义。

    来自Google APIs Discovery Service

    "methods": {
        (key): {
          "id": string,
          "path": string,
          "httpMethod": string,
          "description": string,
          "parameters": {
            (key): {
              "id": string,
              "type": string,
              "$ref": string,
              "description": string,
              "default": string,
              "required": boolean,
              "format": string,
              "pattern": string,
    

    您可以看到“描述”字段。目前,endpoints.sh get-discovery 似乎没有获取代码 cmets 并填写这些描述。但是您可以自己修改 .discovery 文件并部署到 appengine。

    【讨论】:

    • “endpoints.sh get-discovery”从哪里获取代码 cmets?我确实尝试将它添加到消息定义中(id = messages.IntegerField(1, description='Test')),但它不起作用:TypeError: __init__() got an unexpected keyword argument 'description'。还有其他想法吗?
    • 对于 Javascript 和其他动态语言,发现文档是由 Google Cloud 端点在运行时动态生成的,您无法将其 URL 替换为覆盖的文件。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-04-23
    • 1970-01-01
    • 2015-10-27
    • 2014-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多