generate_examples
Generate API call examples in multiple formats like JSON, cURL, Python, and JavaScript based on OpenAPI specifications to help developers understand and test API endpoints.
Instructions
根据 OpenAPI 规范生成各种格式的 API 调用示例
Input Schema
Name | Required | Description | Default |
---|---|---|---|
example_strategy | No | 示例生成策略 | realistic |
formats | No | 生成的示例格式,默认生成所有格式 | |
include_auth | No | 是否包含认证信息 | |
method | Yes | HTTP 方法,例如 GET, POST, PUT, DELETE | |
path | Yes | 接口路径,例如 /api/v1/users | |
server_url | No | 服务器基础 URL,默认使用 OpenAPI 规范中的服务器 URL |
Input Schema (JSON Schema)
{
"properties": {
"example_strategy": {
"default": "realistic",
"description": "示例生成策略",
"enum": [
"minimal",
"complete",
"realistic"
],
"type": "string"
},
"formats": {
"description": "生成的示例格式,默认生成所有格式",
"items": {
"enum": [
"json",
"curl",
"python",
"javascript",
"http",
"postman"
],
"type": "string"
},
"type": "array"
},
"include_auth": {
"default": true,
"description": "是否包含认证信息",
"type": "boolean"
},
"method": {
"description": "HTTP 方法,例如 GET, POST, PUT, DELETE",
"enum": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS"
],
"type": "string"
},
"path": {
"description": "接口路径,例如 /api/v1/users",
"type": "string"
},
"server_url": {
"description": "服务器基础 URL,默认使用 OpenAPI 规范中的服务器 URL",
"type": "string"
}
},
"required": [
"path",
"method"
],
"type": "object"
}