postman-openapi-converter
它能做什么
这个工具可以把 OpenAPI 或 Swagger 等格式编写的 API 描述,转换成 Postman(一款 API 测试工具)能够识别和导入的文件。它会生成一个“Postman Collection”,把你所有的 API 请求整理在一起。
适用场景
- ✓当你手上有一份描述 API 的文件(OpenAPI 或 Swagger 格式),并想在 Postman 中测试它时。
- ✓当你要把旧版 API 描述(Swagger 2.0)迁移到新格式时。
- ✓想根据现有文档,自动在 Postman 中整理 API 请求时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/postman-openapi-converter/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“把这个 OpenAPI 文件转换成 Postman Collection:[文件链接或在此粘贴内容]”
每周 5 个新技能,1 分钟读完。
工作原理
工具会读取你的 API 描述(OpenAPI/Swagger),识别出各个路径和请求方法(比如 GET、POST),然后生成供 Postman 使用的 collection 文件。它还会尝试生成示例数据,并自动设置身份验证。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
OpenAPI → Postman Collection Converter
When to Use
Use this skill when you need convert OpenAPI 3.x or Swagger 2.0 specs (YAML or JSON) into complete, import-ready Postman Collection v2.1 JSON files. Use this skill whenever the user provides or references an OpenAPI spec, Swagger file, openapi.yaml, swagger.json, or uses phrases like "convert my OpenAPI spec",...
Converts OpenAPI 3.x or Swagger 2.0 specs into a valid Postman Collection v2.1.
Step 1 — Detect & Validate Input
Identify the spec version from the input:
openapi: 3.x.x→ OpenAPI 3swagger: "2.0"→ Swagger 2
If the input is truncated or partial, convert what's available and note missing sections.
Step 2 — Extraction Mapping
OpenAPI 3 → Postman
| OpenAPI field | Postman mapping |
|---|---|
info.title |
Collection name |
info.description |
Collection description |
servers[0].url |
{{base_url}} variable |
paths.<path>.<method> |
One request item per operation |
operationId or summary |
Request name |
parameters (path/query/header) |
URL path variables, query params, headers |
requestBody.content.application/json.schema |
Body (raw JSON), generate example from schema |
responses |
Saved example responses |
components.securitySchemes |
Collection-level auth |
tags |
Folder grouping |
Swagger 2 → Postman
| Swagger field | Postman mapping |
|---|---|
host + basePath |
{{base_url}} |
paths.<path>.<method> |
Request item |
parameters |
Query/path/header/body params |
consumes / produces |
Content-Type / Accept headers |
securityDefinitions |
Collection auth |
tags |
Folders |
Step 3 — Generate Example Bodies
For each request with a requestBody or body parameter, generate a realistic example JSON body from the schema:
- Use property names as keys
- Infer sensible example values from type + format (e.g.,
"email"format →"user@example.com","date-time"→"2024-01-15T10:30:00Z") - For
$refschemas, resolve them inline
Step 4 — Auth Handling
Map security schemes to Postman auth:
| OpenAPI scheme | Postman auth type |
|---|---|
http: bearer |
bearer with {{token}} |
http: basic |
basic with {{username}} / {{password}} |
apiKey: header |
apikey header with {{api_key}} |
apiKey: query |
apikey query param |
oauth2 |
oauth2 (note: requires manual token setup) |
Apply auth at collection level if all endpoints share the same scheme. Override at request level for exceptions.
Step 5 — Build Collection JSON
Use the standard v2.1 structure (same schema as postman-collection-generator skill).
Key differences for spec-converted collections:
- Always group by
tagsinto folders - Include
descriptionfield on each request fromoperationId+summary+description - Add saved example responses where
responsesare defined in the spec
"response": [
{
"name": "200 OK",
"status": "OK",
"code": 200,
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": "{ \"id\": 1, \"name\": \"example\" }",
"originalRequest": { <copy of the request> }
}
]
Step 6 — Environment File
Extract all variables into a companion environment:
base_urlfromservers[0].urlorhost + basePathtoken,api_key,username,passwordas empty placeholders- Any server variables from
servers[0].variables
Step 7 — Output
collection.json— Full Postman Collection v2.1environment.json— Matching environment file- Conversion summary: number of endpoints converted, folders created, auth type detected, any fields skipped or approximated
- Import instructions
Edge Cases
$refchains: Resolve all$refpointers inline before mappingallOf/oneOf/anyOf: Use the first/primary schema for body generation; note alternatives in description- Path parameters: Convert
{param}to:paramin URL path AND add tovariablearray in url object - Multiple content types: Prefer
application/json; note others in request description - No operationId: Generate name from
METHOD /path(e.g.,GET /users/{id}→Get User by ID)
Quality Checklist
- Every
pathsentry produces at least one request - Path params use
:paramformat in Postman URL - All
$refresolved — no raw$refstrings in output
…
常见问题
什么是 OpenAPI/Swagger?
它们是标准化的格式,用来描述 API 的工作方式,包括端点、参数和预期的响应。
什么是 Postman Collection?
它是 Postman 中的一个文件,把多个 API 请求归在一起,方便整理、分享和运行测试。
这个工具支持所有类型的身份验证吗?
它会尝试把常见的身份验证方式(如 Bearer token、Basic Auth、API Key)映射到 Postman 的设置中,但一些较复杂的 OAuth2 配置可能需要你手动调整。
详情
作者的原始描述
Convert OpenAPI 3.x or Swagger 2.0 specs (YAML or JSON) into complete, import-ready Postman Collection v2.1 JSON files.
热度
- GitHub 星标
- 48k
- 排名
- #5478
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。