fix: swagger 名称为空报错

This commit is contained in:
chenjianxing 2021-01-05 15:58:01 +08:00
parent 1f51cb63e0
commit a259db45bc
2 changed files with 6 additions and 2 deletions

View File

@ -97,8 +97,10 @@ public class Swagger2Parser extends ApiImportAbstractParser {
String name = "";
if (StringUtils.isNotBlank(operation.getSummary())) {
name = operation.getSummary();
} else {
} else if (StringUtils.isNotBlank(operation.getOperationId())) {
name = operation.getOperationId();
} else {
name = path;
}
return buildApiDefinition(id, name, path, method);
}

View File

@ -129,8 +129,10 @@ public class Swagger3Parser extends ApiImportAbstractParser {
String name = "";
if (StringUtils.isNotBlank(operation.getSummary())) {
name = operation.getSummary();
} else {
} else if (StringUtils.isNotBlank(operation.getOperationId())) {
name = operation.getOperationId();
} else {
name = path;
}
return buildApiDefinition(id, name, path, method);
}