Hey Guys,  I've been working on an API that will import into AWS API 
Gateway with all of the bells and whistles in place without having to do to 
much manual edits to the api-docs generated by swagger.  The real struggle 
has been with generating the x-amazon-apigateway-integration
annotations. 

So I have this: 


@ApiOperation(
 notes = "Post a new Topic",
 value = "AddTopic",
 nickname = "AddTopic",
 tags = {"Topic", "Entity"},

 authorizations = {@Authorization(value = X_API_KEY_HEADER)},
 extensions = {
 @Extension(
 name = "x-amazon-apigateway-integration",

 properties = {
 @ExtensionProperty(name = "uri", value = AWS_GATEWAY_PATH + ""),
 @ExtensionProperty(name = "passthroughBehavior", value = "when_no_match"),
 @ExtensionProperty(name = "httpMethod", value = "POST"),
 @ExtensionProperty(name = "type", value = "http_proxy"),
 }
 )
 }
)

This works fine to produce:


   - x-amazon-apigateway-integration: 
   {
      - httpMethod: "POST",
      - passthroughBehavior: "when_no_match",
      - type: "http_proxy",
      - uri: "http://.../topic 
      
<http://nimbits-prod-app-lb-155719467.us-east-1.elb.amazonaws.com/v5_0/api/entity/topic>
      "
      }
   

But in order to do things like passthrough to an AWS load balancer or 
Enable CORS the* x-amazon-apigateway-integration *needs to look like this 
(this is from the AWS API GW Pet Store example:



"x-amazon-apigateway-integration": {
          "responses": {
            "default": {
              "statusCode": "200",
              "responseParameters": {
                "method.response.header.Content-Type": "'text/html'"
              },
              "responseTemplates": {
                "text/html": "<html>\n    <head>\n        <style>\n       
 body {\n            color: #333;\n            font-family: Sans-serif;\n   
         max-width: 800px;\n            margin: auto;\n        }\n       
 </style>\n    </head>\n    <body>\n        <h1>Welcome to your Pet Store 
API</h1>\n    </body>\n</html>"
              }
            }
          },
          "passthroughBehavior": "when_no_match",
          "requestTemplates": {
            "application/json": "{\"statusCode\": 200}"
          },
          "type": "mock"
        }
      }
    }



It's much more complicated than the key value pair @ExtensionProperty 
creates.  My API is quite complex so i can't believe i'd have to go through 
and manually edit all of the json - i'm actually writing find and replace 
scripts to inject this json and it all feels wrong - is there a way to 
annotate an api to create extension properties like the sample above?  

Thanks!  

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to