Comments (10)
满足,写这个工具当时解决的主要问题之一就是这个,对象的多层嵌套。
ps:前端页面,时间紧迫,我当时偷懒,多层嵌套那个地方没有写递归,所以前端只能显示5层嵌套,我想对大部分业务,足够了,哪天不够了,我随时改下。后台是支持无限层嵌套的
from api-doc.
看,这就是个两层嵌套的例子,响应参数应该如下:
{
...
data:{
name:"",
age:""
}
...
}
from api-doc.
看了下你的例子,我这个可能比较特殊, 我的是3层嵌套,而且还是一个List
我的写法目前是这样:
@com.apidoc.annotation.ApiParam(name = "code", dataType = DataType.NUMBER, defaultValue = "0", description = "状态编码"),
@com.apidoc.annotation.ApiParam(name = "message", dataType = DataType.STRING, defaultValue = "", description = "信息提示"),
@com.apidoc.annotation.ApiParam(name = "data", dataType = DataType.OBJECT, defaultValue = "null", description = "响应数据", object = "PageResult"),
@com.apidoc.annotation.ApiParam(name = "pageSize", dataType = DataType.NUMBER, defaultValue = "0", description = "分页条数", belongTo = "PageResult"),
@com.apidoc.annotation.ApiParam(name = "pageNum", dataType = DataType.NUMBER, defaultValue = "0", description = "当前页码", belongTo = "PageResult"),
@com.apidoc.annotation.ApiParam(name = "result", dataType = DataType.ARRAY, defaultValue = "0", description = "结果集", belongTo = "PageResult", object = "ArchiveType"),
@com.apidoc.annotation.ApiParam(name = "typeId", dataType = DataType.STRING, defaultValue = "", description = "归档类型ID", belongTo = "ArchiveType"),
@com.apidoc.annotation.ApiParam(name = "typeName", dataType = DataType.NUMBER, defaultValue = "", description = "归档类型名称", belongTo = "ArchiveType"),
重点看下这一行
@com.apidoc.annotation.ApiParam(name = "result", dataType = DataType.ARRAY, defaultValue = "0", description = "结果集", belongTo = "PageResult", object = "ArchiveType"),
from api-doc.
是对的,list的话dataType = DataType.ARRAY就可以了,最终都是转化成json,list和数组是一样的,你这样是对的,有什么问题吗? 记得下载最新版的前端 页面 这个文件夹(https://github.com/liupeng328/api-doc/tree/master/src/main/resources/static/apidoc)
from api-doc.
并不特殊,正常的需求,这个工具我们已经用了半年了,基本坑都踩完了。这是基本需求
from api-doc.
方便的能否加下QQ ,这里截图还不会操作 419475374
from api-doc.
最底下有qq群的啊,加群就行了
from api-doc.
嗯,已发群里,有空的话 帮忙看看, 感谢!!!
from api-doc.
from api-doc.
已经改为递归实现,参数中的对象支持无限层嵌套,当时这个地方偷懒了。哈哈,今天改过来了
<div class="div-table">
<!--递归-->
<div *ngFor="let requestParam of params">
<!--第1层-->
<div *ngIf="!requestParam.list">
<table>
<tr>
<td [ngStyle]="{'padding-left':(10+20*index)+'px','color':'red'}">{{requestParam.name}}</td>
<td *ngIf="require">{{requestParam.required}}</td>
<td>{{requestParam.dataType}}</td>
<td>{{requestParam.defaultValue}}</td>
<td>{{requestParam.description}}</td>
</tr>
</table>
</div>
<div *ngIf="requestParam.list">
<table>
<tr>
<td [ngStyle]="{'padding-left':(10+20*index)+'px','color':'red'}">{{requestParam.name}}</td>
<td *ngIf="require">{{requestParam.required}}</td>
<td>{{requestParam.dataType}}</td>
<td>{{requestParam.defaultValue}}</td>
<td>{{requestParam.description}}</td>
</tr>
</table>
<!--第n层-->
<app-api-param [params]="requestParam.list" [require]="true" [index]="index+1"></app-api-param>
</div>
</div>
</div>
from api-doc.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from api-doc.