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:
In the configuration file, enable the
OpenApiSpecGeneratorPlugin
plugin:{ "plugins": [ { "name": "OpenApiSpecGeneratorPlugin", "enabled": true, "pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll" } ] // [...] shortened for brevity }
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.
Start Dev Proxy:
devproxy
Start recording requests by pressing
r
Perform the requests you want to include in the OpenAPI spec
Stop recording requests by pressing
s
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
.