Fix the request example error generated when RequestBody is a basic java type .

This commit is contained in:
shalousun 2021-11-18 23:29:01 +08:00
parent d4691dcbf4
commit d82ed6744e
1 changed files with 1 additions and 8 deletions

View File

@ -521,15 +521,8 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
gicTypeName = requestBodyAdvice + "<" + gicTypeName + ">";
}
if (JavaClassValidateUtil.isPrimitive(simpleTypeName)) {
StringBuilder builder = new StringBuilder();
builder.append("{\"")
.append(paramName)
.append("\":")
.append(DocUtil.handleJsonStr(mockValue))
.append("}");
requestExample.setJsonBody(JsonUtil.toPrettyFormat(builder.toString())).setJson(true);
requestExample.setJsonBody(mockValue).setJson(true);
} else {
String json = JsonBuildHelper.buildJson(typeName, gicTypeName, Boolean.FALSE, 0, new HashMap<>(), groupClasses, configBuilder);
requestExample.setJsonBody(JsonUtil.toPrettyFormat(json)).setJson(true);