Postman to swagger

We like to use postman, but often we get asked for swagger docs. There doesn't seem to be any open source postman v2.0.0
=> swagger/openApi tools. Maybe a commercial reason, here is one for you.
Usage
import postmanToSwagger from 'postman-to-swagger';
const convertAndSave = postmanJson => {
const swaggerJson = postmanToSwagger(postmanJson);
fs.writeFile(
'../_docs/swagger.json',
JSON.stringify(swaggerJson, null, 2),
'utf8'
);
};
With swagger-ui-express
import postmanToSwagger from 'postman-to-swagger';
import swaggerUi from 'swagger-ui-express';
import mockCollection from './mockCollection.json';
swagger.get('/swagger', swaggerUi.setup(postmanToSwagger(mockCollection)));
swagger.use('/', swaggerUi.serve, (req, res) => res.status(404).end());
What it converts
- name, description, version
- routes, folders
- examples, status codes
Demo
npm run build
npm install
npm run watch
Future improvement
- Apimatic has this
models
thing that is kind of useful, maybe we can also do that.
- Use
lodash/fp
, lodash/fp/flow
to slim down module size
Repos to watch