Repository navigation
Add sample: mock an API from its OpenAPI spec (OpenApiMockResponsePlugin) - #74
waldekmastykarz wants to merge 2 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Validation failed!File: samples/openapi-mock-responses/assets/sample.json
|
There was a problem hiding this comment.
🟡 Changes recommended
The sample has a missing screenshot asset, incorrect mock-file metadata, and setup instructions that omit entering the sample directory, which can prevent its configuration from loading.
3 open issues
What changed in this PR
Adds an OpenAPI-driven mocking sample for Dev Proxy, addressing #73 with a fictional Contoso Store API and optional local language model support. The sample targets the unreleased v4.1.0.
Changes:
- Defines API operations with explicit examples and schema-only responses.
- Configures
OpenApiMockResponsePluginand documents request matching, response generation, caching, and curl usage. - Adds gallery metadata and a recommended VS Code extension.
| File | Description |
|---|---|
samples/openapi-mock-responses/README.md |
Explains setup, usage, and mock response behavior. |
samples/openapi-mock-responses/assets/sample.json |
Adds sample gallery metadata and references. |
samples/openapi-mock-responses/.vscode/extensions.json |
Recommends the Dev Proxy Toolkit extension. |
samples/openapi-mock-responses/.devproxy/devproxyrc.json |
Enables OpenAPI mocking and local language model support. |
samples/openapi-mock-responses/.devproxy/contoso-api.yaml |
Defines product, customer, and order operations and response schemas. |
Review effort: Balanced
| "name": "screenshot.png", | ||
| "type": "image", | ||
| "order": 100, | ||
| "url": "https://raw.githubusercontent.com/pnp/proxy-samples/main/samples/openapi-mock-responses/assets/screenshot.png", |
There was a problem hiding this comment.
Acknowledged, and already called out in the PR description. The screenshot can only be captured once Dev Proxy v4.1.0 with OpenApiMockResponsePlugin (dotnet/dev-proxy#2036) is released. It will be added before this PR is merged, so I'm leaving this thread open as a tracker.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Validation failed!File: samples/openapi-mock-responses/assets/sample.json
|
There was a problem hiding this comment.
🔵 Needs a closer look
The sample relies on unreleased Dev Proxy v4.1.0 and the unmerged plugin in dotnet/dev-proxy#2036, leaving required schema and end-to-end validation unavailable before merge.
2 resolved since last review
Review effort: Balanced


Closes #73
Adds the
openapi-mock-responsessample, which shows how to mock an API from its OpenAPI spec using Dev Proxy's newOpenApiMockResponsePlugin(dotnet/dev-proxy#2036).What's included
.devproxy/contoso-api.yaml: OpenAPI spec for a fictional Contoso Store API. Some operations have examples and others only have schemas, so you can see every source a response body can come from..devproxy/devproxyrc.json: enablesOpenApiMockResponsePluginwithspecFileand turns onlanguageModel(for example Ollama). When no model is available, the plugin falls back to values based on schema types.assets/sample.jsonmetadata and.vscode/extensions.json.Notes
$schemaURLs return 404 until Add OpenApiMockResponsePlugin to mock APIs from OpenAPI specs dotnet/dev-proxy#2036 is merged and the version ships, so this PR should wait for the release.assets/screenshot.pngis still missing. It needs to be captured once v4.1.0 is available.