Challenge Overview

In this challenge series we will be building a tool that imports a swagger API definition into Amazon API Gateway.

The tool will have two tasks:
  1. Transform internal swagger doc (all endpoints) into an external swagger doc (limited to a white-listed and black-listed set of endpoints defined by the user)
  2. Importing the external doc into Gateway API

These two requirements should be implemented as two command line Python applications. For testing we can use the following swagger api definition https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v2.0/json/petstore.json


Swagger transformations
Define transform format that specifies what to white-list and black-list in yml file. Use some defined path format (e.g. JsonPath). The white-list/black-list paths should be able to target any Swagger element (endpoint, definition, example, endpoint-method) and include/exclude that element and should be compatible with Swagger 2.0 and 3.0.

Script will load the input swagger file, whitelist/blacklist configuration, process the file and output a new swagger file. Input file path, output file path and configuration file path should be read as command line arguments.


Import Swagger into Gateway API
Gateway API goes not support entire swagger specification and there is a
list of known issues that will produce errors or warnings when importing a swagger file. The script will load the input file and verify it against the known issues list and these specific validations
 
  • Parameter names are unique across querystring, header and path 
  • All schema references in the swagger file are satisfied
  • All model references are satisfied

If an issue is found in the swagger document, the script will do one of these three things
 
  • Fix it automatically if possible and log the change with INFO level. For example if there is a response definition, replace it with inline schema
  • Disable the feature by using x-disabled-for-amazon-gateway tag if it does not affect api usage
  • Produce an error if none of the above is possible. Error should indicate the exact issue and suggest how to fix the issue. For example, if there is a duplicate parameter in path and header, the issue can't be automatically fixed becouse the change requires changing the API itself so he tool will log the error with a message suggesting to rename one of the parameters.

If there are no errors in the input file, the script will import the valid swagger document to API Gateway. If there are any errors, they should be logged and application should exit with a non zero exit code.

AWS credentials should be read from environment variables. Use 
Boto3 client package for interacting with AWS.
Use Python 3.5 for development.

 


Final Submission Guidelines

Submit entire application code
Submit a verification guide and sample test files that cover all the requirements (whitelist, blacklist, mitigating swagger issues, error cases and swagger import)

ELIGIBLE EVENTS:

2018 Topcoder(R) Open

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30059224