fix(接口测试): swagger导入报错

This commit is contained in:
chenjianxing 2020-10-12 10:08:47 +08:00
parent 1c7ce5e20b
commit 827d43c4e5
1 changed files with 4 additions and 2 deletions

View File

@ -137,8 +137,10 @@ public class Swagger2Parser extends ApiImportAbstractParser {
Model model = definitions.get(simpleRef);
HashSet<String> refSet = new HashSet<>();
refSet.add(simpleRef);
JSONObject bodyParameters = getBodyJSONObjectParameters(model.getProperties(), definitions, refSet);
body.setRaw(bodyParameters.toJSONString());
if (model != null ) {
JSONObject bodyParameters = getBodyJSONObjectParameters(model.getProperties(), definitions, refSet);
body.setRaw(bodyParameters.toJSONString());
}
} else if (schema instanceof ArrayModel) {
ArrayModel arrayModel = (ArrayModel) bodyParameter.getSchema();
Property items = arrayModel.getItems();