Skip to content

OpenAPI: split import into URL and file commands with e2e tests#6

Merged
MelbourneDeveloper merged 17 commits into
mainfrom
OpenAPI
Mar 15, 2026
Merged

OpenAPI: split import into URL and file commands with e2e tests#6
MelbourneDeveloper merged 17 commits into
mainfrom
OpenAPI

Conversation

@MelbourneDeveloper

Copy link
Copy Markdown
Collaborator

TLDR;

Split the single OpenAPI import button into two: cloud icon for URL import (downloads spec via HTTPS) and file icon for local file import. Added context menu commands, response/request headers in panels, and e2e tests with real network calls.

Details

  • Two import commands: napper.importOpenApiUrl (cloud icon) downloads an OpenAPI spec from a URL; napper.importOpenApiFile (file icon) picks a local spec file
  • URL download: HTTPS with redirect following, error handling for 4xx responses
  • Context menus: add-to-playlist, duplicate, delete, copy path, enrich with AI
  • Response panel: now shows request headers alongside response headers
  • Playlist panel: shows request/response headers per step
  • Report generator: includes request/response headers in HTML reports
  • F# Output.fs: additional output formatting
  • E2e tests: real network calls to petstore swagger URL, 404 error handling, redirect following, temp file creation

How do the tests prove the change works

  • downloadSpec fetches valid OpenAPI from petstore URL — makes a real HTTPS call to petstore3.swagger.io, parses the JSON, asserts it has openapi version field and paths with entries
  • downloadSpec returns error for 404 URL — hits httpbin.org/status/404, asserts the result is an error with the correct prefix
  • downloadSpec follows redirects — uses httpbin.org redirect-to endpoint, verifies the final response is valid OpenAPI
  • saveTempSpec writes file and returns path — writes to a real temp dir, reads back, asserts content matches
  • saveTempSpec overwrites existing file — writes twice, asserts second content wins
  • Command registration tests verify both napper.importOpenApiUrl and napper.importOpenApiFile are registered

MelbourneDeveloper and others added 17 commits February 27, 2026 20:25
Resolve conflicts keeping OpenAPI branch's refactored code:
- pr.yml: keep both ReportGenerator and dotnet-script tool installs
- package.json: keep icon on importOpenApi command
- constants.ts: keep all OpenAPI + numeric constants
- extension.ts: keep refactored module structure
- csx/playlist e2e tests: keep extractStepLines helper usage
- openApiGenerator.ts: removed (generation moved to F#)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…essage

These messages block indefinitely on headless CI (xvfb). Changed to fire-and-forget
with void operator, matching the pattern used before this branch. Added
allowAsStatement to no-void eslint rule to support this pattern.
@MelbourneDeveloper MelbourneDeveloper merged commit e71a91d into main Mar 15, 2026
3 checks passed
@MelbourneDeveloper MelbourneDeveloper deleted the OpenAPI branch March 15, 2026 19:29
MelbourneDeveloper added a commit that referenced this pull request Mar 15, 2026
# TLDR;

Split the single OpenAPI import button into two: cloud icon for URL
import (downloads spec via HTTPS) and file icon for local file import.
Added context menu commands, response/request headers in panels, and e2e
tests with real network calls.

# Details

- **Two import commands**: `napper.importOpenApiUrl` (cloud icon)
downloads an OpenAPI spec from a URL; `napper.importOpenApiFile` (file
icon) picks a local spec file
- **URL download**: HTTPS with redirect following, error handling for
4xx responses
- **Context menus**: add-to-playlist, duplicate, delete, copy path,
enrich with AI
- **Response panel**: now shows request headers alongside response
headers
- **Playlist panel**: shows request/response headers per step
- **Report generator**: includes request/response headers in HTML
reports
- **F# Output.fs**: additional output formatting
- **E2e tests**: real network calls to petstore swagger URL, 404 error
handling, redirect following, temp file creation

# How do the tests prove the change works

- `downloadSpec fetches valid OpenAPI from petstore URL` — makes a real
HTTPS call to petstore3.swagger.io, parses the JSON, asserts it has
`openapi` version field and `paths` with entries
- `downloadSpec returns error for 404 URL` — hits
httpbin.org/status/404, asserts the result is an error with the correct
prefix
- `downloadSpec follows redirects` — uses httpbin.org redirect-to
endpoint, verifies the final response is valid OpenAPI
- `saveTempSpec writes file and returns path` — writes to a real temp
dir, reads back, asserts content matches
- `saveTempSpec overwrites existing file` — writes twice, asserts second
content wins
- Command registration tests verify both `napper.importOpenApiUrl` and
`napper.importOpenApiFile` are registered

---------
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.

1 participant