Generate an OpenAPI spec

Dev Proxy allows you to generate an OpenAPI spec from the intercepted API requests and responses. Using Dev Proxy you can quickly create an OpenAPI spec for an existing API and benefit from the tooling that supports OpenAPI.

To generate an OpenAPI spec using Dev Proxy:

  1. In the configuration file, enable the OpenApiSpecGeneratorPlugin plugin:

    {
      "plugins": [
        {
          "name": "OpenApiSpecGeneratorPlugin",
          "enabled": true,
          "pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll"
        }
      ]
      // [...] shortened for brevity
    }
    
  2. In the configuration file, to the list of URLs to watch, add the URL of the API for which you want to generate an OpenAPI spec:

    { 
      "urlsToWatch": [
        "https://api.example.com/*",
      ]
      // [...] shortened for brevity
    }
    

    Tip

    To create better OpenAPI specs, consider using a local language model with Dev Proxy. For more information, see Use a local language model.

  3. Start Dev Proxy:

    devproxy
    
  4. Start recording requests by pressing r

  5. Perform the requests you want to include in the OpenAPI spec

  6. Stop recording requests by pressing s

  7. Dev Proxy generates an OpenAPI spec and saves it to a file in the current directory. Dev Proxy names the file after the host name of the API followed by the current date and time, for example: api.example.com-20231219091700.json.

Screenshot of two command prompt windows. One shows Dev Proxy recording API requests. The other shows the generated OpenAPI spec.