Chuyển đến nội dung
Skillpedia
Lập trình chung48k · #5478

postman-openapi-converter

Skill này làm gì

Công cụ này chuyển đổi mô tả API viết theo định dạng như OpenAPI hoặc Swagger thành tệp mà Postman (công cụ kiểm thử API) có thể hiểu và nhập vào. Nó tạo một “Postman Collection” tổ chức tất cả các lệnh gọi API của bạn.

Khi nào nên dùng

  • ✓Khi bạn có tệp mô tả API (theo định dạng OpenAPI hoặc Swagger) và muốn kiểm thử nó trong Postman.
  • ✓Khi chuyển từ mô tả API cũ (Swagger 2.0) sang định dạng mới hơn.
  • ✓Khi tự động tổ chức các lệnh gọi API trong Postman dựa trên tài liệu có sẵn.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/postman-openapi-converter/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/postman-openapi-converter/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Chuyển tệp OpenAPI này thành Postman Collection: [liên kết tới tệp hoặc dán nội dung vào đây]”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ đọc mô tả API (OpenAPI/Swagger), xác định các đường dẫn và phương thức khác nhau (như GET, POST), rồi tạo tệp collection cho Postman. Nó cũng cố gắng tạo dữ liệu mẫu và thiết lập xác thực tự động.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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 3
  • swagger: "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 $ref schemas, 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 tags into folders
  • Include description field on each request from operationId + summary + description
  • Add saved example responses where responses are 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_url from servers[0].url or host + basePath
  • token, api_key, username, password as empty placeholders
  • Any server variables from servers[0].variables

Step 7 — Output

  1. collection.json — Full Postman Collection v2.1
  2. environment.json — Matching environment file
  3. Conversion summary: number of endpoints converted, folders created, auth type detected, any fields skipped or approximated
  4. Import instructions

Edge Cases

  • $ref chains: Resolve all $ref pointers inline before mapping
  • allOf / oneOf / anyOf: Use the first/primary schema for body generation; note alternatives in description
  • Path parameters: Convert {param} to :param in URL path AND add to variable array 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 paths entry produces at least one request
  • Path params use :param format in Postman URL
  • All $ref resolved — no raw $ref strings in output

…

Câu hỏi thường gặp

OpenAPI/Swagger là gì?

Đây là các định dạng chuẩn hóa để mô tả API hoạt động như thế nào, bao gồm các endpoint, tham số và phản hồi mong đợi.

Postman Collection là gì?

Đây là tệp nhóm nhiều yêu cầu API trong Postman, giúp dễ tổ chức, chia sẻ và chạy kiểm thử hơn.

Công cụ có xử lý mọi loại xác thực không?

Nó cố gắng ánh xạ các phương thức xác thực phổ biến (như Bearer token, Basic Auth, API Key) sang cài đặt của Postman, nhưng một số cấu hình OAuth2 phức tạp hơn có thể cần chỉnh sửa thủ công.

Chi tiết

Mô tả gốc của tác giả

Convert OpenAPI 3.x or Swagger 2.0 specs (YAML or JSON) into complete, import-ready Postman Collection v2.1 JSON files.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#5478
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự