@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.
- package/README.md +46 -9
- package/dist/hosts/antigravity.js +47 -0
- package/dist/hosts/codex-hooks.js +68 -0
- package/dist/hosts/codex.js +87 -8
- package/dist/hosts/copilot.js +60 -0
- package/dist/hosts/index.js +3 -1
- package/dist/json-rpc.js +113 -0
- package/dist/system.js +40 -3
- package/mcp.pi.json +2 -2
- package/package.json +1 -1
- package/skills/ai-readiness/SKILL.md +40 -44
- package/skills/api-discovery/SKILL.md +64 -145
- package/skills/api-discovery/reference/orbit.md +17 -5
- package/skills/api-documentation/SKILL.md +41 -46
- package/skills/api-engineer/SKILL.md +78 -23
- package/skills/api-mocking/SKILL.md +117 -163
- package/skills/api-monitoring/SKILL.md +52 -129
- package/skills/api-simulation/SKILL.md +130 -178
- package/skills/api-simulation/reference/sim_yaml_schema.md +41 -103
- package/skills/api-testing/SKILL.md +48 -95
- package/skills/bootstrap/SKILL.md +123 -224
- package/skills/ci-integration/SKILL.md +53 -113
- package/skills/collection-schema-v3/SKILL.md +43 -204
- package/skills/collection-schema-v3/reference/http.md +150 -0
- package/skills/datasets/SKILL.md +89 -315
- package/skills/datasets/reference/spreadsheets.md +25 -0
- package/skills/flows/SKILL.md +57 -206
- package/skills/flows/reference/flow_cli_flags.md +3 -2
- package/skills/performance-testing/SKILL.md +46 -62
- package/skills/performance-testing/references/jmeter-import/README.md +82 -0
- package/skills/performance-testing/references/jmeter-import/import-report.md +52 -0
- package/skills/performance-testing/references/jmeter-import/mapping-table.md +95 -0
- package/skills/performance-testing/references/jmeter-import/postman-perf-capabilities.md +56 -0
- package/skills/performance-testing/references/jmeter-import/script-translation.md +97 -0
- package/skills/postman-mcp-server/SKILL.md +53 -59
- package/skills/postman-mcp-server/references/docs.md +0 -1
- package/skills/postman-mcp-server/references/learn.md +10 -9
- package/skills/postman-mcp-server/references/mock.md +0 -1
- package/skills/postman-mcp-server/references/search.md +0 -1
- package/skills/postman-mcp-server/references/security.md +0 -1
- package/skills/postman-mcp-server/references/setup.md +0 -1
- package/skills/postman-mcp-server/references/sync.md +0 -1
- package/skills/postman-mcp-server/references/test.md +0 -1
- package/skills/variables/SKILL.md +44 -87
- package/skills/webhook-testing/SKILL.md +103 -0
- package/skills/webhook-testing/reference/forwarding.md +10 -0
- package/skills/webhook-testing/reference/outbound_webhooks.md +25 -0
- package/skills/webhook-testing/reference/webhook_scripts.md +163 -0
|
@@ -1,122 +1,62 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ci-integration
|
|
3
|
-
description:
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
108
|
-
which
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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:
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
+
```
|