fix(接口测试): 接口定义导出swagger时增加长度信息导出
https://www.tapd.cn/55049933/s/1606733
This commit is contained in:
parent
da1beb3fa1
commit
645a00b3cf
|
@ -131,7 +131,14 @@ public class Swagger3ExportParser implements ExportParser<ApiDefinitionExportRes
|
||||||
JSONObject schema = new JSONObject();
|
JSONObject schema = new JSONObject();
|
||||||
schema.put(PropertyConstant.TYPE, PropertyConstant.STRING);
|
schema.put(PropertyConstant.TYPE, PropertyConstant.STRING);
|
||||||
swaggerParam.setSchema(JSONUtil.parseObjectNode(schema.toString()));
|
swaggerParam.setSchema(JSONUtil.parseObjectNode(schema.toString()));
|
||||||
paramsList.add(JSONUtil.parseObject(JSON.toJSONString(swaggerParam)));
|
JSONObject schemaObject = JSONUtil.parseObject(JSON.toJSONString(swaggerParam));
|
||||||
|
if (StringUtils.isNotBlank(param.optString("maxLength"))) {
|
||||||
|
schemaObject.put("maxLength", param.optInt("maxLength"));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(param.optString("minLength"))) {
|
||||||
|
schemaObject.put("minLength", param.optInt("minLength"));
|
||||||
|
}
|
||||||
|
paramsList.add(schemaObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -345,6 +352,7 @@ public class Swagger3ExportParser implements ExportParser<ApiDefinitionExportRes
|
||||||
}
|
}
|
||||||
|
|
||||||
private JSONObject getFormDataProperties(JSONArray requestBody) {
|
private JSONObject getFormDataProperties(JSONArray requestBody) {
|
||||||
|
// todo maxLength minLength
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
for (Object item : requestBody) {
|
for (Object item : requestBody) {
|
||||||
if (item instanceof JSONObject) {
|
if (item instanceof JSONObject) {
|
||||||
|
@ -575,6 +583,13 @@ public class Swagger3ExportParser implements ExportParser<ApiDefinitionExportRes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(obj.optString("maxLength"))) {
|
||||||
|
property.put("maxLength", obj.optInt("maxLength"));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(obj.optString("minLength"))) {
|
||||||
|
property.put("minLength", obj.optInt("minLength"));
|
||||||
|
}
|
||||||
properties.put(key, property);
|
properties.put(key, property);
|
||||||
}
|
}
|
||||||
schema.put(PropertyConstant.PROPERTIES, properties);
|
schema.put(PropertyConstant.PROPERTIES, properties);
|
||||||
|
|
Loading…
Reference in New Issue