Skip to content
Aggregate several swagger APIs in one
Python Makefile
Branch: master
Clone or download
Latest commit d7e4501 Jun 14, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs First release Jan 29, 2016
swagger_aggregator Merge pull request #6 from Trax-air/catch-requestexception Feb 9, 2016
tests
.checkignore Update .checkignore Feb 5, 2016
.editorconfig First release Jan 29, 2016
.gitignore First release Jan 29, 2016
.travis.yml Change license to MIT Jan 31, 2016
AUTHORS.rst First release Jan 29, 2016
CONTRIBUTING.rst Fix issue tracker link Jun 14, 2018
HISTORY.rst Change license to MIT Jan 31, 2016
LICENSE Change license to MIT Jan 31, 2016
MANIFEST.in First release Jan 29, 2016
Makefile First release Jan 29, 2016
README.rst Remove broken/useless metrics on README Sep 11, 2016
requirements.txt BLD: Requirements are now loose Feb 5, 2016
requirements_dev.txt BLD: Updated requirements_dev.txt Feb 8, 2016
setup.cfg Bump version: 0.1.0 → 0.1.1 Jan 31, 2016
setup.py Bump version: 0.1.0 → 0.1.1 Jan 31, 2016
tox.ini Remove python2.6 test Jan 29, 2016
travis_pypi_setup.py

README.rst

Travis status

Join the chat at https://gitter.im/Trax-air/swagger-aggregator

swagger-aggregator

Swagger-aggregator allow you to create a swagger REST API from several other swagger REST APIs.

This can be really useful if you want to make an API Gateway accessing some of your internal APIs. You can also filter which path you want to deliver, and which properties of your definitions you don't want to show.

Related Libraries

You may find related libraries to this one:

Example Usage

Here is an example of an aggregate configuration.

args: pet_url

info:
  version: "0.1"
  title: "API Gateway"

basePath: /v2

apis:
    pet: http://pet_url/v2

exclude_paths:
  - DELETE /pets/{petId}

exclude_fields:
  petPet:
    - id

This is not the most useful aggregation, as it only aggregate one API. The first part, args, define that the first parameter we will send to the aggregate will be pet_url. Then pet_url will be replaced by the given value everywhere in the config. The two next part, info and basePath, are the same as the ones you can find in every swagger API. apis, define the different APIs you want to aggregate. A name is associated with it URL. Then exclude_paths allow you to not deliver some path. In this case we don't want the user to delete a pet.

Finally, exclude_fields define the attributes of the definitions we do not want to show. The value of the keys is the name of the API followed by the name of the definition. The value of each key will be a list of all properties to exclude.

Then use this command to generate the aggregated swagger file:

from traxit_aggregator import SwaggerAggregator

SwaggerAggregator('config.yaml', 'pet.com')

Documentation

More documentation is available at https://swagger-aggregator.readthedocs.org/en/latest/.

Setup

make install or pip install swagger-aggregator

License

swagger-aggregator is licensed under http://opensource.org/licenses/MIT.

You can’t perform that action at this time.