Giter Site home page Giter Site logo

yapi's Introduction

YApi 可视化接口管理平台

源码来源yapi 官方github仓库,并基于最新版修复众多bug,基本实现拿来即用

所有问题看这里就可以解决了,折腾了好久总结出来的:https://blog.opendeveloper.cn/yapi

修复bug汇总:https://blog.opendeveloper.cn/yapi/bug

docker:https://blog.opendeveloper.cn/yapi/docker

当前集成插件:(在config.json中添加进去即可使用)

  • yapi-plugin-add-user
  • yapi-plugin-api-watch
  • yapi-plugin-export-schema
  • yapi-plugin-import-swagger-customize
  • yapi-plugin-interface-oauth2-token
  • yapi-plugin-notifier
  • yapi-plugin-pl-auto-test
  • yapi-plugin-qsso
  • yapi-plugin-webhook

官方redme如下:

体验地址:

http://yapi.smart-xwork.cn/

文档:

hellosean1025.github.io/yapi

平台介绍

avatar

YApi 是高效易用功能强大的 api 管理平台,旨在为开发、产品、测试人员提供更优雅的接口管理服务。可以帮助开发者轻松创建、发布、维护 API,YApi 还为用户提供了优秀的交互体验,开发人员只需利用平台提供的接口数据写入工具以及简单的点击操作就可以实现接口的管理。

QQ交流群:

644642474 主群可能已满

941802405 群2欢迎加入

特性

  • 基于 Json5 和 Mockjs 定义接口返回数据的结构和文档,效率提升多倍
  • 扁平化权限设计,即保证了大型企业级项目的管理,又保证了易用性
  • 类似 postman 的接口调试
  • 自动化测试, 支持对 Response 断言
  • MockServer 除支持普通的随机 mock 外,还增加了 Mock 期望功能,根据设置的请求过滤规则,返回期望数据
  • 支持 postman, har, swagger 数据导入
  • 免费开源,内网部署,信息再也不怕泄露了

内网部署

环境要求

  • nodejs(7.6+)
  • mongodb(2.6+)
  • git

安装

使用我们提供的 yapi-cli 工具,部署 YApi 平台是非常容易的。执行 yapi server 启动可视化部署程序,输入相应的配置和点击开始部署,就能完成整个网站的部署。部署完成之后,可按照提示信息,执行 node/{网站路径/server/app.js} 启动服务器。在浏览器打开指定url, 点击登录输入您刚才设置的管理员邮箱,默认密码为 ymfe.org 登录系统(默认密码可在个人中心修改)。

npm install -g yapi-cli --registry https://registry.npm.taobao.org
yapi server 

服务管理

利用pm2方便服务管理维护。

npm install pm2 -g  //安装pm2
cd  {项目目录}
pm2 start "vendors/server/app.js" --name yapi //pm2管理yapi服务
pm2 info yapi //查看服务信息
pm2 stop yapi //停止服务
pm2 restart yapi //重启服务

升级

升级项目版本是非常容易的,并且不会影响已有的项目数据,只会同步 vendors 目录下的源码文件。

cd  {项目目录}
yapi ls //查看版本号列表
yapi update //更新到最新版本
yapi update -v {Version} //更新到指定版本

教程

YApi 插件

代码生成

YApi docker部署(非官方)

YApi 一些工具

YApi 的一些客户

  • 去哪儿
  • 携程
  • 艺龙
  • 美团
  • 百度
  • 腾讯
  • 阿里巴巴
  • 京东
  • 今日头条
  • 唯品支付
  • 链家网
  • 快手
  • 便利蜂
  • 中商惠民
  • 新浪
  • VIPKID
  • 马蜂窝
  • 伴鱼
  • 旷视科技

Authors

License

Apache License 2.0

yapi's People

Contributors

2234839 avatar aimuz avatar amiezhang avatar amnsss avatar ariesly15 avatar billlucky avatar chenlizhi55 avatar congqiu avatar dear-lizhihua avatar dependabot[bot] avatar duicym avatar dwb1994 avatar fjc0k avatar furioncs avatar gandao avatar gaoxiaomumu avatar hellosean1025 avatar jason-joo avatar jayzou avatar kangofchen avatar lwg529 avatar onvno avatar redhatxl avatar ryan-miao avatar shouldnotappearcalm avatar spiritree avatar tangcent avatar wxxcarl avatar xwj-vic avatar yuu2lee4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yapi's Issues

在请求配置中设置Pre-request script,设置脚本为console.log(xxx); 无法在浏览器的console框看到

版本号

~

什么问题

~ 在请求配置中设置Pre-request script,设置脚本为console.log(xxx); 无法在浏览器的console框看到。原生的项目可以的。
设置 - 请求设置 - Pre-request Script(请求参数处理脚本),脚本填写如下:

console.log(context.requestBody);
console.log(context.utils);
console.log(context.utils.md5(context.requestBody));

如何复现此问题

~ 在设置 - 请求设置 - Pre-request Script(请求参数处理脚本),脚本填写如下:

console.log(context.requestBody);
console.log(context.utils);
console.log(context.utils.md5(context.requestBody));

什么浏览器

~ chrome

什么系统(Linux, Windows, macOS)

Windows

更多细节

用原生的项目可以在浏览器的console框看到。现在看不到这个不太利用一些脚本编写希望作者辛苦看下

Method Promise.prototype.then called on incompatible receiver [object Object]

版本号

xuweijie1015/yapi:latest

