产品动态
产品公告





字段 | 说明 | 是否必需 |
OpenAPI | 规范版本号,如3.0.0 | 是 |
servers | 定义 API 的基础 URL 列表 | 否,但建议填写以生成有效 URL |
info | API 元数据,包括标题、版本、描述等 | 是 |
paths | 定义所有端点(如 /users)及其 HTTP 方法(GET/POST) | 是 |
components | 存储可复用的模型、参数、响应等,如 schemas 定义数据结构 | 否 |
openapi: "3.0.0"info:title: "测试API"version: "1.0.0"description: "请在此填入插件描述"servers:- url: "https://example.com/api"description: "请在此填入插件描述"paths:"/weatherInfo":get:summary: "API名称"description: "请在此填入插件下面的API描述"operationId: "getWeatherInfo"parameters:- name: "city"in: "query"description: "参数说明"required: trueschema:type: "string"responses:"200":description: "成功的响应"content:application/json:schema:type: "object"properties:status:type: "integer"description: "返回状态"enum: [0, 1]"400":description: "错误的请求""401":description: "未授权""500":description: "服务器内部错"
{"openapi": "3.0.0","info": {"title": "测试API","version": "1.0.0","description": "请在此填入插件描述"},"servers": [{"url": "https://example.com/api","description": "请在此填入插件描述"}],"paths": {"/weatherInfo": {"get": {"summary": "API名称","description": "请在此填入插件下面的API描述","operationId": "getWeatherInfo","parameters": [{"name": "city","in": "query","description": "参数说明","required": true,"schema": {"type": "string"}}],"responses": {"200": {"description": "成功的响应","content": {"application/json": {"schema": {"type": "object","properties": {"status": {"type": "integer","description": "返回状态","enum": [0,1]}}}}}},"400": {"description": "错误的请求"},"401": {"description": "未授权"},"500": {"description": "服务器内部错误"}}}}}}
字段 | 说明 | 是否必需 |
swagger | 规范版本号,如2.0 | 是 |
host | 域名 | 否,但建议填写以生成有效 URL |
basePath | 基础路径 | 否,但建议填写以生成有效 URL |
schemes | 支持的协议,如 HTTP 或 HTTPS | 否,但建议填写以生成有效 URL |
info | API 元数据,包括标题、版本、描述等 | 是 |
paths | 定义所有端点(如 /users)及其 HTTP 方法(GET/POST) | 是 |
definition | 数据模型,相当于 OpenAPI 的 components/schemas | 否 |
swagger: "2.0"info:title: User APIversion: 1.0.0description: 示例 Swagger 2.0 文档host: "example.com"basePath: "/api"schemes:- "https"paths:/users:# GET 请求get:summary: 获取所有用户responses:'200':description: 成功返回用户列表schema:type: objectproperties:users:type: arrayitems:$ref: '#/definitions/User'# POST 请求post:summary: 创建新用户parameters:- in: bodyname: userrequired: trueschema:$ref: '#/definitions/User'responses:'201':description: 用户创建成功definitions:User:type: objectrequired:- nameproperties:id:type: integerreadOnly: trueexample: 1name:type: stringexample: "张三"email:type: stringformat: emailexample: "user@example.com"
{"swagger": "2.0","info": {"title": "User API","version": "1.0.0","description": "示例 Swagger 2.0 文档"},"host": "example.com","basePath": "/api","schemes": ["https"],"paths": {"/users": {"get": {"summary": "获取所有用户","responses": {"200": {"description": "成功返回用户列表","schema": {"type": "object","properties": {"users": {"type": "array","items": {"$ref": "#/definitions/User"}}}}}}},"post": {"summary": "创建新用户","parameters": [{"in": "body","name": "user","required": true,"schema": {"$ref": "#/definitions/User"}}],"responses": {"201": {"description": "用户创建成功"}}}}},"definitions": {"User": {"type": "object","required": ["name"],"properties": {"id": {"type": "integer","readOnly": true,"example": 1},"name": {"type": "string","example": "张三"},"email": {"type": "string","format": "email","example": "user@example.com"}}}}}
字段 | 说明 | 是否必需 |
info | 集合元数据,包括集合名称和集合版本 | 是 |
item | 请求列表,每个请求需指定方法和 URL | 是 |
request | 请求详情,包括 header, body, auth 等 | 是 |
auth | 认证配置,如 API Key | 否 |
event | 预请求脚本或测试脚本 | 否 |
{"info": {"name": "User API Collection","version": "1.0.0","description": "示例 Postman 集合,包含 GET 和 POST 请求"},"item": [{"name": "GetAllUsers","request": {"method": "GET","description": "GetAllUsers","header": [{"key": "Content-Type","value": "application/json"}],"url": {"raw": "https://api.example.com/users","protocol": "https","host": ["api.example.com"],"path": ["users"]}},"response": []},{"name": "CreateUser","request": {"method": "POST","description": "CreateUser","header": [{"key": "Content-Type","value": "application/json"}],"body": {"mode": "raw","raw": "{\\"name\\": \\"John Doe\\", \\"email\\": \\"john@example.com\\"}"},"url": {"raw": "https://api.example.com/users","protocol": "https","host": ["api.example.com"],"path": ["users"]}},"response": []}]}




文档反馈