一个非侵入的api编译、收集、Rest文档生成工具。工具经过分析代码和注释,获取文档信息,生成RestDoc文档html
程序员一直以来都有一个烦恼,只想写代码,不想写文档。代码就表达了个人思想和灵魂。java
Python提出了一个方案,叫docstring,来试图解决这个问题。即编写代码,同时也能写出文档,保持代码和文档的一致。docstring说白了就是一堆代码中的注释。Python的docstring能够经过help函数直接输出一份有格式的文档,本工具的思想与此相似。git
Apigcc是一个非侵入的RestDoc文档生成工具。工具经过分析代码和注释,获取文档信息,生成RestDoc文档。程序员
/** * 欢迎使用Apigcc * @index 1 */ @RestController public class HelloController { /** * 示例接口 * @param name 名称 * @return */ @RequestMapping("/greeting") public HelloDTO greeting(@RequestParam(defaultValue="apigcc") String name) { return new HelloDTO("hello "+name); } }
easy use apigcc with mavengithub
<plugin> <groupId>com.github.apiggs</groupId> <artifactId>apiggs-maven-plugin</artifactId> <version><!-- 替换为上方版本号 --></version> <executions> <execution> <phase>compile</phase> <goals> <goal>apiggs</goal> </goals> </execution> </executions> <configuration> <!-- options in there --> </configuration> </plugin>
when you compile source code, apiggs will build rest doc.c#
optionsapi
执行方法:浏览器
查看API文档:app
另外,也能够放入容器远程访问,方法以下:maven
运行项目
gradlew build cd service\build\libs java -jar apigcc-hub-{version}.jar
浏览器访问 http://127.0.0.1:8080
详情请参考:apigcc