@postman/postman-plugin 0.3.0 → 0.4.1-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +46 -9
  2. package/dist/hosts/antigravity.js +47 -0
  3. package/dist/hosts/codex-hooks.js +68 -0
  4. package/dist/hosts/codex.js +87 -8
  5. package/dist/hosts/copilot.js +60 -0
  6. package/dist/hosts/index.js +3 -1
  7. package/dist/json-rpc.js +113 -0
  8. package/dist/system.js +40 -3
  9. package/mcp.pi.json +2 -2
  10. package/package.json +1 -1
  11. package/skills/ai-readiness/SKILL.md +40 -44
  12. package/skills/api-discovery/SKILL.md +64 -145
  13. package/skills/api-discovery/reference/orbit.md +17 -5
  14. package/skills/api-documentation/SKILL.md +41 -46
  15. package/skills/api-engineer/SKILL.md +78 -23
  16. package/skills/api-mocking/SKILL.md +117 -163
  17. package/skills/api-monitoring/SKILL.md +52 -129
  18. package/skills/api-simulation/SKILL.md +130 -178
  19. package/skills/api-simulation/reference/sim_yaml_schema.md +41 -103
  20. package/skills/api-testing/SKILL.md +48 -95
  21. package/skills/bootstrap/SKILL.md +123 -224
  22. package/skills/ci-integration/SKILL.md +53 -113
  23. package/skills/collection-schema-v3/SKILL.md +43 -204
  24. package/skills/collection-schema-v3/reference/http.md +150 -0
  25. package/skills/datasets/SKILL.md +89 -315
  26. package/skills/datasets/reference/spreadsheets.md +25 -0
  27. package/skills/flows/SKILL.md +57 -206
  28. package/skills/flows/reference/flow_cli_flags.md +3 -2
  29. package/skills/performance-testing/SKILL.md +46 -62
  30. package/skills/performance-testing/references/jmeter-import/README.md +82 -0
  31. package/skills/performance-testing/references/jmeter-import/import-report.md +52 -0
  32. package/skills/performance-testing/references/jmeter-import/mapping-table.md +95 -0
  33. package/skills/performance-testing/references/jmeter-import/postman-perf-capabilities.md +56 -0
  34. package/skills/performance-testing/references/jmeter-import/script-translation.md +97 -0
  35. package/skills/postman-mcp-server/SKILL.md +53 -59
  36. package/skills/postman-mcp-server/references/docs.md +0 -1
  37. package/skills/postman-mcp-server/references/learn.md +10 -9
  38. package/skills/postman-mcp-server/references/mock.md +0 -1
  39. package/skills/postman-mcp-server/references/search.md +0 -1
  40. package/skills/postman-mcp-server/references/security.md +0 -1
  41. package/skills/postman-mcp-server/references/setup.md +0 -1
  42. package/skills/postman-mcp-server/references/sync.md +0 -1
  43. package/skills/postman-mcp-server/references/test.md +0 -1
  44. package/skills/variables/SKILL.md +44 -87
  45. package/skills/webhook-testing/SKILL.md +103 -0
  46. package/skills/webhook-testing/reference/forwarding.md +10 -0
  47. package/skills/webhook-testing/reference/outbound_webhooks.md +25 -0
  48. package/skills/webhook-testing/reference/webhook_scripts.md +163 -0
@@ -1,122 +1,62 @@
1
1
  ---
2
2
  name: ci-integration
3
- description: Common CI integrations that can added as independent pass/fail gates. Use when the user asks to "add Postman to CI," "run this collection on every PR," "fail the build on a governance violation," or "push to the postman cloud workspace after merge to main", "add some api related operation in my Github actions".
3
+ description: Use when adding API tests, structural or governance lint, or AI-readiness gates to CI, or publishing reviewed API artifacts to a Postman workspace after merge. Makes contract checks repeatable and separates validation from shared workspace changes. Use for requests such as "run this collection on every PR".
4
4
  ---
5
5
 
6
6
  # CI Integration
7
7
 
8
- ## Overview
9
- These are some common workflows that one can add in their CI pipeline leveraging postman cli.
10
-
11
- ## Run a collection — a gated pipeline step
12
-
13
- `postman collection run <path/id>` exits nonzero on a failed `pm.test`
14
- assertion, which is what makes it a usable gate — see `api-testing` for how
15
- that exit code actually gets set. What's CI-specific: `-r junit,html` (or
16
- `--reporter-*-export`) writes a report your CI provider can surface as
17
- build artifacts or test annotations, instead of leaving the result buried in
18
- a log. `--bail` stops the run early on the first failure when a fast signal
19
- matters more than a full report.
20
-
21
- ## Lint — pick the target that matches the gate you want
22
-
23
- Three verbs look interchangeable and aren't — only two of them apply your
24
- organization's governance rules, and the CLI's own `-h` output is where that
25
- becomes visible (no assumption below goes further than what it printed):
26
-
27
- | Want to check | Command | Applies org governance? |
28
- | --- | --- | --- |
29
- | One spec against your rules | `spec lint <spec> --workspace-id <id> -f error` | Yes, via `--workspace-id` |
30
- | One collection's structure/style | `collection lint <path> -f error` | **No** — this verb takes no `--workspace-id` at all |
31
- | The whole workspace: every entity plus `.postman/resources.yaml` | `workspace lint --workspace-id <id> -f error` | Yes |
32
-
33
- `collection lint` is a schema/style check only — running it and reporting
34
- "governance passed" overstates what it did. If the ask is "does this
35
- collection violate our rules," `workspace lint` is the one that actually
36
- answers it (and covers every collection in the repo in one pass); reach for
37
- bare `collection lint` only when there's no workspace to fetch rules from
38
- yet.
39
-
40
- ## Persist and share context — only after merge
41
-
42
- `postman workspace push -y` persists the merged repository's API context in
43
- the workspace for future work and enables sharing it with others. It is the one
44
- command in this skill that changes shared workspace state, so it belongs behind
45
- a merge-to-main trigger, not a PR trigger. `-y` skips confirmation prompts a
46
- non-interactive job can't answer. Leave `--no-prepare` off — the default
47
- prepare step is what assigns real IDs to entities that are new since the last
48
- push; skipping it because a run felt slow trades a few seconds for a push that
49
- silently fails to create anything new.
50
-
51
- `--push-strategy force-sync` mirrors the whole workspace, deleting any cloud
52
- entity with no local counterpart — genuinely destructive, and not the
53
- default for a reason. See Critical Rules before adding it to a merge job.
54
-
55
- ## AI readiness threshold
56
-
57
- `collection ai-readiness <path> --min-score <n>` and its spec-side
58
- counterpart `spec ai-readiness <path> --min-score <n>` (see `ai-readiness`
59
- skill) are a fourth, separate gate — they score AI-agent consumability, not
60
- test results or governance/structural style. Keep either in its own step:
61
- folding it into the same step as `run` or one of the `lint` verbs above
62
- hides which kind of check actually failed when the job goes red. Pick the
63
- verb that matches what's checked into the repo — `collection ai-readiness`
64
- for a git-synced collection, `spec ai-readiness` for an OpenAPI spec with no
65
- collection generated from it yet.
66
-
67
- ```yaml
68
- - run: postman collection ai-readiness ./postman/collections/My\ API --min-score 70
69
- ```
70
-
71
- ## Critical Rules
72
-
73
- 1. **Never collapse `run`, `lint`, and `ai-readiness` into one step, and
74
- never pass `-x`/`--suppress-exit-code` to a CI run.** One combined exit
75
- code hides which check broke; a suppressed one hides that anything broke
76
- at all.
77
- 2. **Gate `workspace push` to the merge event, never a PR event.** Everything
78
- else in this skill is read-only against the cloud; this is the one
79
- command that writes to it, so a PR-triggered push ships an unmerged
80
- branch's entities to the shared workspace.
81
- 3. **`--push-strategy force-sync` deletes cloud entities absent locally.**
82
- Only add it to a job whose explicit job is mirroring the workspace exactly,
83
- with that intent confirmed — never as the default merge step, where the
84
- default (create/update-only) strategy is the safe choice.
85
- 4. **Authenticate once, non-interactively:**
86
- `postman login --with-api-key "$POSTMAN_API_KEY"`, reading the key from
87
- the CI provider's secret store. Don't reach for `collection run`'s
88
- `--postman-api-key` as the general answer — it's US-region only — and
89
- `spec lint`/`workspace push` don't take it at all.
90
-
91
- ```yaml
92
- # WRONG — key committed in plain text, and scoped to one command anyway
93
- - run: postman collection run api.json --postman-api-key PMAK-abc123...
94
-
95
- # CORRECT — one non-interactive login, key from the provider's secret store
96
- - run: postman login --with-api-key "$POSTMAN_API_KEY"
97
- - run: postman collection run api.json
98
- - run: postman spec lint spec.yaml --workspace-id $WS -f error
99
- ```
100
- 5. **Never `newman run` in place of `postman collection run`.** The CLI is
101
- the supported runner every other skill here assumes; Newman forks the
102
- toolchain and skips whatever reporting/governance depends on the CLI
103
- specifically.
8
+ Versioned collections and specs let a PR carry its API checks beside the code
9
+ change. CI reruns those checks independently of the author's session, while
10
+ publishing after merge makes the reviewed contract available to teammates and
11
+ future work. **api-discovery** helps identify consumers the gate should cover;
12
+ the author's own passing tests do not establish cross-service compatibility.
13
+
14
+ 1. Select checks by the guarantee they establish:
15
+
16
+ | Guarantee | Gate |
17
+ | --- | --- |
18
+ | Saved behavioral assertions pass | `postman collection run <path-or-id>` |
19
+ | A collection's structure/style is valid | `postman collection lint <path> -f error` |
20
+ | A spec meets workspace governance rules | `postman spec lint <spec> --workspace-id <id> -f error` |
21
+ | Workspace entities and bindings pass lint/governance | `postman workspace lint --workspace-id <id> -f error` |
22
+ | Agent consumability meets an agreed threshold | `postman collection ai-readiness <path> --min-score <n>` or the spec equivalent |
23
+
24
+ Collection lint does not apply organization governance. Workspace-aware
25
+ lint evaluates the rules available to that workspace; it does not author
26
+ the policy. Confirm the intended rules are configured before claiming
27
+ compliance. Read command-specific `-h` for installed options.
28
+ 2. Keep gate results distinguishable so a failed build identifies behavior,
29
+ structure, governance, or readiness. Preserve nonzero exits; suppressing
30
+ them with `-x`/`--suppress-exit-code` removes the gate. For collection runs,
31
+ `-r junit,html` produces reviewable reports; `--bail` trades a complete
32
+ failure inventory for an earlier signal. See **api-testing** for assertion
33
+ semantics and **ai-readiness** for score limitations.
34
+ 3. Restore declared dependencies with `postman dependency install` when tests
35
+ use them. Choose the target deliberately: a mock checks behavior under a
36
+ model, while a live run sends real requests and can write data. PR gates
37
+ should use a suitable isolated target and credentials; being a test does
38
+ not make the command read-only.
39
+ 4. Authenticate only jobs that need workspace resources. Use the CI secret
40
+ store to supply `POSTMAN_API_KEY`, then
41
+ `postman login --with-api-key "$POSTMAN_API_KEY"`. A local-only gate need
42
+ not log in. Command-specific API-key flags are not a general replacement
43
+ for login across lint and push operations. Use **bootstrap** for unresolved
44
+ bindings, and **variables** for request credentials.
45
+ 5. Publish only the reviewed branch after its merge checks pass.
46
+ `postman workspace push -y` changes shared context; a PR-triggered push
47
+ would publish an unmerged contract. The normal prepare phase assigns IDs
48
+ to new entities, so `--no-prepare` can leave additions unpublished.
49
+ Inspect the intended diff and binding when configuring this job; `-y`
50
+ supplies noninteractive execution, not authorization for a different scope.
51
+ 6. Use the default create/update strategy unless exact mirroring is the
52
+ explicit requirement. `--push-strategy force-sync` can delete workspace
53
+ entities absent from the checkout, including resources managed elsewhere.
54
+ Follow **bootstrap**'s diff and consent boundary for that branch.
104
55
 
