1
0 Comments

OpenAPI DevTools: Chrome extension that generates API specs for any app or website

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

an image of the app in action

  • 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

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.

Contribute

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

on November 12, 2023
Trending on Indie Hackers
6 weeks solo, 2 rejections, finally live but nobody told me marketing would be this hard User Avatar 91 comments Building ExpenseSpy solo, no funding — launching June 17 on iOS & Android User Avatar 39 comments Hi IH — quick update. The MVP is live. User Avatar 34 comments I built a $5/1k-listing CRE data API because CoStar is overkill for first-pass scans User Avatar 18 comments Day 7: 51 people answered my question. I wasn't ready for what they said. User Avatar 18 comments Building LinkCover – Day 3: Payment is live. No more building, time to sell. User Avatar 12 comments