Skip to content

Adds api-inventory preset for recording an app's API calls in CI - #75

Merged
waldekmastykarz merged 2 commits into
pnp:mainfrom
waldekmastykarz:api-inventory-preset
Nov 5, 2026
Merged

waldekmastykarz merged 2 commits into
pnp:mainfrom
waldekmastykarz:api-inventory-preset

Conversation

@waldekmastykarz

Copy link
Copy Markdown
Member

Adds the api-inventory preset, retrievable with devproxy config get api-inventory, for recording which APIs an app calls, for example in CI.

Resolves dotnet/dev-proxy#2082

What's included

  • .devproxy/devproxyrc.json: UrlDiscoveryPlugin, ExecutionSummaryPlugin, JsonReporter, MarkdownReporter, and HarGeneratorPlugin (disabled by default, opt in). Uses asSystemProxy: false and the placeholder urlsToWatch https://api.contoso.com/*, which you override with --urls-to-watch.
  • record-api-calls.sh: a CI script that starts Dev Proxy with --detach --output json, gets the API token with devproxy api token --pid, gets the root certificate, starts and stops recording through the API around the app command, and shuts Dev Proxy down through the API. It returns the app's exit code.
  • README that documents the same API-driven sequence step by step, for pipelines that can't use the script.

Validation

  • Schema validation passes for the config file and each plugin config section (v4.0.0 schemas), and sample.json validates against templates/metadata-schema.json.
  • I ran record-api-calls.sh end to end with Dev Proxy 4.0.0, CI=true, and a Node 26 app that calls jsonplaceholder. The app's requests were recorded, the URL discovery and execution summary reports were written as JSON and Markdown (and the HAR file when the plugin was enabled), Dev Proxy stopped, and a non-zero app exit code was passed through.

Related to dotnet/dev-proxy#2082

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The script can leave Dev Proxy running when token lookup fails and overwrite the app’s nonzero exit code when stopping recording also fails.

2 open issues
What changed in this PR

Adds an api-inventory preset to the Dev Proxy samples collection for recording an app’s API calls in CI without modifying requests or responses.

Changes:

  • Configures URL discovery and request summaries with JSON and Markdown reports, plus optional HAR output.
  • Adds a Bash script to manage recording around an app command.
  • Documents setup and manual API-driven steps, and adds gallery metadata.
File Description
samples/​api-inventory/​record-api-calls.sh Automates proxy startup, certificate retrieval, recording, and shutdown.
samples/​api-inventory/​README.md Explains installation, CI usage, and report options.
samples/​api-inventory/​assets/​sample.json Registers the preset’s metadata for the samples gallery.
samples/​api-inventory/​.devproxy/​devproxyrc.json Defines recording plugins and reporters without system-proxy registration.

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@waldekmastykarz
waldekmastykarz requested a balanced review from Copilot November 5, 2026 10:54
@waldekmastykarz
waldekmastykarz merged commit cb064e9 into pnp:main Nov 5, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The API inventory preset has no active review issues blocking approval.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a samples-gallery preset for recording an app's API calls in CI

2 participants