105
56
  ## Verification
106
57
 
107
- State each gate that ran and its individual result — not "CI passed," but
108
- which check ran, what it checked (governance vs. structure per the Lint
109
- table above, or AI-agent consumability for `ai-readiness`), and its exit
110
- code. If `workspace push` ran, confirm it was triggered by the merge event
111
- and not a PR event, state which push strategy was used, and report
112
- `Created`/`Updated` per entity rather than just "push succeeded." Confirm
113
- no secret value appears literally in the committed workflow file.
114
-
115
- ## Reference
116
-
117
- - `api-testing` skill — `collection run`'s exit-code semantics and reporter
118
- flags in full.
119
- - `collection-schema-v3` skill — what `workspace push` is actually pushing.
120
- - `bootstrap` skill — CLI resolution, workspace linking, `.postman/resources.yaml`.
121
- - `ai-readiness` skill — `collection ai-readiness`, `spec ai-readiness`, and
122
- their `--min-score` gate.
58
+ Validate the workflow's event conditions and secret references, then report
59
+ which gates actually ran, their targets and individual results. Distinguish a
60
+ locally checked workflow from an observed CI run. For publication, establish
61
+ the merge trigger, push strategy, created/updated entities, and conflicts;
62
+ a green job alone does not prove the intended artifacts became available.
@@ -1,210 +1,49 @@
1
1
  ---
