Commit Graph
12 Commits
Author SHA1 Message Date
Bingbing b266c3c6f1 feat(examples): add example model and authoring
## Background

A request can only keep its latest response, so a request/response pair worth keeping has nowhere to live. This adds an Example document: a full snapshot of a request and a response, stored next to the request, listed in the sidebar and edited in its own tab.

## Changes

- Add the `Example` model (`exp_` prefix) with zod schemas for the request snapshot, the response snapshot, the client patch and the sidebar summary. Register it with the database, type maps, tree metadata and sync flags, so examples can be duplicated and synchronized.
- Add `services.example` (list, get, list by parents, create, update, remove, duplicate, create from request) and expose examples from the workspace data service.
- Extend the workspace children cache with example summaries and add a per-example query that carries the bodies, so workspace-wide reads stay small. The database change listener refreshes or drops an open example.
- Export and import examples in v5 files, including the generated 5.1 schema, and include them in Git sync.
- Add the example route and editor: request pane reusing the HTTP editors, response pane, breadcrumb entry under the parent request and redirect for stale URLs.
- Add example rows to the sidebar with collapse, drag and drop and rename, and give the tab a code icon instead of a method badge.
- Cover the model, services, cache and file format with unit tests and add a smoke test.

Refs INS-3997
2026-10-29 16:39:38 +08:00
Kent Wang 992605adf9 fix: Loose the id meta check for certain request models (#10656)
* loose the id meta id check

* update schema
2026-10-26 14:43:34 +08:00
Curry YangandClaude Opus 5 59d832ba10 Fix/socket io&websocket payload in export (#10634)
* fix: carry Socket.IO and WebSocket payloads through the v5 format [INS-3123]

A Socket.IO request's body (event name, ack, args) lives in its own
SocketIOPayload document rather than on the request, and the Insomnia v5
YAML format did not represent it at all. WebSocketPayload has the same
shape and the same gap.

Duplicating a collection goes through a v5 export/import round-trip, so
the payload was silently dropped and the copy came back with an empty
Body tab while url and headers survived.

The same gap is worse under Git Sync projects: `deleteOrphans` removes
every workspace descendant that is `canSync` and absent from the imported
file, and the importer could never produce a payload. A `git pull`, a
checkout, an edit to any part of the YAML, or merely restarting the app
therefore deleted them. Editing a payload in the app never wrote to disk
either, since the exported YAML did not change, so those edits only ever
existed in the database until the next sync removed them.

Both request nodes now carry an optional `body` holding the payload
document's own id, so a re-import updates the same document instead of
orphaning it. An untouched payload is omitted entirely: opening a
Socket.IO request creates an empty payload document, and writing that out
would add a spurious block and a git diff to every repository.

The branches of `RequestCollectionSchema` are told apart only by the
`meta.id` prefix, and `z.object` strips unknown keys rather than
rejecting them, so a node without `meta` matched the WebSocket branch and
lost its Socket.IO-only keys — `eventListeners` already went this way.
Extend the existing `z.undefined()` guard idiom to cover them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix: export Socket.IO requests from design documents

The design-scope export filter listed request groups, HTTP, WebSocket and
gRPC requests but not Socket.IO ones, so a Socket.IO request created in a
design document vanished from its YAML.

Under a Git Sync project that is data loss rather than a missing field:
the request is absent from the imported file, so `deleteOrphans` removes
the request document itself on the next sync.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* test(smoke): assert the Socket.IO body survives import

The fixture had a Socket.IO request whose body the v5 format could not
express, so the smoke test connected and sent nothing. Give it an event
name and a payload, and assert both are populated after importing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix comment

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-10-22 07:30:58 +00:00
Curry YangandClaude Opus 5.5 1a5a33aaed fix: keep confidential flags through v5 export/import and Git Sync (#10632)
* fix: keep confidential flags through v5 export/import and Git Sync

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* update schema

* fix comment

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 06:31:11 +00:00
Kent Wang eb0b49f7a3 feat: Migrate collection and document workspace zod schema and type definitions- #10520 (#10582)
* migrate request related p2
- grpc-request
- cookie-jar
- fix ts errors

* add unit test to check field mismatch
* migrate request group model
* migrate the socket io request and import parser
* migrate websocket schema and fix ts error
* fix order issue and add unit tests
2026-10-15 13:45:30 +08:00
Kent Wang 0cb82a2d16 feat: Migrate mcp request and related model types using zod (#10526)
* migrate mcp request and mcp collection schema and definitions

* fix key order issue of mcp request

* remove useless comment

* update schema
2026-10-14 11:00:25 +08:00
Kent Wang b108dbbe58 feat: Migrate mock-server and mock-route zod schema and type definitions (#10520)
* migrate mock-server and mock-route zod schema and type definitions

* modify from comment

* fix sort order and ci failure

* modify comment
2026-10-13 15:59:57 +08:00
Curry Yang 27457eeb93 feat: change data model to support confidential control (#10479)
* feat: add confidential environment variable metadata

* feat: move option

* del tooltip

* update schema
2026-10-13 11:29:06 +08:00
Kent Wang abbf55892e fix: Environment schema git export order issue (#10580)
* fix environment export order

* update schema json with correct order
2026-10-09 11:45:31 +08:00
Kent Wang a17a1a0ebb feat: Unify and migrate environment model to use Zod schema and infer type (#10516)
* unify and migrate environment model using zod and infer type from zod schema
* fix issues from comment
* commit missing parse part
* fix type failures
2026-10-08 16:00:08 +08:00
Kent Wang 36ac23d851 feat: Merge document and collection workspace and add settings to hide legacy test (#10460)
add initial settings for legacy test
add initial check for legacy unit test suites
show dropdown
remove spec route and merged with default debug page
showing document as collection
remove document term in UI
fix lint issue
fix ut failures
2026-09-10 07:01:24 +00:00
Pavlos Koutoglou a81ac68c39 feat: publish Insomnia file JSON Schema [INS-2794] (#10154)
* Modify the script in package.json

* Add script to generate the schema

* Schema generation docs

* Add CI check

* Generate the schema
2026-07-02 14:21:42 -04:00