修改gson scope 修改默认项目名

This commit is contained in:
xingzi 2019-12-01 14:38:26 +08:00
parent 7cca734923
commit 0c5408ac0f
4 changed files with 17 additions and 14 deletions

View File

@ -87,7 +87,6 @@
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>

View File

@ -4,6 +4,7 @@ package com.power.doc.builder;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.power.common.util.FileUtil;
import com.power.common.util.ValidateUtil;
import com.power.doc.constants.DocGlobalConstants;
import com.power.doc.model.ApiConfig;
import com.power.doc.model.ApiDoc;
@ -24,7 +25,7 @@ import java.util.List;
/**
* @author yu 2019/11/21.
*/
public class PostMainJsonBuilder {
public class PostManJsonBuilder {
/**
* 构建postman json
@ -38,7 +39,7 @@ public class PostMainJsonBuilder {
List<ApiDoc> apiDocList = sourceBuilder.getControllerApiData();
RequestItem requestItem = new RequestItem();
requestItem.setInfo(new InfoBean());
requestItem.setInfo(new InfoBean(config.getProjectName()));
List<ItemBean> itemBeans = new ArrayList<>();
apiDocList.forEach(
apiDoc -> {
@ -94,7 +95,9 @@ public class PostMainJsonBuilder {
if (apiMethodDoc.getType().equals(DocGlobalConstants.HTTP_POST)) {
requestBean.setBody(buildBodyBean(apiMethodDoc));
} else {
requestBean.setUrl(apiMethodDoc.getRequestUsage());
if(! ValidateUtil.isNotUrl(apiMethodDoc.getRequestUsage())) {
requestBean.setUrl(apiMethodDoc.getRequestUsage());
}
}
item.setRequest(requestBean);
return item;

View File

@ -45,7 +45,7 @@ public class DocGlobalConstants {
public static final String ALL_IN_ONE_CSS = "AllInOne.css";
public static final String POSTMAN_JSON = "/smart-doc.json";
public static final String POSTMAN_JSON = "/postman.json";
public static final String CONTROLLER_FULLY = "org.springframework.stereotype.Controller";

View File

@ -1,5 +1,9 @@
package com.power.doc.model.postman;
import com.google.gson.Gson;
import com.power.common.util.StringUtil;
import org.apache.commons.lang3.StringUtils;
import java.util.UUID;
/**
@ -11,16 +15,13 @@ public class InfoBean {
private String name;
String schema ;
public InfoBean(String name) {
this.name = name;
if(StringUtils.isBlank(name)){
this.name = "smart-doc";
}
else {
this.name = name;
}
this._postman_id =UUID.randomUUID().toString();
this.schema = "https://schema.getpostman.com/json/collection/v2.0.0/collection.json";
}
public InfoBean() {
this.name = "smart-doc";
this._postman_id =UUID.randomUUID().toString();
this.schema = "https://schema.getpostman.com/json/collection/v2.0.0/collection.json";
}
}