二维数组的AWS API网关映射模型

时间:2019-08-23 10:37:17

标签: php laravel aws-sdk aws-api-gateway

我是AWS api网关的新手,我已经将应用程序部署到了aws api网关,现在我具有二维媒体数组,为此,它在api网关上定义了一个映射模板,但是当我在部署后生成SDK时,SDK确实做了以下是我在网关上定义的示例响应和模型,未为媒体的二维数组生成正确的代码

回复

{
"data": [
    {
        "id": "5824d546-3f16-11e9-a005-3ca9f421c370",
        "full_name": "Satxcdfield",
        "username": "gustin16579",
        "is_private": false,
        "picture": "/staging4/users/k1irambzupload-image1546361823.jpg",
        "post_count": 1034,
        "box_count": 8,
        "follow_status": "",
        "media": [
            [
                {
                    "medium": "/staging4/users/k1irambzupload-image1546361823.jpg",
                    "height": 320,
                    "width": 180
                },
                {
                    "medium": "/staging4/users/k1irambzupload-image1546361823.jpg",
                    "height": 301,
                    "width": 180
                }
            ],
            [
                {
                    "medium": "/staging4/users/k1irambzupload-image1546361823.jpg",
                    "height": 320,
                    "width": 180
                },
                {
                    "medium": "/staging4/users/k1irambzupload-image1546361823.jpg",
                    "height": 240,
                    "width": 180
                }

            ]
        ]
    }
]

}

模型

    {
  "type" : "object",
  "required" : [ "data" ],
  "properties" : {
    "data" : {
      "type" : "array",
      "items" : {
        "type" : "object",
        "properties" : {
          "id" : {
            "type" : "string"
          },
          "full_name" : {
            "type" : "string"
          },
          "username" : {
            "type" : "string"
          },
          "is_private" : {
            "type" : "boolean"
          },
          "picture" : {
            "type" : "string"
          },
          "post_count" : {
            "type" : "integer"
          },
          "box_count" : {
            "type" : "integer"
          },
          "follow_status" : {
            "type" : "string"
          },
          "media" : {
            "type" : "array",
            "items" : {
              "type" : "array",
              "$ref":"https://apigateway.amazonaws.com/restapis/v9ad25xv/models/GenericMedia"
            }
          }
        }
      }
    },
    "total_friends" : {
      "type" : "integer"
    }
  }
}

当我生成SDK时,aws-api-gateway生成的媒体不正确。 我不知道我在哪里做错了,因为我遵循了AWS文档中的映射模板。

0 个答案:

没有答案