Update Yapi builder, add method for plugin

This commit is contained in:
oppofind 2020-08-31 21:51:57 +08:00
parent bf4b7056b3
commit 38bf981783
2 changed files with 17 additions and 3 deletions

View File

@ -67,6 +67,19 @@ public class YapiJsonBuilder {
yapiJsonCreate(config, configBuilder);
}
/**
* Only for smart-doc maven plugin and gradle plugin.
*
* @param config ApiConfig Object
* @param projectBuilder QDOX avaProjectBuilder
*/
public static void buildYapiCollection(ApiConfig config, JavaProjectBuilder projectBuilder) {
DocBuilderTemplate builderTemplate = new DocBuilderTemplate();
builderTemplate.checkAndInit(config);
ProjectDocConfigBuilder configBuilder = new ProjectDocConfigBuilder(config, projectBuilder);
yapiJsonCreate(config, configBuilder);
}
private static Set<String> getUrl(String url, String patter) {
Pattern pattern = Pattern.compile(patter);
@ -204,7 +217,7 @@ public class YapiJsonBuilder {
* @param type java type
* @return String
*/
public static String changeType(String type) {
private static String changeType(String type) {
switch (type) {
case "boolean":
return "boolean";
@ -223,7 +236,7 @@ public class YapiJsonBuilder {
* @param param ApiParam
* @return String
*/
public static String getTypeAndPropertiesJson(ApiParam param) {
private static String getTypeAndPropertiesJson(ApiParam param) {
StringBuffer resultJson = new StringBuffer();
resultJson.append("\"" + param.getField() + "\":{");

View File

@ -463,8 +463,9 @@ public class DocUtil {
switch (type) {
case "int32":
case "int16":
case "int64":
return "integer";
case "int64":
return "long";
case "double":
case "float":
case "number":