If you are building a microservice system and using Swagger.
This packet is able to help you combine all swagger documents to only one document.
For example, you have the swagger documents at http://service1/docs
, http://service2/docs
This will help you combine all links above to only one link http://service/docs
NOTE: If you need Gulp, ES6 and somethings more, please see branch added_gulp
docker run -d -p 3000:3000 thanhson1085/swagger-combined
See config/default.json as below:
{
"list_url": [
{
"docs": "http://petstore.swagger.io/v2/swagger.json",
"base_path": "http://petstore.swagger.io/v2",
"route_match": ["/user*", "/pet*", "/store*"]
}
],
"info": { "title": "Example API", "version": "1.0" },
"port": 3000
}
- docs: swagger document links
- base_path: Proxy Target
- route_match: Routes for proxy
Please make note that you changed config/default.json
to match all swagger document links you have
git clone https://github.com/thanhson1085/swagger-combined.git
Run:
cd swagger-combined
npm install
node index.js
In the default, swagger-combined run on port 3000 and included swagger-ui. So you just run http://localhost:3000?url=http://localhost:3000/docs
to see everything you need. Or you can see swagger api at http://localhost:3000/docs
With config/default.json:
{
"list_url": [
{
"docs": "http://petstore.swagger.io/v2/swagger.json",
"base_path": "http://petstore.swagger.io/v2",
"route_match": ["/user*", "/pet*", "/store*"]
},
{
"docs": "https://angular-admin-seed.sonnguyen.ws/docs",
"base_path": "https://angular-admin-seed.sonnguyen.ws",
"route_match": ["/api/v1*"]
}
],
"info": { "title": "Example API", "version": "1.0" },
"port": 3000
}
Copyright (c) 2015 Nguyen Sy Thanh Son thanhson1085@gmail.com