什么问题

使用接口中的高级 Mock 脚本方式进行 mock,会出现 Method Promise.prototype.then called on incompatible receiver [object Object]。
堆栈信息如下所示

Error: Error: Method Promise.prototype.then called on incompatible receiver [object Object]
at Safeify.handleScriptResult (/yapi/vendors/node_modules/safeify/lib/Safeify.js:189:34)
at Safeify.handleScriptDone (/yapi/vendors/node_modules/safeify/lib/Safeify.js:178:14)
at Safeify.onWorkerDone (/yapi/vendors/node_modules/safeify/lib/Safeify.js:164:14)
at ChildProcess.Safeify.onWorkerMessage (/yapi/vendors/node_modules/safeify/lib/Safeify.js:55:33)
at ChildProcess.emit (events.js:310:20)
at emit (internal/child_process.js:876:12)
at processTicksAndRejections (internal/process/task_queues.js:85:21)

如何复现此问题

接口信息
image

mock 脚本
image

运行结果
image

什么浏览器

chrome

什么系统(Linux, Windows, macOS)

windows

sass文件引入的报错

版本号

~

什么问题

~
截屏2023-06-08 16 44 20

如何复现此问题

~ 配置环境安装依赖然后npm run dev

什么浏览器

~ 谷歌

什么系统(Linux, Windows, macOS)

macOS

不支持添加分组

版本号

~
1.11.0

什么问题

~
如果添加分组,界面没有地方可以添加分组

如何复现此问题

~

什么浏览器

~
Chrome

什么系统(Linux, Windows, macOS)

Linux

启动报错,似乎是插件问题

版本号

~

什么问题

~
截屏2023-06-09 09 57 23

如何复现此问题

~ 安装好依赖运行npm run dev
try {
pluginModuleList = require('./plugin-module.js');
} catch (err) {
console.log('err', err);
pluginModuleList = {};
}
错误是这块代码产生的plugin.js

什么浏览器

~ 谷歌

什么系统(Linux, Windows, macOS)

macOS

使用https://hub.docker.com/r/xuweijie1015/yapi镜像构建失败:dial tcp 104.18.122.25:443: i/o timeout

版本号

~

什么问题

~ 提供的docker镜像报:
FATA[0040] failed to copy: httpReadSeeker: failed open: failed to do request: Get "https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/9a/9a6684e02573ac76e3a1e21cf9a6e50eb656cb91d2cb185dd689de460efcc7cf/data?verify=1685966521-TXiGJ3ctjaFtL17gWyag9ftoRZA%3D": dial tcp 104.18.122.25:443: i/o timeout

如何复现此问题

~ 使用https://hub.docker.com/r/xuweijie1015/yapi进行构建

什么浏览器

~ chrome

什么系统(Linux, Windows, macOS)

windows

更多细节:

设置了全局代理,在windows的cmd可以ping到。

环境变量安装新插件时,无法安装成功

版本号

~

什么问题

~

如何复现此问题

环境变量增加安装新插件时,无法安装成功

什么浏览器

~

什么系统(Linux, Windows, macOS)

Linux

可否帮忙集成下opendoc插件

pl-auto-test自动化测试插件无法返回正确的测试结果

版本号

docker镜像 xuweijie1015/yapi:latest

什么问题

pl-auto-test自动化测试插件可以添加测试任务,但是无法返回正确的测试结果

  • 添加测试计划成功
    image
  • 测试结果无显示
    image

如何复现此问题

  • 正常启动docker镜像,docker run -d --name yapi-xuweijie1015 -p 5858:3000 xuweijie1015/yapi
  • 修改config.json文件,添加{"name":"pl-auto-test","options":{"host":"http://localhost:3000"}}
  • 重启容器,立即复现

什么浏览器

egde(chrome版)、chrome

什么系统(Linux, Windows, macOS)

Linux

无法安装其它部分插件,docker-compose环境变量中添加其它plugin后启动失败

版本号

~ 1007d68ecfe4 xuweijie1015/yapi:latest

什么问题

[3/5] Fetching packages...

error [email protected]: The engine "node" is incompatible with this module. Expected version ">=14". Got "12.16.3"

error Found incompatible module.

info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.


....


关闭引导服务...
尝试启动 YApi...
(node:1) UnhandledPromiseRejectionWarning: Error: Cannot find module 'yapi-plugin-webhook'
Require stack:
- /yapi/vendors/common/plugin.js
- /yapi/vendors/server/plugin.js
- /yapi/vendors/server/app.js
- /yapi/vendors/start.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at getPluginConfig (/yapi/vendors/common/plugin.js:8:20)
    at /yapi/vendors/common/plugin.js:39:22
    at Array.map (<anonymous>)
    at exports.initPlugins (/yapi/vendors/common/plugin.js:33:21)
    at Object.<anonymous> (/yapi/vendors/server/plugin.js:235:21)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/yapi/vendors/server/app.js:10:1)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

如何复现此问题

~ - YAPI_PLUGINS=[{"name":"add-user"},{"name":"export-schema"},{"name":"import-swagger-customize"},{"name":"webhook"},{"name":"notifier","options":{"host":"http://localhost:8090/"}}]
~ 环境变量中YAPI_PLUGINS不使用默认值,增加其他插件。
~ import-swagger-customize这个是能够自动更新接口的,无法使用比较蛋疼。

什么浏览器

~ 无关

什么系统(Linux, Windows, macOS)Linux

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.