mirror of
https://github.com/YMFE/yapi.git
synced 2025-03-07 14:16:52 +08:00
fix: import-swagger import response bug
This commit is contained in:
parent
3dcb4fadb5
commit
3a99a0c7b3
@ -100,12 +100,17 @@ function improtData(importDataModule){
|
||||
|
||||
function handleResponse(api){
|
||||
let res_body = '';
|
||||
if(!api || !Array.isArray(api)){
|
||||
if(!api || typeof api !== 'object'){
|
||||
return res_body;
|
||||
}
|
||||
_.each(api, (res, code)=>{
|
||||
if(code == 200 || code === 'default'){
|
||||
res_body = handleSchema(res.schema);
|
||||
if(code == 200){
|
||||
if(res && typeof res === 'object'){
|
||||
res_body = handleSchema(res.schema);
|
||||
}else{
|
||||
res_body = '';
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
return res_body;
|
||||
@ -118,7 +123,8 @@ function improtData(importDataModule){
|
||||
}
|
||||
try{
|
||||
data.definitions = SwaggerData.definitions;
|
||||
return JSON.stringify(jsf(data), null, 2);
|
||||
let jsfData = JSON.stringify(jsf(data), null, 2);
|
||||
return jsfData;
|
||||
}catch(e){
|
||||
return '';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user