如何爲POST端點添加請求模型,以便在出口iOS API時顯示在API網關中?我可以在AWS中手動添加請求模型,但由於這是通過服務器部署的,所以我需要在那裏。我看到有一個用於定義端點的responseModels,但我看不到requestModels?如何在無服務器框架中爲POST端點添加請求模型
我的S-functions.json有這個
"endpoints": [
{
"path": "blog/graphql",
"method": "POST",
"type": "AWS",
"authorizationType": "AWS_IAM",
"authorizerFunction": false,
"apiKeyRequired": false,
"requestParameters": {},
"requestTemplates": {
"application/json": "{\"query\" : $input.json(\"$\")}"
},
"responses": {
"400": {
"statusCode": "400"
},
"default": {
"statusCode": "200",
"responseParameters": {},
"responseModels": {},
"responseTemplates": {},
"application/json": ""
}
}
}
]
在AWS APIGateway然後我需要手動添加請求模型
{
"title": "Example Schema",
"type": "object",
"properties": {
"query": {
"type": "string"
}
},
"required": ["query"]
}
當我再導出我得到的是iOS API正確的方法爲了發送一個graphQL查詢,它的工作原理。
但是,由於我想部署這與無服務器部署,我不能繼續手動添加此。
而且我需要API端點調用才能通過iOS的APGateway SDK來使用認證憑證,而不是手動執行https。