Ios 在向AWS API网关传递数据时,如何有一点倾斜性?

Ios 在向AWS API网关传递数据时,如何有一点倾斜性?,ios,aws-api-gateway,Ios,Aws Api Gateway,我有一个iOS应用程序,它从服务器获取数据“profile”,并将其与另一个值“appKnowsThisKey”一起发送到API网关 我希望iOS应用程序对“个人资料”的结构保持不可知 我在API网关上创建了一个模型,它知道字典的键 { "$schema": "http://json-schema.org/draft-04/schema#", "title": "ExampleModel", "type": "object", "properties": { "appKnowsThisK

我有一个iOS应用程序,它从服务器获取数据“profile”,并将其与另一个值“appKnowsThisKey”一起发送到API网关

我希望iOS应用程序对“个人资料”的结构保持不可知

我在API网关上创建了一个模型,它知道字典的键

{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ExampleModel",
"type": "object", "properties": {
    "appKnowsThisKey" : {"type": "string" },
    "profile": { 
        "type": "object", "properties": {
            "key1": {"type": "string" },
            "key2": {"type": "string" },
            "key3": {
                "type": "array", "items": {"type": "string" }
            }
        }
    }
}}
iOS的API网关部署创建了Swift类:
ExampleModel
ExampleModel\u profile

我在iOS应用程序中有一个对象
配置文件
,保存着
[String:AnyObject]
中的值


如何将iOS中的字典分配给配置文件的API网关模型?e、 例如,我是否将ExampleModel中的“profile”重新定义为
字符串并传入JSON字符串?

如果您想让iOS应用程序不知道“profile”的结构,唯一的方法是将ExampleModel中的“profile”定义为字符串并传入JSON字符串

将来当结构发生变化时,您可以使用集成请求映射模板将JSON映射到端点期望的位置

{
    "someNewField" : "$input.json('$.profile.someOldField')"
}

谢谢我同意这是最好的解决办法。阿皮格加了一些好糖。