It would be nice if we can specify API Gateway request/response models in the serverless.yml. Client code generation feature in the AWS API Gateway Console depends on the request/response models
specified.
Is this possible in the latest release, i.e. 1.0.0-rcx? There are some plugins out there, but they are compatible with the 0.5.x version of Serverless.
According to the documentation 01-apigateway.md You should be able to define default/custom request/response templates. But I came across an issue when trying their example code, functions: create: handler: posts.create events: - http: method: get path: whatever request: template: application/json: { "httpMethod" : "$context.httpMethod" }
This fails at deployment.
Hi,
It seems Request/Response templates are Velocity templates that transform HTTP request into Integration request (i.e. Lambda event) and Lamda integration response into HTTP method response.
On the contrary, models are attached on the “left”, client facing side in the AWS Api Gateway Console authoring dashboard.
I had this issue recently, I first wrapped it within single quote marks which fixed it but have found the nicest way that is currently supported is to do a multi line YAML string.
FYI we’re also currently working on a new feature for this that will make this a lot easier and mostly unnecessary due to automated matching. More to come soon.
I’m also interested in support for APIGW request/response models. I tried to just define them as CloudFormation resources, but I still need to have the mapping between the method and the model.