fix(接口测试): 修复文档分享中jsonschema参数的显示问题
--bug=1012866 --user=宋天阳 【接口测试】github#13138,分享出来的接口没有描述信息 json结构图多了个0 https://www.tapd.cn/55049933/s/1153420
This commit is contained in:
parent
e4411ded9a
commit
dfcb463ebf
|
@ -31,7 +31,7 @@ public class ApiDocumentInfoDTO {
|
|||
private String requestBodyFormData;
|
||||
private String requestBodyStrutureData;
|
||||
private Object requestPreviewData;
|
||||
private String jsonSchemaBody;
|
||||
private JSONSchemaBodyDTO jsonSchemaBody;
|
||||
|
||||
private String responseHead;
|
||||
private String responseBody;
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package io.metersphere.api.dto.share;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class JSONSchemaBodyDTO {
|
||||
private Object jsonSchema;
|
||||
private String raw;
|
||||
}
|
|
@ -210,12 +210,21 @@ public class ShareInfoService {
|
|||
isJsonSchema = true;
|
||||
}
|
||||
}
|
||||
if (bodyObj.containsKey("raw")) {
|
||||
String raw = bodyObj.getString("raw");
|
||||
apiInfoDTO.setJsonSchemaBody(raw);
|
||||
apiInfoDTO.setRequestBodyStrutureData(raw);
|
||||
//转化jsonObje 或者 jsonArray
|
||||
JSONSchemaBodyDTO jsonSchemaBodyDTO = new JSONSchemaBodyDTO();
|
||||
if(isJsonSchema){
|
||||
jsonSchemaBodyDTO.setJsonSchema(bodyObj.get("jsonSchema"));
|
||||
apiInfoDTO.setJsonSchemaBody(jsonSchemaBodyDTO);
|
||||
String raw =JSONSchemaGenerator.getJson(JSONObject.toJSONString(bodyObj.get("jsonSchema")));
|
||||
this.setPreviewData(previewJsonArray, raw);
|
||||
}else {
|
||||
if (bodyObj.containsKey("raw")) {
|
||||
String raw = bodyObj.getString("raw");
|
||||
jsonSchemaBodyDTO.setRaw(raw);
|
||||
apiInfoDTO.setJsonSchemaBody(jsonSchemaBodyDTO);
|
||||
apiInfoDTO.setRequestBodyStrutureData(raw);
|
||||
//转化jsonObje 或者 jsonArray
|
||||
this.setPreviewData(previewJsonArray, raw);
|
||||
}
|
||||
}
|
||||
} else if (StringUtils.equalsAny(type, "XML", "Raw")) {
|
||||
if (bodyObj.containsKey("raw")) {
|
||||
|
@ -330,8 +339,6 @@ public class ShareInfoService {
|
|||
if (bodyObj.containsKey("raw")) {
|
||||
String raw = bodyObj.getString("raw");
|
||||
apiInfoDTO.setResponseBodyStrutureData(raw);
|
||||
//转化jsonObje 或者 jsonArray
|
||||
this.setPreviewData(previewJsonArray, raw);
|
||||
}
|
||||
}
|
||||
} else if (StringUtils.equalsAny(type, "Form Data", "WWW_FORM")) {
|
||||
|
|
|
@ -332,9 +332,6 @@ export default {
|
|||
for (let dataIndex = 0; dataIndex < returnDatas.length; dataIndex++) {
|
||||
let index = indexArr[dataIndex];
|
||||
let data = returnDatas[dataIndex];
|
||||
if (data.jsonSchemaBody) {
|
||||
data.jsonSchemaBody = {raw:data.jsonSchemaBody};
|
||||
}
|
||||
this.$set(this.apiInfoArray, index, data);
|
||||
}
|
||||
this.updateShowArray(itemIndex, afterNodeIndex, beforeNodeIndex);
|
||||
|
|
Loading…
Reference in New Issue