Skip to content

Commit

Permalink
perf:response中响应schema的description异常的问题[Github#690](#690)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoymin committed Jan 7, 2024
1 parent 5dd2690 commit 754bf18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
22 changes: 1 addition & 21 deletions knife4j-vue/src/core/Knife4jAsync.js
Original file line number Diff line number Diff line change
Expand Up @@ -2142,7 +2142,6 @@ SwaggerBootstrapUi.prototype.analysisDefinitionRefTableModel = function (instanc
if (KUtils.checkUndefined(def)) {
//response对象的值赋值一个description
originalTreeTableModel.description = KUtils.propValue("description", def, "");

if (def.hasOwnProperty('properties')) {
var props = def['properties'];
// console.log(props)
Expand Down Expand Up @@ -3859,25 +3858,6 @@ SwaggerBootstrapUi.prototype.initApiInfoAsyncOAS2 = function (swpinfo) {
}
}
if (rptype != null) {
// 查询
/* for (var i = 0; i < that.currentInstance.difArrs.length; i++) {
var ref = that.currentInstance.difArrs[i];
if (ref.name == rptype) {
if(!ref.init){
// 如果该类没有加载,则进行加载
that.analysisDefinitionAsync(that.currentInstance.swaggerData,ref);
}
if (arr) {
var na = new Array();
na.push(ref.value);
swaggerResp.responseValue = JSON.stringify(na, null, '\t');
swaggerResp.responseJson = na;
} else {
swaggerResp.responseValue = JSON.stringify(ref.value, null, '\t');
swaggerResp.responseJson = ref.value;
}
}
} */
// 响应参数
var def = that.getDefinitionByName(rptype, swpinfo.oas2);
if (def != null) {
Expand Down Expand Up @@ -6488,7 +6468,7 @@ function deepResponseRefParameter(swpinfo, that, def, resParam) {
swpinfo.responseRefParameters.push(refParam);
if (def.hasOwnProperty('properties')) {
var props = def['properties'];
props.forEach(function (p) {
props.forEach(p => {
// })
// $.each(props,function (i, p) {
var refp = new SwaggerBootstrapUiParameter();
Expand Down
8 changes: 6 additions & 2 deletions knife4j-vue/src/views/api/Document.vue
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,13 @@ export default {
schemaName
);
model = that.swagger.analysisDefinitionRefTableModel(that.swaggerInstance.id, model);
if (KUtils.checkUndefined(model.description)) {
param.description = model.description;
if (!KUtils.checkUndefined(param.description)) {
//如果参数已经有description,那么就不赋值,否则,取model的description
if (KUtils.checkUndefined(model.description)) {
param.description = model.description;
}
}
//console.log('params-model', model)
if (model && model.params) {
param.children = model.params.map(child => {
Expand Down

0 comments on commit 754bf18

Please sign in to comment.