AKIRA-MIYAKE / serverless-import-swagger

Import functions from OpenAPI spec file to serverless.yml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to change the integration to 'lambda' and not 'lambda-proxy'

LucasBadico opened this issue · comments

Hey @AKIRA-MIYAKE is there a way to change the integration mode? To use velocity and those stuffs?

This is the uploadImage function as a use case

 upload-image:
    handler: handler.upload
    description: Upload Objeto To S3
    events:
      - http:
          path: image
          method: post
          cors: true
          integration: lambda
          response:
            headers:
              Content-Type: "'application/json'"
              Access-Control-Allow-Origin: "'*'"
            template: $input.path('$')
            statusCodes:
                202:
                    pattern: '' # Default response method             
          request:
            template:
              application/json: '{
                 "method": "$context.httpMethod",
                 "body" : $input.json(''$''),
                 "headers": {
                   #foreach($param in $input.params().header.keySet())
                     "$param": "$util.escapeJavaScript($input.params().header.get($param))" #if($foreach.hasNext),#end
                   #end
                 },
                 "queryParams": {
                   #foreach($param in $input.params().querystring.keySet())
                     "$param": "$util.escapeJavaScript($input.params().querystring.get($param))" #if($foreach.hasNext),#end
                   #end
                 },
                 "pathParams": {
                   #foreach($param in $input.params().path.keySet())
                     "$param": "$util.escapeJavaScript($input.params().path.get($param))" #if($foreach.hasNext),#end
                   #end
                 },
                 "key": "$util.escapeJavaScript($input.params().querystring.get(''key''))"
              }'