Forum Discussion

sandeepilania's avatar
sandeepilania
New Contributor
6 years ago

Swagger definition for an AWS Api-Gateway Lambda Proxy endpoint

I'm trying to create the Swagger definition for a number of APIs under AWS Api-Gateway. I'm able to successfully do this for other(POST, GET) endpoints from an auto-generated YAML configuration I downloaded from the API Stage.

But I encountered issues when I tried to do same for an Api-Gateway endpoint with Lambda Proxy Integration: Error from Swagger editor.swagger.io

 

swagger: "2.0"
    info:
      version: "2018-04-18T17-09-07Z"
      title: "XXX API"
    host: "api.xxx.io"
    schemes:
    - "https"
    parameters:
      stage:
        name: stage
        in: path
        type: string
        enum: [ staging, production]    
        required: true
    paths:
      /env/{stage}/{proxy+}:
        x-amazon-apigateway-any-method:
          produces:
            - "application/json"
          parameters:
            - $ref: '#/parameters/stage'
            - name: "proxy"
              in: "path"
              required: true
              type: "string"
          responses: {}
          x-amazon-apigateway-integration:
            uri: "arn:aws:apigateway:eu-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-central-1:xxxxxxxxx:function:environment/invocations"
            responses:
              default:
                statusCode: "200"
            passthroughBehavior: "when_no_match"
            httpMethod: "POST"
            cacheNamespace: "4vbcjm"
            cacheKeyParameters:
              - "method.request.path.proxy"
            contentHandling: "CONVERT_TO_TEXT"
            type: "aws_proxy"

 

this is inline with AWS Documentation: enter link description here

Please advice, what am I missing?