OpenAPI Devtools is a free Chrome extension that automatically generates an OpenAPI 3.1 specification for any app or website. It is the spiritual successor to at-your-service and comes with a complete architectural redesign tuned for performance.

It uses the chrome.devtools.network API and operates on requests in the HAR format. The extension requires no permissions, rather it receives a copy of each request that triggers while the tool is open. It converts these requests into a schema representation.

But the killer feature is the ability to parameterise paths. So if you have requests /posts/1, /posts/2, ... that each contain variable response data, you can merge all of these requests into a single endpoint by clicking on either the 1 in the first request, or 2 in the second. Then you’ll have a single endpoint /posts/:param1.

Use Cases

  • API Discovery: forget assumptions and forego guesswork. See what an API is really doing
  • Spec Generation: there are dozens of server-based API spec generators. OpenAPI DevTools is the first tool that can generate an API spec instantly on the client
  • Reverse Engineering: gain insight into the inner workings of APIs and find information of interest
  • Learning: learn about APIs, specifications, the importance of information, and other details

How it Works

a screenshot of openapi devtools

Once the tool is enabled it receives a copy of each Request in the HAR 1.2 file format. Each request is routed to an “endpoint”, the location of which is determined by the URL. It uses a Radix tree powered by radix3 to route requests to their destination.

Each endpoint contains a single specification for five key values. These are request headers, request bodies, response headers, response bodies, and query parameters. Each value is JSON Schema. When a new request comes in that routes to the same endpoint, the new values are merged into the schema of the old values. That way it accounts for APIs that respond with different data for the same request URL, method, and status code.

To parameterise paths, the tool leverages the Radix tree that routes requests to endpoints. When a part in a pathname is parameterised the app performs a search in the tree for endpoints that would match it. It then removes those endpoints, merges their data, and inserts the newly parameterised endpoint.

Next Steps

There have been some excellent suggestions that I have implemented. If you have an idea, please raise the suggestion.