Urgent.News

What's breaking now, across thousands of outlets.

Tech

What is an OpenAPI spec, and how to generate one from your web app's traffic

An OpenAPI spec is a JSON or YAML document that describes an HTTP API in a standard, language-agnostic format, listing its paths, methods, parameters, request bodies and responses. If your API has no spec yet, you can generate a first draft from real traffic by recording the requests your web app makes in Chrome, exporting them as a HAR file, and converting that file with an open-source tool such…

An OpenAPI spec is a JSON or YAML document that describes an HTTP API in a standard, language-agnostic format. It lists the API's paths, methods, parameters, request bodies, and responses. If your API lacks a spec, you can generate a first draft from real traffic by recording requests in Chrome, exporting them as a HAR file, and converting that file using tools like mitmproxy2swagger. Review the draft manually, as traffic reveals only what was actually called.

To generate an OpenAPI spec from web app traffic, open Chrome's Developer Tools, navigate to the Network panel, check "Preserve log", and use the Fetch/XHR filter. Reload the page to capture all desired API calls. Create, modify, and delete test data to ensure every endpoint and HTTP method appears in the HAR file. Export the HAR file and run it through mitmproxy2swagger to create a draft spec.

Review the spec manually, removing any unwanted elements, fixing templates, and adding missing information such as descriptions, error responses, and authentication details.

OpenAPI, formerly known as the Swagger Specification, is a standard for describing HTTP APIs. It is maintained by the OpenAPI Initiative, which is part of the Linux Foundation. The latest version is 3.2.1. An OpenAPI spec is a single JSON or YAML file with an openapi version field, an info object, and either paths, components, or webhooks. Path parameters are defined in curly braces, and generators may incorrectly infer some parameters.

While traffic provides real requests and responses, it lacks certain elements typically found in a spec, such as endpoints that were never triggered, admin screens, error paths, and rarely used features. Schemas are inferred from examples, so fields with null values or optional fields may be misrepresented. Paths need careful checking, and authentication is usually missing. Add this information manually.

Be cautious when generating a spec from production traffic. Avoid including sensitive data such as cookies, set-cookies, authorization headers, request and response bodies, and tokens in the HAR file. If you need examples, use a test account with fake data. Generate an OpenAPI spec only from apps you own, test, or are authorized to test, and prefer using a staging environment over production. The resulting spec can be used to publish documentation, generate client and server stubs, and test the API against the spec in CI.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Next.js Security Update October 2026: Patch the use cache RCE, SVG sharp RCE and Server Actions DoS

The Next.js security update of October 14, 2026 fixes three vulnerabilities: two critical unauthenticated remote code execution (RCE) bugs, one in use cache and one in SVG image optimization through…

  • Two critical RCE vulnerabilities patched in Next.js 16.4.1 or later
  • SVG sharp RCE and Server Actions DoS issues resolved in update
  • Verify Next.js and sharp versions post-patch before redeployment

Your app unlocked the purchase. Did Google Play get the confirmation?

Someone buys a chapter in your Android app. It opens, and they start reading. From the app screen, the purchase looks finished.

  • Purchase may appear complete in app but must be confirmed by Google Play
  • Non-acknowledged purchases result in refund and entitlement revocation
  • Test purchase process with license tester and Play test payment method

Oracle's October CPU: six 10.0s, and why T3 is still answering on your perimeter

Oracle's October CPU: six 10.0s, and why T3 is still answering on your perimeter Oracle published its October 2026 Critical Patch Update on the night of 20 October, covering 1,295 vulnerabilities…

  • Oracle released October 2026 Critical Patch Update on October 20
  • Six vulnerabilities rated 10.0, remotely exploitable without authentication
  • T3 and IIOP protocols not typically inspected by network security

What is a HAR file, and how to get one from Chrome

A HAR file (HTTP Archive) is a JSON file that records every network request a browser made while a page was open, including URLs, headers, request bodies, responses and timings.

  • HAR file is JSON record of browser's network requests
  • Includes URLs, headers, responses, timings
  • Used by support teams to troubleshoot browser issues

More from Friday 23 October →