优点:
- 在线文档,可以请求调用
- 可以导出接口文档
- 没有swagger那种繁琐的注入,单纯的写Javadoc注释,通过idea插件进行推送接口文档
部署安装
linux服务器下
docker安装(自行百度,这里我忽略了)
docker-compose安装
sudo curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose.yaml
version: '3'
services:
yapi-web:
image: jayfong/yapi:latest
container_name: yapi-web
ports:
- 40001:3000
environment:
- YAPI_ADMIN_ACCOUNT=admin@docker.yapi
- YAPI_ADMIN_PASSWORD=adm1n
- YAPI_CLOSE_REGISTER=true
- YAPI_DB_SERVERNAME=yapi-mongo
- YAPI_DB_PORT=27017
- YAPI_DB_DATABASE=yapi
- YAPI_MAIL_ENABLE=false
- YAPI_LDAP_LOGIN_ENABLE=false
- YAPI_PLUGINS=[]
depends_on:
- yapi-mongo
links:
- yapi-mongo
restart: unless-stopped
yapi-mongo:
image: mongo:latest
container_name: yapi-mongo
volumes:
- ./data/db:/data/db
expose:
- 27017
restart: unless-stopped
运行
#在docker-compose.yaml同路径下进行
docker-compose up -d
idea插件的使用
idea中安装插件 YapiX
yapix/GUIDE.md at main · jetplugins/yapix · GitHub
GitHub - jetplugins/yapix: Generate API documents to any place: YApi, RAP2, Eolinker, etc.
idea中的项目根目录增加配置.yapix
# https://github.com/jetplugins/yapix/blob/main/docs/GUIDE.md
yapiProjectId=11
returnWrapType=
projectId:
使用
编写文档信息--javdoc
规则使用,编码按照正常的javadoc进行写注释就好(原理:读取Javadoc生成接口返回给yapi)
上传文档信息
选择当前方法或者当前类进行右击 Upload to YApi
上传成功
导入导出
效果如下:
|