postman url resource add protocol
This commit is contained in:
parent
fd44d83c9c
commit
0d7caf6b06
|
@ -1,5 +1,12 @@
|
|||
## smart-doc版本
|
||||
版本小于1.0都属于试用,正式1.0起始发布将会等到文中提到的问题解决后才发布。
|
||||
#### 版本号:2.1.0
|
||||
- 更新日期: 2020-03-31
|
||||
- 更新内容:
|
||||
1. 导出的postman的url资源下添加缺失的protocol。
|
||||
2. 增加@ignoreParams自定义tag来过滤掉不想显示在文档中参数。
|
||||
3. 增加了自动生成版本记录的功能。
|
||||
4. 修改torna推送的bug。
|
||||
#### 版本号:2.0.9
|
||||
- 更新日期: 2020-03-12
|
||||
- 更新内容:
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
*/
|
||||
package com.power.doc.builder;
|
||||
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.power.common.util.CollectionUtil;
|
||||
|
@ -135,19 +134,24 @@ public class PostmanJsonBuilder {
|
|||
String url = Optional.ofNullable(apiMethodDoc.getRequestExample().getUrl()).orElse(apiMethodDoc.getUrl());
|
||||
urlBean.setRaw(PathUtil.toPostmanPath(url));
|
||||
try {
|
||||
URL url1 = new java.net.URL(apiMethodDoc.getServerUrl());
|
||||
if (url1.getPort() == -1) {
|
||||
URL javaUrl = new java.net.URL(apiMethodDoc.getServerUrl());
|
||||
if (javaUrl.getPort() == -1) {
|
||||
urlBean.setPort(null);
|
||||
} else {
|
||||
urlBean.setPort(String.valueOf(url1.getPort()));
|
||||
urlBean.setPort(String.valueOf(javaUrl.getPort()));
|
||||
}
|
||||
// set protocol
|
||||
String protocol = javaUrl.getProtocol();
|
||||
if (StringUtil.isNotEmpty(protocol)) {
|
||||
urlBean.setProtocol(protocol);
|
||||
}
|
||||
|
||||
List<String> hosts = new ArrayList<>();
|
||||
hosts.add(url1.getHost());
|
||||
hosts.add(javaUrl.getHost());
|
||||
urlBean.setHost(hosts);
|
||||
|
||||
List<String> paths = new ArrayList<>();
|
||||
paths.add(url1.getPath());
|
||||
paths.add(javaUrl.getPath());
|
||||
urlBean.setPath(paths);
|
||||
} catch (MalformedURLException e) {
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ public class UrlBean {
|
|||
|
||||
private String raw;
|
||||
|
||||
private String protocol;
|
||||
|
||||
private List<String> path;
|
||||
|
||||
private List<String> host;
|
||||
|
@ -51,6 +53,14 @@ public class UrlBean {
|
|||
this.raw = raw;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public void setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
public List<String> getPath() {
|
||||
return path;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue