Generate OpenAPI Specifications in Real Time for Any API
Read the Whitepaper »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
demo.mp4
Demystify is a suite of tools designed to help understand API behaviour. It generates accurate OpenAPI 3.1 specifications in real time from live network traffic or HAR files. The desktop app achieves this with a built-in proxy, while the browser extension works automatically for all requests in a given tab. The CLI tool works directly on files, and the library can be used in other contexts such as middleware to programmatically generate API specifications.
It identifies path parameters automatically without manual intervention. Data in the generated specification reflects all observed information across multiple status codes and mime types for request and response headers, bodies, query parameters, path parameters, and cookies for each endpoint.
- Everything in OpenAPI DevTools
- Automated identification of path parameters
- A desktop app that uses a proxy to generate specifications in real time (e.g. a real time version of mitm2swagger that supports OpenAPI 3.1)
- A website and command line tool that generates OpenAPI specifications from HAR files (e.g. har-to-openapi or openapi-autospec)
- A library that learns from network traffic in real time, discovers API topography, and can generate a representation of an API such as the OpenAPI standard
- An integrated API client that populates automatically and can generate code such as curl commands via Scalar
- The capacity to generate different versions of OpenAPI or other HTTP-based standards such as GraphQL
Demystify is available in a variety of formats on various platforms.
The desktop app has a built in proxy that captures network traffic and generates OpenAPI specifications in real time. It is designed to be simple and quick to use, and specifies a local port to listen to and a local or remote host to forward to.
The browser extension can be accessed in the DevTools of your chosen browser. While the tool is open it will record all network requests in the same tab and generate OpenAPI specifications in real time from network traffic.
I have submitted this to Chrome Web Store and am awaiting approval. After that the link will be updated.
Locate the tool in Chrome DevTools.
Locate the tool in Firefox DevTools.
npx demystify --input <somefile.har>
Usage: demystify [options]
Example: demystify --input ./example.har
Options:
-h, --help Show help information
-i, --input <string> A path to a HTTP Archive file (HAR)
-s, --stdout <boolean> Optional: when "true", write a JSON array to stdout instead of writing files
This command writes OpenAPI 3.1 specifications to the current directory
Names of these files follow the convention {host}.{type}.json
Example host: api.example.com
Example type: openapi
npm install demystify-lib
import { Representor } from "demystify-lib";
// Instantiate the representor
// Which "represents" an API in a particular way, such as OpenAPI or GraphQL
const representor = new Representor();
// Call upsert with a valid HAR entry to add it to the representor
// Repeat as many times as desired
representor.upsert(/* harEntry */);
// Call generate on the rest property of representor to generate OpenAPI documents
const doc = representor.rest.generate();
See test files for more information on usage.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
- Fork the Project
- Install and build
npm i && npm run build
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Test your changes, e.g. by loading the browser extension with
npm run dev
or validating the build inapps/browser/.output
- Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.