Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Dev Proxy allows you to generate a TypeSpec file from the intercepted API requests and responses. Using Dev Proxy you can quickly create a TypeSpec file for an existing API and benefit from the tooling that supports TypeSpec.
To generate a TypeSpec file using Dev Proxy:
In the configuration file, enable the
TypeSpecGeneratorPlugin
plugin:{ "plugins": [ { "name": "TypeSpecGeneratorPlugin", "enabled": true, "pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll" } ] // [...] shortened for brevity }
Optionally, configure the plugin in the configuration file:
{ "typeSpecGeneratorPlugin": { "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.27.0/typespecgeneratorplugin.schema.json", "ignoreResponseTypes": false } // [...] 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 a TypeSpec file:
{ "urlsToWatch": [ "https://api.example.com/*", ] // [...] shortened for brevity }
Tip
To create better TypeSpec files, consider using a local language model with Dev Proxy. Using a local language model, the TypeSpecGeneratorPlugin generates clearer operation IDs and descriptions, giving you a better starting point for your TypeSpec file. 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 TypeSpec file
Stop recording requests by pressing
s
Dev Proxy generates a TypeSpec file 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.tsp
.
Next steps
Learn more about the TypeSpecGeneratorPlugin.