Skip to main content

Aggregate several swagger APIs in one

Project description

Travis status

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.

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/GPL-3.0.

History

0.1 (2016-1-29)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swagger_aggregator-0.1.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

swagger_aggregator-0.1-py2.py3-none-any.whl (8.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file swagger_aggregator-0.1.tar.gz.

File metadata

File hashes

Hashes for swagger_aggregator-0.1.tar.gz
Algorithm Hash digest
SHA256 f4222c03ffb3eebf3f4f9f4be35545b46c037db54e426c5cf09462ca729b0533
MD5 f0f318c1f349033efc8878aa78d5c71f
BLAKE2b-256 628b3afd82bf78b09025204e399ac9fc978cd430ee5adb13a5c22d4400b44ce0

See more details on using hashes here.

File details

Details for the file swagger_aggregator-0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for swagger_aggregator-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2f38fefec23ab4e5a029d851d9fe4a70660bca038dcf8f3938d8a9781ea6e3b0
MD5 d86a99d499eae5da5e656a7a54e505a2
BLAKE2b-256 65bdddeb86d16e375a0fbde7f5e390ef52b1799b159eaac9bcad153fedcd426e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page