-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfull_feature_template.json
More file actions
184 lines (166 loc) · 4.24 KB
/
Copy pathfull_feature_template.json
File metadata and controls
184 lines (166 loc) · 4.24 KB
1
2
3
4
5
6
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
{
"version": "1.0",
"globals": {
"base_url": "https://api.example.com/v1",
"headers": {
"Content-Type": "application/json",
"User-Agent": "DynamicAPI/1.0"
},
"timeout": 30.0
},
"profiles": {
"dev": {
"base_url": "https://dev-api.example.com/v1",
"headers": {
"X-Environment": "development"
}
},
"prod": {
"base_url": "https://api.example.com/v1",
"headers": {
"X-Environment": "production"
}
}
},
"param_presets": {
"pagination": {
"page": "1",
"limit": "20"
}
},
"operations": {
"//": "在此处定义您的 API 操作。参考下方的 _reference_operations 获取示例。"
},
"_reference_operations": {
"//_COMMENT_GET": "=== GET 请求示例 ===",
"get_simple": {
"description": "最简单的 GET 请求,无参数",
"path": "/health",
"method": "GET"
},
"get_with_path_param": {
"description": "带路径参数的 GET 请求",
"path": "/users/$user_id",
"method": "GET"
},
"get_with_query_param": {
"description": "带查询参数的 GET 请求 (例如: /search?q=swift)",
"path": "/search",
"method": "GET",
"params": {
"q": "$keyword",
"sort": "desc"
}
},
"//_COMMENT_POST": "=== POST 请求示例 ===",
"post_json_body": {
"description": "标准的 POST JSON Body 请求 (默认编码为 JSON)",
"path": "/users",
"method": "POST",
"body": {
"name": "$name",
"email": "$email",
"age": 18
}
},
"post_form_body": {
"description": "表单提交 (application/x-www-form-urlencoded)",
"path": "/login",
"method": "POST",
"encoding": "form",
"params": {
"username": "$username",
"password": "$password"
}
},
"post_query_only": {
"description": "POST 请求,但参数强制放在 URL 查询字符串中",
"path": "/action",
"method": "POST",
"encoding": "query",
"params": {
"action_id": "$id",
"confirm": "true"
}
},
"post_composite": {
"description": "混合请求:同时包含 URL 查询参数和 JSON Body",
"path": "/users/$user_id/update",
"method": "POST",
"params": {
"notify": "true"
},
"body": {
"role": "$new_role",
"active": true
}
},
"post_nested_body": {
"description": "复杂的嵌套 JSON Body",
"path": "/orders",
"method": "POST",
"body": {
"order_info": {
"id": "$order_id",
"meta": {
"source": "ios"
}
},
"items": [
{ "id": 1, "qty": "$qty1" },
{ "id": 2, "qty": 5 }
],
"tags": ["urgent", "$custom_tag"]
}
},
"//_COMMENT_OTHER": "=== 其他 HTTP 方法 ===",
"put_update": {
"description": "PUT 请求",
"path": "/users/$user_id",
"method": "PUT",
"body": {
"bio": "$bio"
}
},
"delete_resource": {
"description": "DELETE 请求",
"path": "/users/$user_id",
"method": "DELETE"
},
"//_COMMENT_ADVANCED": "=== 高级功能 ===",
"download_file": {
"description": "文件下载任务",
"path": "/files/$file_id",
"method": "GET",
"task_type": "download"
},
"custom_headers": {
"description": "覆盖/添加特定 Header",
"path": "/secure-data",
"method": "GET",
"headers": {
"Authorization": "Bearer $token",
"X-Custom-Trace": "enabled"
}
},
"with_presets": {
"description": "使用预设参数 (pagination)",
"path": "/feed",
"method": "GET",
"use_presets": ["pagination"]
},
"with_processors": {
"description": "使用请求处理器 (例如签名)",
"path": "/signed-api",
"method": "POST",
"body": { "data": "test" },
"processors": ["SignProcessor", "LogProcessor"]
},
"with_mapper": {
"description": "指定响应映射器 (Response Mapper)",
"path": "/legacy-api",
"method": "GET",
"response_mapping": "LegacyUserMapper"
}
}
}