fix(接口测试): 修复接口定义swagger导出问题

--bug=1050510 --user=王旭 【接口测试】github#34654,在接口定义里面,当把接口响应参数定义有多个对象并且有object 值,在导出swagger 格式的时候,导出不了 https://www.tapd.cn/55049933/s/1632569
This commit is contained in:
WangXu10 2024-12-17 16:47:09 +08:00 committed by 刘瑞斌
parent e2876a5656
commit 4fd5a1a484
1 changed files with 6 additions and 4 deletions

View File

@ -915,11 +915,13 @@ public class Swagger3Parser extends SwaggerAbstractParser {
parsedParam.put(PropertyConstant.REQUIRED, requestBody.optJSONArray(PropertyConstant.REQUIRED));
}
JSONObject properties = requestBody.optJSONObject(PropertyConstant.PROPERTIES);
JSONObject jsonObject = buildFormDataSchema(properties);
if (StringUtils.isNotBlank(requestBody.optString("description"))) {
parsedParam.put("description", requestBody.optString("description"));
if (properties != null) {
JSONObject jsonObject = buildFormDataSchema(properties);
if (StringUtils.isNotBlank(requestBody.optString("description"))) {
parsedParam.put("description", requestBody.optString("description"));
}
parsedParam.put(PropertyConstant.PROPERTIES, jsonObject.optJSONObject(PropertyConstant.PROPERTIES));
}
parsedParam.put(PropertyConstant.PROPERTIES, jsonObject.optJSONObject(PropertyConstant.PROPERTIES));
} else if (StringUtils.equals(type, PropertyConstant.INTEGER)) {
parsedParam.put(PropertyConstant.TYPE, PropertyConstant.INTEGER);
parsedParam.put("format", "int64");