fix: swagger 导入栈溢出

This commit is contained in:
chenjianxing 2021-01-04 11:40:12 +08:00
parent 1ed90fdd63
commit 7270c24eb2
1 changed files with 5 additions and 0 deletions

View File

@ -275,6 +275,11 @@ public class Swagger2Parser extends ApiImportAbstractParser {
} else if (value instanceof RefProperty) {
RefProperty refProperty = (RefProperty) value;
String simpleRef = refProperty.getSimpleRef();
if (refSet.contains(simpleRef)) {
//避免嵌套死循环
jsonObject.put(key, new JSONArray());
return;
}
refSet.add(simpleRef);
Model model = definitions.get(simpleRef);
jsonObject.put(key, getBodyParameters(model.getProperties(), refSet));