feat: 接口管理功能 - 分页查询、详情查看、测试代理
- 后端:OpenAPI spec 解析同步、接口分页查询、代理测试(SSRF防护) - 前端:接口列表页、详情对话框(详情/测试双标签)、Token来源选择 - 服务启动自动同步接口数据,支持手动触发同步 - 测试代理路径修复:自动添加 /api 前缀以匹配后端 SSRF 校验 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ public class ApiEndpointItemResponse {
|
||||
private String id;
|
||||
private String path;
|
||||
private String method;
|
||||
private String operationId;
|
||||
private String summary;
|
||||
private String tags;
|
||||
private Integer deprecated;
|
||||
|
||||
@@ -130,6 +130,7 @@ public class ApiEndpointServiceImpl implements ApiEndpointService {
|
||||
JsonNode paths = root.path("paths");
|
||||
Iterator<Map.Entry<String, JsonNode>> pathEntries = paths.fields();
|
||||
int count = 0;
|
||||
java.util.Set<String> seenOperationIds = new java.util.HashSet<>();
|
||||
|
||||
while (pathEntries.hasNext()) {
|
||||
Map.Entry<String, JsonNode> pathEntry = pathEntries.next();
|
||||
@@ -146,6 +147,11 @@ public class ApiEndpointServiceImpl implements ApiEndpointService {
|
||||
|
||||
String operationId = endpointNode.path("operationId").asText();
|
||||
if (operationId.isEmpty()) continue;
|
||||
if (seenOperationIds.contains(operationId)) {
|
||||
log.warn("跳过重复 operationId: {} ({} {})", operationId, path, method);
|
||||
continue;
|
||||
}
|
||||
seenOperationIds.add(operationId);
|
||||
|
||||
ApiEndpoint apiEndpoint = ApiEndpoint.builder()
|
||||
.path(path)
|
||||
@@ -294,6 +300,7 @@ public class ApiEndpointServiceImpl implements ApiEndpointService {
|
||||
r.setId(e.getId());
|
||||
r.setPath(e.getPath());
|
||||
r.setMethod(e.getMethod());
|
||||
r.setOperationId(e.getOperationId());
|
||||
r.setSummary(e.getSummary());
|
||||
r.setTags(e.getTags());
|
||||
r.setDeprecated(e.getDeprecated());
|
||||
|
||||
Reference in New Issue
Block a user