2
2
  name: collection-schema-v3
3
- description: The reference for the git-native v3 collection file format — one YAML file per request/folder/example under postman/collections/, plus postman/environments/. Read before writing, editing, or generating any file in either directory by hand, or before debugging a `collection lint` failure. Covers the HTTP request/example/definition schema, environment schema, and the YAML/naming rules that make files parse — GraphQL, gRPC, WebSocket, Socket.IO, MQTT, MCP, and LLM request schemas are non-HTTP protocols and live in reference/other_protocols.md, read only when a collection actually uses one.
3
+ description: Use when writing or debugging local Postman v3 collection and environment YAML, including collection lint failures. Preserves the per-entity files, inherited context, and schema shapes that make API changes reusable and reviewable in Git. Use for requests such as "fix this request YAML".
4
4
  ---
5
5
 
6
6
  # Collection Schema (v3, Git-Native)
7
7
 
8
- ## Overview
9
-
10
- A v3 collection is a directory tree under `postman/collections/`, one file
11
- per entity — every request, every folder's metadata, every saved example is
12
- its own file. There is no single collection.json to open and edit; the
13
- directory structure itself *is* the collection.
14
-
15
- ```text
16
- postman/collections/
17
- bookstore api/
18
- .resources/
19
- definition.yaml (optional)
20
- get all books.resources/
21
- examples/
22
- 200 OK.example.yaml
23
- 400 Bad Request.example.yaml
24
- 500 Internal Server Error.example.yaml
25
- get all books.request.yaml
26
- get-book-by-id.request.yaml
27
- add new book.request.yaml
28
- authentication/
29
- .resources/
30
- definition.yaml (optional)
31
- signup.request.yaml
32
- login.request.yaml
33
- ```
34
-
35
- - Every folder under `postman/collections/` is a collection; it can contain
36
- subfolders and requests.
37
- - A folder or collection can have a `.resources/` directory — an optional
38
- metadata directory for that scope. `.resources/definition.yaml` holds the
39
- collection/folder's own metadata; request examples live under
40
- `.resources/<request-name>.resources/examples/`.
41
- - Never place a request file inside a `.resources/` directory — those are
42
- metadata-only.
43
-
44
- ## Definition file (`.resources/definition.yaml`)
45
-
46
- Optional metadata for a collection or folder:
47
-
48
- - `$kind: "collection"` — required, even for a folder's definition.
49
- - `name` — optional, defaults to the filesystem folder name.
50
- - `description` — optional.
51
- - `variables` — array of `{key, value, description?, disabled?}`. `value`
52
- must be a string; `disabled` a boolean.
53
- - `auth` — a single auth object `{type, credentials: [{key, value}, ...]}`,
54
- or an array for multiAuth: `[{id, name, type, credentials, rules?}, ...]`.
55
- - `scripts` — array of `{type, code, language: "text/javascript"}`. `type`
56
- is one of `http:beforeRequest`, `http:afterResponse`,
57
- `graphql:beforeQuery`, `graphql:afterResponse`, `grpc:beforeInvoke`,
58
- `grpc:onIncomingMessage`, `grpc:afterResponse`.
59
- - `order` — number, used for folder ordering.
60
-
61
- ## HTTP request (`*.request.yaml`)
62
-
63
- - `$kind: "http-request"` — required.
64
- - `name` — optional (see naming rules below for when to include it).
65
- - `order` — number; only used for relative comparison, so space values out
66
- (e.g. multiples of 1000) rather than packing them tight — a later
67
- insertion between two requests shouldn't force renumbering every sibling.
68
- - `url` — string, with `{{varName}}` variable syntax.
69
- - `method` — `GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS`.
70
- - `headers` — array of `{key, value, description?, disabled?}`.
71
- - `queryParams` — array of `{key, value, description?, disabled?}`.
72
- - `pathVariables` — array of `{key, value, description?}`.
73
- - `body` — `{type, content}`; `type` required whenever `body` is present.
74
- - Types: `json`, `formdata`, `urlencoded`, `text`, `xml`, `html`,
75
- `javascript`, `file`, `none`.
76
- - `json`/`text`/`xml`/`html`/`javascript`: `content` is a string.
77
- - `formdata`: `content` is an array of
78
- `{key, type: "text"|"file", value or src, contentType?, description?}`.
79
- - `urlencoded`: `content` is an array of `{key, value, description?}`.
80
- - `auth` — `{type, credentials}`.
81
- - `settings` —
82
- `{protocolVersion?, strictSSL?, followRedirects?, maxRedirects?, disabledSystemHeaders?}`.
83
- - `scripts` — array of `{type: "beforeRequest"|"afterResponse", code, language: "text/javascript"}`.
84
- - `examples` — optional, a relative path to the examples directory, e.g.
85
- `./.resources/<request-name>.resources/examples/`.
86
-
87
- ## HTTP example (`*.example.yaml`)
88
-
89
- - `$kind: "http-example"` — required.
90
- - `name` — optional.
91
- - `request: {url, method}`.
92
- - `response: {statusCode, statusText, headers: [{key, value}], body: {type, content}}`.
93
- - `order` — optional.
94
-
95
- Saved examples are what `collection ai-readiness` checks for — a request
96
- with no examples scores worse for agent consumption even if perfectly
97
- valid structurally.
98
-
99
- ## Environments (`postman/environments/*.environment.yaml`)
100
-
101
- Environment files are v3 YAML but are not collection entities: they do not use
102
- `$kind`. Before creating or editing one by hand, read
103
- [reference/environment.md](reference/environment.md) for the schema, secret
104
- handling, CLI-first edit commands, and a linted example.
105
-
106
- ## YAML rules
107
-
108
- Invalid YAML breaks parsing silently in confusing ways — when in doubt,
109
- single-quote it:
110
-
111
- 1. Single-quote any value containing `{{variables}}`:
112
- `url: '{{base_url}}/users'` — never leave it unquoted.
113
- 2. Single-quote values containing `: # & * ! [ ] { } > |`, e.g.
114
- `name: 'Health check: v2'`.
115
- 3. Multi-line content (JSON bodies, scripts, queries) uses a `|-` block
116
- scalar:
117
- ```yaml
118
- body:
119
- type: json
120
- content: |-
121
- {
122
- "name": "example"
123
- }
124
- ```
125
- 4. Quote strings that resemble booleans/numbers when a string is intended:
126
- `value: "true"`, `value: "123"`.
127
- 5. `order` must be a bare number, never quoted: `order: 1000`.
128
- 6. Single-quote file paths and use forward slashes only:
129
- `examples: './.resources/name.resources/examples'`.
130
-
131
- ## Naming rules
132
-
133
- - `<request-name>` (the filename stem before `.request.yaml`) must not
134
- contain `/ \ : * ? " < > |` — sanitize to `-`.
135
- - Include `name` in the file only when it differs from `<request-name>`
136
- (e.g. `name: 'Health/check'` inside `Health-check.request.yaml`, since the
137
- filename itself can't hold the `/`).
138
- - Filenames must be unique, case-insensitively, per directory.
139
-
140
- ## Worked example: "bookstore api"
141
-
142
- `postman/collections/bookstore api/get all books.request.yaml`
143
- ```yaml
144
- $kind: http-request
145
- method: GET
146
- url: '{{base_url}}/books'
147
- order: 1000
148
- ```
149
-
150
- `postman/collections/bookstore api/get-book-by-id.request.yaml`
151
- ```yaml
152
- $kind: http-request
153
- name: 'get book by :id'
154
- method: GET
155
- url: '{{base_url}}/books/:id'
156
- order: 2000
157
- pathVariables:
158
- - key: id
159
- value: '1'
160
- ```
161
-
162
- `postman/collections/bookstore api/add new book.request.yaml`
163
- ```yaml
164
- $kind: http-request
165
- method: POST
166
- url: '{{base_url}}/books'
167
- order: 3000
168
- headers:
169
- - key: Content-Type
170
- value: application/json
171
- body:
172
- type: json
173
- content: |-
174
- {
175
- "title": "Example Book",
176
- "author": "Jane Doe"
177
- }
178
- ```
179
-
180
- `postman/collections/bookstore api/.resources/definition.yaml`
181
- ```yaml
182
- $kind: collection
183
- name: Bookstore API
184
- variables:
185
- - key: base_url
186
- value: 'https://api.bookstore.com/v1'
187
- ```
188
-
189
- ## Critical Rules
190
-
191
- 1. **Every entity is its own file — there's no single collection.json to
192
- open.** A request, its parent folder's metadata, and its saved examples
193
- are three separate files, not sections of one document.
194
- 2. **Unquoted `{{variables}}` or special characters are the most common way
195
- a hand-written file fails to parse.** Single-quote per the YAML rules
196
- above rather than debugging a cryptic lint error after the fact.
197
- 3. **`order` is relative, not an index.** Don't renumber every sibling file
198
- to insert one request — leave headroom (spacing of 1000) from the start.
199
- 4. **This file covers HTTP only.** A collection using GraphQL, gRPC,
200
- WebSocket, Socket.IO, MQTT, MCP, or LLM requests needs
201
- [reference/other_protocols.md](reference/other_protocols.md) — don't
202
- guess those schemas from the HTTP shape above, they diverge in real ways
203
- (e.g. gRPC's `methodDescriptor`, LLM's `userPrompts`/`systemPrompts`).
204
-
205
- ## Reference
206
-
207
- - [Other request protocols](reference/other_protocols.md) — GraphQL, gRPC,
208
- WebSocket, Socket.IO, MQTT, MCP, and LLM request schemas.
209
- - [Environment schema](reference/environment.md) — v3 environment filenames,
210
- fields, variable types, safe editing commands, and validation.
8
+ A v3 collection is a directory of independently editable entities. A change to
9
+ one request, example, or assertion can be reviewed in a PR beside the code it
10
+ checks, without regenerating a single large collection export.
11
+
12
+ 1. Edit the entity that owns the change. Top-level directories under
13
+ `postman/collections/` are collections; nested folders organize requests.
14
+ Requests live in `*.request.yaml`, scope metadata in
15
+ `.resources/definition.yaml`, and saved responses in
16
+ `.resources/<request-name>.resources/examples/*.example.yaml`.
17
+ `.resources/` holds metadata and examples, not runnable request files.
18
+ 2. Preserve inherited auth, variables, and scripts when changing a request.
19
+ Collection/folder definitions supply shared context; copying every inherited
20
+ field into each request creates competing values and noisy future edits.
21
+ See **variables** when deciding the scope of a value or secret reference.
22
+ 3. Use [HTTP field shapes and examples](reference/http.md) when authoring
23
+ request, example, or definition files. For other protocols, read
24
+ [their schemas](reference/other_protocols.md); HTTP's URL/body/script shape
25
+ cannot be assumed for gRPC, WebSocket, MCP, or LLM requests.
26
+ [Environment files](reference/environment.md) have their own schema and
27
+ do not use the collection entity's `$kind` discriminator.
28
+ 4. Preserve types at the YAML boundary. Quote `{{variables}}` and strings that
29
+ resemble booleans or numbers; JSON bodies are string content, best expressed
30
+ with block scalars. A syntactically valid YAML object can still be the wrong
31
+ request body shape. The HTTP reference gives the exact fields.
32
+ 5. Keep edits local to the intended entity. `order` is a numeric relative
33
+ ordering, so spaced values allow insertion without renumbering siblings.
34
+ Keep filenames portable and unique case-insensitively; a display `name`
35
+ can preserve characters that cannot appear in a filename. Renaming a request
36
+ also requires checking its examples path.
37
+ 6. Save examples for behavior consumers need to understand or simulate.
38
+ Their schemas feed **api-documentation**, **api-mocking**, and
39
+ **ai-readiness**; structural validity alone does not make an example
40
+ accurate or useful. Assertions derived from the contract belong with the
41
+ request through **api-testing**.
42
+
43
+ ## Verification
44
+
45
+ Run `postman collection lint <collection-path>` for collection changes and
46
+ `postman environment lint <path>` for environment changes. Then inspect the
47
+ diff for unintended scope changes; when execution is appropriate, run the
48
+ changed request through its collection to check inherited context. Report
49
+ structural validation separately from behavior verified against a target.
@@ -0,0 +1,150 @@
1
+ # HTTP collection files
2
+
3
+ Read when authoring HTTP request, example, or definition YAML. These field
4
+ shapes distinguish v3 files from exported collection JSON; validate edits with
5
+ collection lint before relying on the result.
6
+
7
+ ## Definition file (`.resources/definition.yaml`)
8
+
9
+ Optional metadata for a collection or folder:
10
+
11
+ - `$kind: "collection"` — required, even for a folder's definition.
12
+ - `name` — optional, defaults to the filesystem folder name.
13
+ - `description` — optional.
14
+ - `variables` — array of `{key, value, description?, disabled?}`. `value`
15
+ must be a string; `disabled` a boolean.
16
+ - `auth` — a single auth object `{type, credentials: [{key, value}, ...]}`,
17
+ or an array for multiAuth: `[{id, name, type, credentials, rules?}, ...]`.
18
+ - `scripts` — array of `{type, code, language: "text/javascript"}`. `type`
19
+ is one of `http:beforeRequest`, `http:afterResponse`,
20
+ `graphql:beforeQuery`, `graphql:afterResponse`, `grpc:beforeInvoke`,
21
+ `grpc:onIncomingMessage`, `grpc:afterResponse`.
22
+ - `order` — number, used for folder ordering.
23
+
24
+ ## HTTP request (`*.request.yaml`)
25
+
26
+ - `$kind: "http-request"` — required.
27
+ - `name` — optional (see naming rules below for when to include it).
28
+ - `order` — number; only used for relative comparison, so space values out
29
+ (e.g. multiples of 1000) rather than packing them tight — a later
30
+ insertion between two requests shouldn't force renumbering every sibling.
31
+ - `url` — string, with `{{varName}}` variable syntax.
32
+ - `method` — `GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS`.
33
+ - `headers` — array of `{key, value, description?, disabled?}`.
34
+ - `queryParams` — array of `{key, value, description?, disabled?}`.
35
+ - `pathVariables` — array of `{key, value, description?}`.
36
+ - `body` — `{type, content}`; `type` required whenever `body` is present.
37
+ - Types: `json`, `formdata`, `urlencoded`, `text`, `xml`, `html`,
38
+ `javascript`, `file`, `none`.
39
+ - `json`/`text`/`xml`/`html`/`javascript`: `content` is a string.
40
+ - `formdata`: `content` is an array of
41
+ `{key, type: "text"|"file", value or src, contentType?, description?}`.
42
+ - `urlencoded`: `content` is an array of `{key, value, description?}`.
43
+ - `auth` — `{type, credentials}`.
44
+ - `settings` —
45
+ `{protocolVersion?, strictSSL?, followRedirects?, maxRedirects?, disabledSystemHeaders?}`.
46
+ - `scripts` — array of `{type: "beforeRequest"|"afterResponse", code, language: "text/javascript"}`.
47
+ - `examples` — optional, a relative path to the examples directory, e.g.
48
+ `./.resources/<request-name>.resources/examples/`.
49
+
50
+ ## HTTP example (`*.example.yaml`)
51
+
52
+ - `$kind: "http-example"` — required.
53
+ - `name` — optional.
54
+ - `request: {url, method}`.
55
+ - `response: {statusCode, statusText, headers: [{key, value}], body: {type, content}}`.
56
+ - `order` — optional.
57
+
58
+ Saved examples are what `collection ai-readiness` checks for — a request
59
+ with no examples scores worse for agent consumption even if perfectly
60
+ valid structurally.
61
+
62
+ ## Environments (`postman/environments/*.environment.yaml`)
63
+
64
+ Environment files are v3 YAML but are not collection entities: they do not use
65
+ `$kind`. Before creating or editing one by hand, read
66
+ [reference/environment.md](environment.md) for the schema, secret
67
+ handling, CLI-first edit commands, and a linted example.
68
+
69
+ ## YAML rules
70
+
71
+ Invalid YAML breaks parsing silently in confusing ways — when in doubt,
72
+ single-quote it:
73
+
74
+ 1. Single-quote any value containing `{{variables}}`:
75
+ `url: '{{base_url}}/users'` — never leave it unquoted.
76
+ 2. Single-quote values containing `: # & * ! [ ] { } > |`, e.g.
77
+ `name: 'Health check: v2'`.
78
+ 3. Multi-line content (JSON bodies, scripts, queries) uses a `|-` block
79
+ scalar:
80
+ ```yaml
81
+ body:
82
+ type: json
83
+ content: |-
84
+ {
85
+ "name": "example"
86
+ }
87
+ ```
88
+ 4. Quote strings that resemble booleans/numbers when a string is intended:
89
+ `value: "true"`, `value: "123"`.
90
+ 5. `order` must be a bare number, never quoted: `order: 1000`.
91
+ 6. Single-quote file paths and use forward slashes only:
92
+ `examples: './.resources/name.resources/examples'`.
93
+
94
+ ## Naming rules
95
+
96
+ - `<request-name>` (the filename stem before `.request.yaml`) must not
97
+ contain `/ \ : * ? " < > |` — sanitize to `-`.
98
+ - Include `name` in the file only when it differs from `<request-name>`
99
+ (e.g. `name: 'Health/check'` inside `Health-check.request.yaml`, since the
100
+ filename itself can't hold the `/`).
101
+ - Filenames must be unique, case-insensitively, per directory.
102
+
103
+ ## Worked example: "bookstore api"
104
+
105
+ `postman/collections/bookstore api/get all books.request.yaml`
106
+ ```yaml
107
+ $kind: http-request
108
+ method: GET
109
+ url: '{{base_url}}/books'
110
+ order: 1000
111
+ ```
112
+
113
+ `postman/collections/bookstore api/get-book-by-id.request.yaml`
114
+ ```yaml
115
+ $kind: http-request
116
+ name: 'get book by :id'
117
+ method: GET
118
+ url: '{{base_url}}/books/:id'
119
+ order: 2000
120
+ pathVariables:
121
+ - key: id
122
+ value: '1'
123
+ ```
124
+
125
+ `postman/collections/bookstore api/add new book.request.yaml`
126
+ ```yaml
127
+ $kind: http-request
128
+ method: POST
129
+ url: '{{base_url}}/books'
130
+ order: 3000
131
+ headers:
132
+ - key: Content-Type
133
+ value: application/json
134
+ body:
135
+ type: json
136
+ content: |-
137
+ {
138
+ "title": "Example Book",
139
+ "author": "Jane Doe"
140
+ }
141
+ ```
142
+
143
+ `postman/collections/bookstore api/.resources/definition.yaml`
144
+ ```yaml
145
+ $kind: collection
146
+ name: Bookstore API
147
+ variables:
148
+ - key: base_url
149
+ value: 'https://api.bookstore.com/v1'
150
+ ```