Universal data structure and converter for API formats (Swagger, RAML, Paw, Postman…)
Clone or download
Pull request Compare This branch is 34 commits ahead of luckymarmot:develop.
philsturgeon Support URL objects with raw and not much else
URL objects with raw but not a lot else were causing empty URLs, which shoved everything into /
instead of gracefully figuring it out. Now if a URL is an object with
"raw" it'll use the raw string.
Latest commit 655b752 Nov 30, 2017
Permalink
Failed to load latest commit information.
bin improved metafiles for npm publish Dec 12, 2016
configs Just be inconsistent like before Dec 6, 2017
linting removed duplication engine, added fixme engine, added require-jsdoc r… Apr 25, 2017
scripts fixed packing error Apr 26, 2017
src Support URL objects with raw and not much else Jan 16, 2018
testing Support URL objects with raw and not much else Jan 16, 2018
.babelrc added coverage to test suite. started working on increasing coverage Apr 18, 2017
.codeclimate.yml removed duplication engine, added fixme engine, added require-jsdoc r… Apr 25, 2017
.eslintignore set up linting. improved file quality. Mar 30, 2016
.flowconfig updated core model to support more features from swagger v3 and raml 1.0 Jan 3, 2017
.gitignore added support for custom headers for api key auths Aug 20, 2017
.npmignore improved metafiles for npm publish Dec 12, 2016
.nvmrc updated .nvmrc to 7.4 Apr 3, 2017
.travis.yml added coverage to test suite. started working on increasing coverage Apr 18, 2017
CONTRIBUTING.md Hunting through travis.yml isnt ideal Dec 5, 2017
LICENSE added standard project files Mar 22, 2016
Makefile added clean script and updated makefile Apr 10, 2017
README.md Merge branch 'please-dont-make-contributors-hunt' into develop Dec 6, 2017
package.json added drafter.js to dependencies May 2, 2017
webpack.config.babel.js refactored parser, resolvers and serializers into loaders, parsers an… Mar 2, 2017
yarn.lock added drafter.js to dependencies May 2, 2017

README.md

Build Status

API-Flow

A flow written in ES6 using Immutable to convert between API description formats (Swagger, etc.) and other programs such as cURL command lines.

Format Support

We currently support:

  • Swagger v2.0 (in/out)
  • RAML v1.0 (in/out)
  • Postman Collection v2.0 (in/out)
  • Paw v3.1 (in/out)

We intend to support:

  • Swagger v3.0
  • RAML v0.8
  • Postman Collection v1.0
  • Postman Dump v1.0
  • Insomnia v3.0
  • API Blueprint
  • and many more.

Installation

You can install this library in two different ways.

Install via NPM/Yarn

$ yarn add api-flow
# or
$ npm install api-flow

Install from source

Just run:

git clone https://github.com/luckymarmot/API-Flow.git
cd API-Flow
yarn install
make

This will install the node module dependencies, but you will need to build API-Flow for the different environments that you need:

# use TARGET="node" if you only want the node library
make runners TARGET="node web webworker"

You can use the following command to compile different extensions.

# use TARGET="swagger" if you only want the swagger bindings
make transfer TARGET="swagger raml1 postman2"

Usage

Standard Library

const ApiFlow = require('api-flow').default; // if from yarn/npm
const ApiFlow = require('./dist/node/api-flow.js').default; // if from `make runners TARGET="node"`

const path = require('path');

const options = {
    source: {
        format: 'swagger',
        version: 'v2.0'
    },
    target: {
        format: 'raml',
        version: 'v1.0'
    }
}

const promise = ApiFlow.transform({
  options,
  uri: path.resolve(__dirname, './my_super_swagger.yml')
})

promise.then((data) => {
  // do some cool stuff with the data
})

User Interface

API-Flow is one of the main components of Console.REST. If you're an API user, you can easily use https://console.rest/ to convert API description files. If you're an API provider, you can add a button to your API docs to let your users open and play with your API in client apps including Paw or Postman.

Contributing

Read CONTRIBUTING.md for more tips on testing and contributing.

Our sole requirement is that organizations that want to extend API-Flow to support their format write both a parser and a serializer, and not simply a serializer.

Documentation

You can find more information about the internal structure of API-Flow in src. We've also created a set of templates to help speed up the extension process: loader, parser, and environment

License

This repository is released under the MIT License. Feel free to fork, and modify! Copyright © 2016 Paw Inc.

Contributors

See Contributors.