SpringBoot auto-generated API documentation

In doing the project, if the project is before and after separation, be sure to back-end and front end or the mobile docking interface, so the question is, the interface is not addressed to their own look, the general will use Excel or Word to write , senior point on the use of API management platform manual entry, a project with thousands of tens of thousands of interfaces, God, this is such a big workload, even more painful when the interface maintenance, in order to solve such a thing we can use japi the project to complete RESTFul document automatically generated, based entirely on comments generated, you can view more detailed configuration https://github.com/dounine/japi .

Instructions for use

Clone projects down

git clone https://github.com/dounine/japi.git

Compiler package

cd japi/java
gradle install -xtest

Run JAPI Admin

cd japi/java
gradle bootRun

Run JAPI Document Interface

cd japi/node
node app.js

RESTFul document generation

maven project

<dependency>
    <groupId>com.dounine.japi</groupId>
    <artifactId>client</artifactId>
    <version>1.0</version>
</dependency>

gradle project

compile group: 'com.dounine.japi', name: 'client', version: '1.0'

Edit resources/japi.propertiesProfile

japi.name=test
japi.uuid=43a600877430438596de3d330e4bd06e
japi.version=1.0.0
japi.author=lake
japi.url=http://192.168.0.123:8080
japi.description=this is project description.
japi.createTime=2017-02-23 10:44:44
japi.icon=/home/lake/github/japi/html/img/logo.png
japi.server=http://192.168.0.179:7778
japi.server.username=japi
japi.server.password=japi123

Writing an action

/**
 * 获取用户列表
 * @param user 用户信息
 * @return class User
 * @version v2
 */
@GetMapping(value = "v2/list")
public Result hots(@Validated({User.UserDEL.class}) User user) throws RuntimeException {

    return null;
}

Write a generation API class
JapiCreateTest.java

@Test
    public void testCreate(){
        JapiClient.setPrefixPath("/home/lake/github/test-japi/java/");//项目路径前缀
        JapiClient.setpostfixPath("/src/main/java");//项目路径后缀

        JapiClient.setProjectJavaPath("client");//主项目地扯
        JapiClient.setActionReletivePath("com/dounine/test-japi/action");//相对主项目action包所在路径
        //JapiClient.setIncludeProjectJavaPath(new String[]{"api"});//主项目中关联的其它项目包路径
        JapiClient.setIncludePackages(new String[]{"com.dounine.test-japi"});//关联的包,用于准确快速搜索
        JapiClient.saveHistory(true);//是否保留本地历史版本
        JapiClient.setFlushServer(false);//强制同步本地与服务器所有的版本(会先删除服务器以前的历史版本)

        IProject project = ProjectImpl.init();
        JapiClientStorage japiClientStorage = JapiClientStorage.getInstance();
        japiClientStorage.setProject(project);
        japiClientStorage.autoSaveToDisk();//自动使用到本地磁盘==> 用户目录/.japi-client/
        new JapiClientTransfer().autoTransfer(japiClientStorage);//文件传输到主服务器.
    }

Last Visitors browser http: // localhost: 7777

You can see the document Login RESTFul

9028759-574f309462fe5567
Write pictures described here

Use your account to log in, you can see all the items

9028759-62faecd61da49803
Write pictures described here

Look into the project in detail RESTFul Interface

9028759-d71a2554824ea59d
Write pictures described here

scenes to be used

JAPIThe most suitable SpringClouduse of such a distributed multi-module project, built a powerful regular expression, it makes code comments more standardized, different from swiggersuch use 侵入式annotated document generation, JAPIis based entirely on standard 注释generated strong support JSR303or custom annotation.

Spirit of open source

Welcomed the intention of the students joined JAPIthe project team will transform it better.


9028759-5619fe0d9edd7a1b.png

Guess you like

Origin blog.csdn.net/weixin_34026484/article/details/90840112