fix github #155;fix list param torna example error
This commit is contained in:
parent
d65938c63e
commit
b2b5a21775
|
@ -64,7 +64,7 @@ public class AdocDocBuilder {
|
|||
*/
|
||||
public static void buildApiDoc(ApiConfig config, JavaProjectBuilder javaProjectBuilder) {
|
||||
DocBuilderTemplate builderTemplate = new DocBuilderTemplate();
|
||||
builderTemplate.checkAndInit(config);
|
||||
builderTemplate.checkAndInit(config,false);
|
||||
config.setParamsDataToTree(false);
|
||||
config.setAdoc(true);
|
||||
ProjectDocConfigBuilder configBuilder = new ProjectDocConfigBuilder(config, javaProjectBuilder);
|
||||
|
@ -91,7 +91,7 @@ public class AdocDocBuilder {
|
|||
config.setAdoc(false);
|
||||
ProjectDocConfigBuilder configBuilder = new ProjectDocConfigBuilder(config, new JavaProjectBuilder());
|
||||
DocBuilderTemplate builderTemplate = new DocBuilderTemplate();
|
||||
builderTemplate.checkAndInit(config);
|
||||
builderTemplate.checkAndInit(config,false);
|
||||
builderTemplate.buildSingleApi(configBuilder, controllerName, API_DOC_ADOC_TPL, API_EXTENSION);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class ApiDocBuilder {
|
|||
*/
|
||||
public static void buildApiDoc(ApiConfig config, JavaProjectBuilder javaProjectBuilder) {
|
||||
DocBuilderTemplate builderTemplate = new DocBuilderTemplate();
|
||||
builderTemplate.checkAndInit(config);
|
||||
builderTemplate.checkAndInit(config,false);
|
||||
config.setAdoc(false);
|
||||
config.setParamsDataToTree(false);
|
||||
ProjectDocConfigBuilder configBuilder = new ProjectDocConfigBuilder(config, javaProjectBuilder);
|
||||
|
@ -91,7 +91,7 @@ public class ApiDocBuilder {
|
|||
JavaProjectBuilder javaProjectBuilder = new JavaProjectBuilder();
|
||||
ProjectDocConfigBuilder configBuilder = new ProjectDocConfigBuilder(config, javaProjectBuilder);
|
||||
DocBuilderTemplate builderTemplate = new DocBuilderTemplate();
|
||||
builderTemplate.checkAndInit(config);
|
||||
builderTemplate.checkAndInit(config,false);
|
||||
builderTemplate.buildSingleApi(configBuilder, controllerName, API_DOC_MD_TPL, API_EXTENSION);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,9 +58,9 @@ public class BaseDocBuilderTemplate {
|
|||
*
|
||||
* @param config Api config
|
||||
*/
|
||||
public void checkAndInit(ApiConfig config) {
|
||||
public void checkAndInit(ApiConfig config,boolean torna) {
|
||||
this.checkAndInitForGetApiData(config);
|
||||
if (StringUtil.isEmpty(config.getOutPath())) {
|
||||
if (StringUtil.isEmpty(config.getOutPath())&&!torna) {
|
||||
throw new RuntimeException("doc output path can't be null or empty");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class HtmlApiDocBuilder {
|
|||
*/
|
||||
public static void buildApiDoc(ApiConfig config, JavaProjectBuilder javaProjectBuilder) {
|
||||
DocBuilderTemplate builderTemplate = new DocBuilderTemplate();
|
||||
builderTemplate.checkAndInit(config);
|
||||
builderTemplate.checkAndInit(config,false);
|
||||
config.setParamsDataToTree(false);
|
||||
ProjectDocConfigBuilder configBuilder = new ProjectDocConfigBuilder(config, javaProjectBuilder);
|
||||
IDocBuildTemplate docBuildTemplate = BuildTemplateFactory.getDocBuildTemplate(config.getFramework());
|
||||
|
|
|
@ -51,7 +51,7 @@ public class OpenApiBuilder {
|
|||
|
||||
public static void buildOpenApi(ApiConfig config) {
|
||||
DocBuilderTemplate builderTemplate = new DocBuilderTemplate();
|
||||
builderTemplate.checkAndInit(config);
|
||||
builderTemplate.checkAndInit(config,false);
|
||||
JavaProjectBuilder javaProjectBuilder = new JavaProjectBuilder();
|
||||
ProjectDocConfigBuilder configBuilder = new ProjectDocConfigBuilder(config, javaProjectBuilder);
|
||||
openApiCreate(config, configBuilder);
|
||||
|
@ -65,7 +65,7 @@ public class OpenApiBuilder {
|
|||
*/
|
||||
public static void buildOpenApi(ApiConfig config, JavaProjectBuilder projectBuilder) {
|
||||
DocBuilderTemplate builderTemplate = new DocBuilderTemplate();
|
||||
builderTemplate.checkAndInit(config);
|
||||
builderTemplate.checkAndInit(config,false);
|
||||
ProjectDocConfigBuilder configBuilder = new ProjectDocConfigBuilder(config, projectBuilder);
|
||||
openApiCreate(config, configBuilder);
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class PostmanJsonBuilder {
|
|||
*/
|
||||
public static void buildPostmanCollection(ApiConfig config) {
|
||||
DocBuilderTemplate builderTemplate = new DocBuilderTemplate();
|
||||
builderTemplate.checkAndInit(config);
|
||||
builderTemplate.checkAndInit(config,false);
|
||||
JavaProjectBuilder javaProjectBuilder = new JavaProjectBuilder();
|
||||
ProjectDocConfigBuilder configBuilder = new ProjectDocConfigBuilder(config, javaProjectBuilder);
|
||||
postManCreate(config, configBuilder);
|
||||
|
@ -75,7 +75,7 @@ public class PostmanJsonBuilder {
|
|||
*/
|
||||
public static void buildPostmanCollection(ApiConfig config, JavaProjectBuilder projectBuilder) {
|
||||
DocBuilderTemplate builderTemplate = new DocBuilderTemplate();
|
||||
builderTemplate.checkAndInit(config);
|
||||
builderTemplate.checkAndInit(config,false);
|
||||
config.setParamsDataToTree(false);
|
||||
ProjectDocConfigBuilder configBuilder = new ProjectDocConfigBuilder(config, projectBuilder);
|
||||
postManCreate(config, configBuilder);
|
||||
|
|
|
@ -75,7 +75,7 @@ public class TornaBuilder {
|
|||
public static void buildApiDoc(ApiConfig config, JavaProjectBuilder javaProjectBuilder) {
|
||||
config.setParamsDataToTree(true);
|
||||
DocBuilderTemplate builderTemplate = new DocBuilderTemplate();
|
||||
builderTemplate.checkAndInit(config);
|
||||
builderTemplate.checkAndInit(config,true);
|
||||
ProjectDocConfigBuilder configBuilder = new ProjectDocConfigBuilder(config, javaProjectBuilder);
|
||||
IDocBuildTemplate docBuildTemplate = BuildTemplateFactory.getDocBuildTemplate(config.getFramework());
|
||||
List<ApiDoc> apiDocList = docBuildTemplate.getApiData(configBuilder);
|
||||
|
|
|
@ -61,7 +61,7 @@ public class RpcDocBuilderTemplate extends BaseDocBuilderTemplate {
|
|||
if (StringUtil.isEmpty(config.getFramework())) {
|
||||
config.setFramework(FrameworkEnum.DUBBO.getFramework());
|
||||
}
|
||||
super.checkAndInit(config);
|
||||
super.checkAndInit(config,false);
|
||||
config.setOutPath(config.getOutPath() + FILE_SEPARATOR + RPC_OUT_DIR);
|
||||
}
|
||||
|
||||
|
|
|
@ -1160,25 +1160,11 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
|
|||
simpleGicType = gicType.substring(gicType.lastIndexOf(".") + 1).toLowerCase();
|
||||
// is array
|
||||
if (JavaClassValidateUtil.isCollection(name) || JavaClassValidateUtil.isArray(name)) {
|
||||
boolean hasRequestBody = false;
|
||||
//param has @RequestBody ?
|
||||
List<JavaAnnotation> annotations = parameter.getAnnotations();
|
||||
for (JavaAnnotation annotation : annotations) {
|
||||
if (REQUEST_BODY_FULLY.equals(annotation.getType().getName())) {
|
||||
hasRequestBody = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//formData - multiple data
|
||||
if (!hasRequestBody && javaParameters.size() > 1) {
|
||||
return;
|
||||
apiMethodDoc.setIsRequestArray(1);
|
||||
if (JavaClassValidateUtil.isPrimitive(gicType)) {
|
||||
apiMethodDoc.setRequestArrayType(simpleGicType);
|
||||
} else {
|
||||
apiMethodDoc.setIsRequestArray(1);
|
||||
if (JavaClassValidateUtil.isPrimitive(gicType)) {
|
||||
apiMethodDoc.setRequestArrayType(simpleGicType);
|
||||
} else {
|
||||
apiMethodDoc.setRequestArrayType(OBJECT);
|
||||
}
|
||||
apiMethodDoc.setRequestArrayType(OBJECT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue