向Google云端点变量添加说明

时间:2014-07-11 06:42:25

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

如何将描述字符串添加到Google云端点变量,以便在Google的API资源管理器中显示? 我能够使用注释“”“”“”为方法添加描述。例如:

@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 - > 日历标识符

请求正文:

范围 - > 规则的范围

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

1 个答案:

答案 0 :(得分:1)

评论在发现文件(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,

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