前提准备
1.Docker
&& Docker Compose
2.git clone https://github.com/fjc0k/docker-YApi.git
详细搭建教程
使用教程
官方文档: https://hellosean1025.github.io/yapi/
mongoDB启动失败
使用 setenforce 0 解决
Spring MVC 项目单模块结合Yapi使用实例
IDEA Plugin Github: YapiIdeaUploadPlugin
官方教程 github Wiki
1..idea
文件夹下,找到misc.xml
<component name="yapi">
<option name="projectToken">yapi 中项目token</option>
<option name="projectId">yapi 中项目id</option>
<option name="yapiUrl">http://127.0.0.1:3000</option>
<option name="projectType">api</option>
<option name="attachUploadUrl">http://localhost/fileupload</option>
<option name="returnClass">com.project.Response(1.7.4 及之后才支持,按需配置)</option>
</component>
2.根据java doc tag 规范代码
①YAPI分类: Controller 添加 @menu
Example:
对应Yapi项目中:
②接口名称
Link Github Wiki
Maven Other Tag
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
<!-- 必须配置 source-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 必须配置 javadoc from: http://maven.apache.org/plugins/maven-javadoc-plugin/examples/tag-configuration.html -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<tags>
<tag>
<name>menu</name>
<placement>a</placement>
<head>所属菜单 -> Yapi Upload Plugin中对应着分类</head>
</tag>
<tag>
<name>description</name>
<placement>a</placement>
<head>描述 -> Yapi Upload Plugin中对应着标题</head>
</tag>
<tag>
<name>other</name>
<placement>a</placement>
<head>除了description外的描述</head>
</tag>
<tag>
<name>date</name>
<placement>a</placement>
<head>日期 2019/12/16 19:18</head>
</tag>
<tag>
<name>created</name>
<placement>a</placement>
<head>创建人</head>
</tag>
<tag>
<name>return</name>
<placement>a</placement>
<head>函数返回值</head>
</tag>
</tags>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>