Fix the request example error generated when RequestBody is a basic java type .
This commit is contained in:
parent
d4691dcbf4
commit
d82ed6744e
|
@ -521,15 +521,8 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
|
||||||
gicTypeName = requestBodyAdvice + "<" + gicTypeName + ">";
|
gicTypeName = requestBodyAdvice + "<" + gicTypeName + ">";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JavaClassValidateUtil.isPrimitive(simpleTypeName)) {
|
if (JavaClassValidateUtil.isPrimitive(simpleTypeName)) {
|
||||||
StringBuilder builder = new StringBuilder();
|
requestExample.setJsonBody(mockValue).setJson(true);
|
||||||
builder.append("{\"")
|
|
||||||
.append(paramName)
|
|
||||||
.append("\":")
|
|
||||||
.append(DocUtil.handleJsonStr(mockValue))
|
|
||||||
.append("}");
|
|
||||||
requestExample.setJsonBody(JsonUtil.toPrettyFormat(builder.toString())).setJson(true);
|
|
||||||
} else {
|
} else {
|
||||||
String json = JsonBuildHelper.buildJson(typeName, gicTypeName, Boolean.FALSE, 0, new HashMap<>(), groupClasses, configBuilder);
|
String json = JsonBuildHelper.buildJson(typeName, gicTypeName, Boolean.FALSE, 0, new HashMap<>(), groupClasses, configBuilder);
|
||||||
requestExample.setJsonBody(JsonUtil.toPrettyFormat(json)).setJson(true);
|
requestExample.setJsonBody(JsonUtil.toPrettyFormat(json)).setJson(true);
|
||||||
|
|
Loading…
Reference in New Issue