fix swagger2.0 NullPointException (#1196)
* fix swagger2.0同步时存在$ref参数而dto不存在的情况 * 删除多余代码 * 修复编辑HTTP配置域名为空是,数据库config拼接的json串中domain没有更新为空的情况 * 语法调整 Co-authored-by: fengkaijun <fengkaijun@yingzi.com>
This commit is contained in:
parent
5340a37cb1
commit
bb952bd430
|
@ -270,7 +270,12 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
||||||
refSet.add(simpleRef);
|
refSet.add(simpleRef);
|
||||||
Model model = this.definitions.get(simpleRef);
|
Model model = this.definitions.get(simpleRef);
|
||||||
JSONArray propertyList = new JSONArray();
|
JSONArray propertyList = new JSONArray();
|
||||||
|
if (model != null) {
|
||||||
propertyList.add(getBodyParameters(model.getProperties(), refSet));
|
propertyList.add(getBodyParameters(model.getProperties(), refSet));
|
||||||
|
} else {
|
||||||
|
propertyList.add(new JSONObject());
|
||||||
|
}
|
||||||
|
|
||||||
jsonObject.put(key, propertyList);
|
jsonObject.put(key, propertyList);
|
||||||
} else {
|
} else {
|
||||||
jsonObject.put(key, new ArrayList<>());
|
jsonObject.put(key, new ArrayList<>());
|
||||||
|
|
|
@ -49,7 +49,8 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
validateSocket(socket) {
|
validateSocket(socket) {
|
||||||
if (!socket) return true;
|
// if (!socket) return true;
|
||||||
|
if (socket !== ''){
|
||||||
let urlStr = this.httpConfig.protocol + '://' + socket;
|
let urlStr = this.httpConfig.protocol + '://' + socket;
|
||||||
let url = {};
|
let url = {};
|
||||||
try {
|
try {
|
||||||
|
@ -58,7 +59,6 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.httpConfig.domain = decodeURIComponent(url.hostname);
|
this.httpConfig.domain = decodeURIComponent(url.hostname);
|
||||||
|
|
||||||
this.httpConfig.port = url.port;
|
this.httpConfig.port = url.port;
|
||||||
let path = url.pathname === '/' ? '' : url.pathname;
|
let path = url.pathname === '/' ? '' : url.pathname;
|
||||||
if (url.port) {
|
if (url.port) {
|
||||||
|
@ -67,6 +67,13 @@
|
||||||
this.httpConfig.socket = this.httpConfig.domain + path;
|
this.httpConfig.socket = this.httpConfig.domain + path;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
}else {
|
||||||
|
this.httpConfig.domain = socket;
|
||||||
|
this.httpConfig.port = '';
|
||||||
|
this.httpConfig.socket = socket;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
validate() {
|
validate() {
|
||||||
let isValidate = false;
|
let isValidate = false;
|
||||||
|
|
Loading…
Reference in New Issue