mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-18 13:04:46 +08:00
fix: 处理冲突
This commit is contained in:
commit
9ca6e7c406
@ -2,18 +2,19 @@
|
||||
|
||||
#### Feature
|
||||
|
||||
* 完美支持 swagger, 接口请求参数和返回数据支持使用 json-schema 定义数据结构
|
||||
* 增加测试集合列表的拖动功能
|
||||
* interfaceList页实现数据分页
|
||||
* 新建接口的时候产生一个demo response
|
||||
* 接口列表中增加“开放接口”状态
|
||||
* 接口列表树形组件支持拖动
|
||||
* json-schema 导出 table表单
|
||||
* 本地部署Iconfont
|
||||
* 接口列表和测试集树形组件支持拖动
|
||||
* 图标从阿里cdn替换到本地
|
||||
|
||||
#### Bug Fixed
|
||||
|
||||
* 将部分数据拷贝变成使用immer
|
||||
* 修复高级 Mock 服务端报错
|
||||
* 修复测试集合table拖动频繁请求的问题
|
||||
* 修复swagger 数据导入部分bug
|
||||
|
||||
### v1.3.6
|
||||
|
||||
|
472
a.markdown
472
a.markdown
@ -1,472 +0,0 @@
|
||||
|
||||
<h1 class="curproject-name"> swagger_test </h1>
|
||||
啊啊啊啊啊啊
|
||||
|
||||
|
||||
# eeeeeee
|
||||
[TOC]
|
||||
|
||||
|
||||
## 13%0A%3Ca%20id%3D13%3E%20%3C/a%3E
|
||||
[TOC]
|
||||
|
||||
### 基本信息
|
||||
|
||||
**Path:** /api/13
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**接口描述:**
|
||||
|
||||
|
||||
### 请求参数
|
||||
**Query**
|
||||
|
||||
| 参数名称 | 是否必须 | 示例 | 备注 |
|
||||
| ------------ | ------------ | ------------ | ------------ |
|
||||
| qqq | 是 | | |
|
||||
| wwww | 是 | | |
|
||||
| wwwww | 是 | | |
|
||||
|
||||
### 返回数据
|
||||
|
||||
<table>
|
||||
<thead class="ant-table-thead">
|
||||
<tr>
|
||||
<th key=name>名称</th><th key=type>类型</th><th key=required>是否必须</th><th key=default>默认值</th><th key=desc>备注</th><th key=sub>其他信息</th>
|
||||
</tr>
|
||||
</thead><tbody className="ant-table-tbody"><tr key=00><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> id</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span>The unique identifier for product</span></td><td key=5></td></tr><tr key=01><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> name</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span></span></td><td key=5></td></tr><tr key=02><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> price</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span></span></td><td key=5><p key=1><span style="font-weight: '700'">最小值: </span><span>0</span></p></td></tr><tr key=03><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> arr</span></td><td key=1><span>string []</span></td><td key=2>非必须</td><td key=3></td><td key=4><span>sdfsdf</span></td><td key=5><p key=3><span style="font-weight: '700'">item 类型: </span><span>string</span></p></td></tr><tr key=04><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> tags</span></td><td key=1><span>object []</span></td><td key=2>非必须</td><td key=3></td><td key=4><span></span></td><td key=5><p key=0><span style="font-weight: '700'">最小数量: </span><span>1</span></p><p key=1><span style="font-weight: '700'">元素是否都不同: </span><span>true</span></p><p key=3><span style="font-weight: '700'">item 类型: </span><span>object</span></p></td></tr><tr key=040><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> length</span></td><td key=1><span>number</span></td><td key=2>非必须</td><td key=3></td><td key=4><span></span></td><td key=5></td></tr><tr key=041><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> width</span></td><td key=1><span>number</span></td><td key=2>非必须</td><td key=3></td><td key=4><span></span></td><td key=5></td></tr><tr key=042><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> height</span></td><td key=1><span>number</span></td><td key=2>非必须</td><td key=3></td><td key=4><span></span></td><td key=5></td></tr><tr key=05><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> dimensions</span></td><td key=1><span></span></td><td key=2>非必须</td><td key=3></td><td key=4><span></span></td><td key=5></td></tr><tr key=050><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> length</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span></span></td><td key=5></td></tr><tr key=051><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> width</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span></span></td><td key=5></td></tr><tr key=052><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> height</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span></span></td><td key=5></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## 16%0A%3Ca%20id%3D16%3E%20%3C/a%3E
|
||||
[TOC]
|
||||
|
||||
### 基本信息
|
||||
|
||||
**Path:** /api/16
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**接口描述:**
|
||||
|
||||
|
||||
### 请求参数
|
||||
|
||||
### 返回数据
|
||||
|
||||
<table>
|
||||
<thead class="ant-table-thead">
|
||||
<tr>
|
||||
<th key=name>名称</th><th key=type>类型</th><th key=required>是否必须</th><th key=default>默认值</th><th key=desc>备注</th><th key=sub>其他信息</th>
|
||||
</tr>
|
||||
</thead><tbody className="ant-table-tbody"><tr key=00><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> success</span></td><td key=1><span>boolean</span></td><td key=2>必须</td><td key=3></td><td key=4><span></span></td><td key=5><p key=0><span style="font-weight: '700'">枚举: </span><span>true,false</span></p></td></tr><tr key=01><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> data</span></td><td key=1><span></span></td><td key=2>必须</td><td key=3></td><td key=4><span></span></td><td key=5></td></tr><tr key=010><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> success</span></td><td key=1><span>boolean</span></td><td key=2>非必须</td><td key=3></td><td key=4><span></span></td><td key=5><p key=0><span style="font-weight: '700'">枚举: </span><span>true</span></p></td></tr><tr key=011><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> data</span></td><td key=1><span></span></td><td key=2>非必须</td><td key=3></td><td key=4><span></span></td><td key=5></td></tr><tr key=0110><td key=0><span style="padding-left: 40px"><span style="color: #8c8a8a">├─</span> count</span></td><td key=1><span>number</span></td><td key=2>非必须</td><td key=3></td><td key=4><span></span></td><td key=5></td></tr><tr key=0111><td key=0><span style="padding-left: 40px"><span style="color: #8c8a8a">├─</span> rows</span></td><td key=1><span>object []</span></td><td key=2>非必须</td><td key=3></td><td key=4><span></span></td><td key=5><p key=3><span style="font-weight: '700'">item 类型: </span><span>object</span></p></td></tr><tr key=01110><td key=0><span style="padding-left: 60px"><span style="color: #8c8a8a">├─</span> name</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span></span></td><td key=5></td></tr><tr key=01111><td key=0><span style="padding-left: 60px"><span style="color: #8c8a8a">├─</span> id</span></td><td key=1><span>string</span></td><td key=2>非必须</td><td key=3></td><td key=4><span></span></td><td key=5></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## 22%0A%3Ca%20id%3D22%3E%20%3C/a%3E
|
||||
[TOC]
|
||||
|
||||
### 基本信息
|
||||
|
||||
**Path:** /api/22
|
||||
|
||||
**Method:** POST
|
||||
|
||||
**接口描述:**
|
||||
|
||||
|
||||
### 请求参数
|
||||
**Headers**
|
||||
|
||||
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|
||||
| ------------ | ------------ | ------------ | ------------ | ------------ |
|
||||
| Content-Type | application/json | 是 | | |
|
||||
**Body**
|
||||
|
||||
<table>
|
||||
<thead class="ant-table-thead">
|
||||
<tr>
|
||||
<th key=name>名称</th><th key=type>类型</th><th key=required>是否必须</th><th key=default>默认值</th><th key=desc>备注</th><th key=sub>其他信息</th>
|
||||
</tr>
|
||||
</thead><tbody className="ant-table-tbody"><tr key=00><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> id</span></td><td key=1><span>integer</span></td><td key=2>必须</td><td key=3></td><td key=4><span>The unique identifier for a product</span></td><td key=5></td></tr><tr key=01><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> name</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span>Name of the product</span></td><td key=5></td></tr><tr key=02><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> price</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span></span></td><td key=5><p key=1><span style="font-weight: '700'">最小值: </span><span>0</span></p></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### 返回数据
|
||||
|
||||
```javascript
|
||||
|
||||
/**
|
||||
* 这是一个 response 事例
|
||||
*/
|
||||
{
|
||||
"errcode": 0, //错误编码
|
||||
"data": {
|
||||
"id": "uuid-xxx", //产品id
|
||||
"name": "iphone" //产品名称
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
# ee
|
||||
[TOC]
|
||||
|
||||
|
||||
## /credit-gateway%0A%3Ca%20id%3D/credit-gateway%3E%20%3C/a%3E
|
||||
[TOC]
|
||||
|
||||
### 基本信息
|
||||
|
||||
**Path:** /credit-gateway
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**接口描述:**
|
||||
|
||||
|
||||
### 请求参数
|
||||
|
||||
### 返回数据
|
||||
|
||||
```javascript
|
||||
/**
|
||||
* demo
|
||||
*/
|
||||
|
||||
{
|
||||
"errcode": 0, //code,
|
||||
"data": {
|
||||
"uid": "" //user uid
|
||||
}
|
||||
}
|
||||
```
|
||||
## 12%0A%3Ca%20id%3D12%3E%20%3C/a%3E
|
||||
[TOC]
|
||||
|
||||
### 基本信息
|
||||
|
||||
**Path:** /api/12/:id/{name}
|
||||
|
||||
**Method:** POST
|
||||
|
||||
**接口描述:**
|
||||
<p><br></p>
|
||||
|
||||
### 请求参数
|
||||
**Headers**
|
||||
|
||||
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|
||||
| ------------ | ------------ | ------------ | ------------ | ------------ |
|
||||
| Content-Type | application/x-www-form-urlencoded | 是 | | |
|
||||
| aaaa | | 是 | | |
|
||||
**路径参数**
|
||||
| 参数名称 | 示例 | 备注 |
|
||||
| ------------ | ------------ | ------------ | ------------ | ------------ |
|
||||
| id | | |
|
||||
| name | | |
|
||||
**Query**
|
||||
|
||||
| 参数名称 | 是否必须 | 示例 | 备注 |
|
||||
| ------------ | ------------ | ------------ | ------------ |
|
||||
| token | 是 | 2 | |
|
||||
| project_id | 是 | 1 | |
|
||||
**Body**
|
||||
|
||||
| 参数名称 | 参数类型 | 是否必须 | 示例 | 备注 |
|
||||
| ------------ | ------------ | ------------ | ------------ | ------------ |
|
||||
| 12 | text | 是 | | |
|
||||
|
||||
|
||||
|
||||
### 返回数据
|
||||
|
||||
```javascript
|
||||
{
|
||||
"errcode": 0,
|
||||
"data": {
|
||||
"list": []
|
||||
}
|
||||
}
|
||||
```
|
||||
## 14%0A%3Ca%20id%3D14%3E%20%3C/a%3E
|
||||
[TOC]
|
||||
|
||||
### 基本信息
|
||||
|
||||
**Path:** /api/14
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**接口描述:**
|
||||
undefined
|
||||
|
||||
### 请求参数
|
||||
|
||||
### 返回数据
|
||||
|
||||
```javascript
|
||||
{"errcode": 0, "data": { "list": [] }}
|
||||
```
|
||||
## 15%0A%3Ca%20id%3D15%3E%20%3C/a%3E
|
||||
[TOC]
|
||||
|
||||
### 基本信息
|
||||
|
||||
**Path:** /api/15
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**接口描述:**
|
||||
<p><br></p>
|
||||
|
||||
### 请求参数
|
||||
|
||||
### 返回数据
|
||||
|
||||
```javascript
|
||||
/** * demo */
|
||||
{ "errcode": 0, //code
|
||||
"data": { "uid": "" //user uid
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
## 17%0A%3Ca%20id%3D17%3E%20%3C/a%3E
|
||||
[TOC]
|
||||
|
||||
### 基本信息
|
||||
|
||||
**Path:** /api/17
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**接口描述:**
|
||||
undefined
|
||||
|
||||
### 请求参数
|
||||
|
||||
### 返回数据
|
||||
|
||||
```javascript
|
||||
{ "errcode": 0, "data": { "uid": "" }}
|
||||
```
|
||||
## 55%0A%3Ca%20id%3D55%3E%20%3C/a%3E
|
||||
[TOC]
|
||||
|
||||
### 基本信息
|
||||
|
||||
**Path:** /55
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**接口描述:**
|
||||
undefined
|
||||
|
||||
### 请求参数
|
||||
|
||||
### 返回数据
|
||||
|
||||
```javascript
|
||||
|
||||
/**
|
||||
* 这是一个 response 事例
|
||||
*/
|
||||
{
|
||||
"errcode": 0, //错误编码
|
||||
"data": {
|
||||
"id": "uuid-xxx", //产品id
|
||||
"name": "iphone", //产品名称
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
# tag
|
||||
[TOC]
|
||||
|
||||
|
||||
## %28tag%29%u6839%u636E%u89C4%u5219%u641C%u7D22%u4EA7%u54C1%0A%3Ca%20id%3D%28tag%29%u6839%u636E%u89C4%u5219%u641C%u7D22%u4EA7%u54C1%3E%20%3C/a%3E
|
||||
[TOC]
|
||||
|
||||
### 基本信息
|
||||
|
||||
**Path:** /tag/get_product_by_tag_rule
|
||||
|
||||
**Method:** POST
|
||||
|
||||
**接口描述:**
|
||||
(tag)根据规则搜索产品
|
||||
|
||||
### 请求参数
|
||||
**Headers**
|
||||
|
||||
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|
||||
| ------------ | ------------ | ------------ | ------------ | ------------ |
|
||||
| SiteUID | | 是 | | |
|
||||
| ClientId | | 是 | | |
|
||||
| Token | | 否 | | 请求令牌 |
|
||||
**Body**
|
||||
|
||||
```javascript
|
||||
{
|
||||
"tag_rule_arr": [
|
||||
{
|
||||
"tag_rule_detial_arr": [
|
||||
{
|
||||
"id": "@integer",
|
||||
"rule_dimension": "@string",
|
||||
"value": "@string",
|
||||
"tag_rule_id": "@integer",
|
||||
"type": "@integer"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
### 返回数据
|
||||
|
||||
```javascript
|
||||
{
|
||||
"code": "@string",
|
||||
"info": {
|
||||
"data": {
|
||||
"product_info": {
|
||||
"product_code": "@string",
|
||||
"sku": "@string",
|
||||
"sku_history": "@string",
|
||||
"is_free": "@integer",
|
||||
"sequence": "@string",
|
||||
"color": "@string",
|
||||
"is_design": "@integer",
|
||||
"weight": "@integer",
|
||||
"insert_time": "@string"
|
||||
},
|
||||
"product_image": {
|
||||
"id": "@string",
|
||||
"image_url": "@string",
|
||||
"image_title": "@string",
|
||||
"sort": "@string",
|
||||
"image_type": "@string",
|
||||
"image_links": {
|
||||
"image_medium_url": "@string",
|
||||
"image_small_url": "@string",
|
||||
"image_url": "@string"
|
||||
}
|
||||
},
|
||||
"product_category": {
|
||||
"id": "@integer",
|
||||
"name": "@string",
|
||||
"parent_id": "@integer",
|
||||
"product_type_id": "@integer",
|
||||
"is_return": "@integer",
|
||||
"is_allow_sub_category": "@integer",
|
||||
"is_available": "@integer",
|
||||
"insert_time": "@string",
|
||||
"is_del": "@integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"msg": "@string"
|
||||
}
|
||||
```
|
||||
## 3333%0A%3Ca%20id%3D3333%3E%20%3C/a%3E
|
||||
[TOC]
|
||||
|
||||
### 基本信息
|
||||
|
||||
**Path:** /app/code
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**接口描述:**
|
||||
|
||||
|
||||
### 请求参数
|
||||
|
||||
## %u67E5%u8BE2%u4FE1%u7528%u8D26%u6237%u8BE6%u60C5%u63A5%u53E3%0A%3Ca%20id%3D%u67E5%u8BE2%u4FE1%u7528%u8D26%u6237%u8BE6%u60C5%u63A5%u53E3%3E%20%3C/a%3E
|
||||
[TOC]
|
||||
|
||||
### 基本信息
|
||||
|
||||
**Path:** /credit-gateway/v0/customer/{id}
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**接口描述:**
|
||||
undefined
|
||||
|
||||
### 请求参数
|
||||
**路径参数**
|
||||
| 参数名称 | 示例 | 备注 |
|
||||
| ------------ | ------------ | ------------ | ------------ | ------------ |
|
||||
| id | | 客户唯一ID |
|
||||
**Query**
|
||||
|
||||
| 参数名称 | 是否必须 | 示例 | 备注 |
|
||||
| ------------ | ------------ | ------------ | ------------ |
|
||||
| userId | 否 | | 资方客户ID或其他关联模块ID |
|
||||
| productId | 否 | | 信贷产品ID |
|
||||
|
||||
### 返回数据
|
||||
|
||||
```javascript
|
||||
{
|
||||
"customerWithDetail": {
|
||||
"createTime": "@string",
|
||||
"updateTime": "@string",
|
||||
"applyId": "@string",
|
||||
"areaId": "@string",
|
||||
"areaName": "@string",
|
||||
"channelId": "@string",
|
||||
"cityId": "@string",
|
||||
"cityName": "@string",
|
||||
"creditAmount": "@string",
|
||||
"id": "@string",
|
||||
"orgCode": "@string",
|
||||
"orgName": "@string",
|
||||
"productId": "@string",
|
||||
"remainAmount": "@string",
|
||||
"status": "WAIT_SIGN",
|
||||
"type": "ENTERPRISE",
|
||||
"userId": "@integer",
|
||||
"activateTime": "@string",
|
||||
"customerId": "@string",
|
||||
"endTime": "@string",
|
||||
"repayAccount": "@string",
|
||||
"repayName": "@string",
|
||||
"startTime": "@string"
|
||||
}
|
||||
}
|
||||
```
|
||||
# %u545C%u545C%u545C
|
||||
[TOC]
|
||||
|
||||
|
||||
## rrr%0A%3Ca%20id%3Drrr%3E%20%3C/a%3E
|
||||
[TOC]
|
||||
|
||||
### 基本信息
|
||||
|
||||
**Path:** /tag/get_product_by_tag_rule
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**接口描述:**
|
||||
undefined
|
||||
|
||||
### 请求参数
|
||||
|
||||
## rrr_copy%0A%3Ca%20id%3Drrr_copy%3E%20%3C/a%3E
|
||||
[TOC]
|
||||
|
||||
### 基本信息
|
||||
|
||||
**Path:** /tag/get_product_by_tag_rule_1519617779388
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**接口描述:**
|
||||
undefined
|
||||
|
||||
### 请求参数
|
@ -22,6 +22,11 @@
|
||||
.interface-edit-item-content-col{
|
||||
padding:0 1px;
|
||||
}
|
||||
.interface-edit-item-content-col-drag{
|
||||
width:24px;
|
||||
padding: 7px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.interface-edit-del-icon{
|
||||
margin-top: 10px;
|
||||
|
@ -541,10 +541,13 @@ class InterfaceEditForm extends Component {
|
||||
const queryTpl = (data, index) => {
|
||||
return (
|
||||
<Row key={index} className="interface-edit-item-content">
|
||||
<Col span="5" className="interface-edit-item-content-col">
|
||||
<Col span="1" className="interface-edit-item-content-col interface-edit-item-content-col-drag" >
|
||||
<Icon type="bars" />
|
||||
</Col>
|
||||
<Col span="4" className="interface-edit-item-content-col">
|
||||
{getFieldDecorator("req_query[" + index + "].name", {
|
||||
initialValue: data.name
|
||||
})(<Input placeholder="参数名称" />)}
|
||||
})(<TextArea autosize={{minRows:1, maxRows: 1}} placeholder="参数名称" />)}
|
||||
</Col>
|
||||
<Col span="3" className="interface-edit-item-content-col">
|
||||
{getFieldDecorator("req_query[" + index + "].required", {
|
||||
@ -580,6 +583,9 @@ class InterfaceEditForm extends Component {
|
||||
const headerTpl = (data, index) => {
|
||||
return (
|
||||
<Row key={index} className="interface-edit-item-content">
|
||||
<Col span="1" className="interface-edit-item-content-col interface-edit-item-content-col-drag" >
|
||||
<Icon type="bars" />
|
||||
</Col>
|
||||
<Col span="4" className="interface-edit-item-content-col">
|
||||
{getFieldDecorator("req_headers[" + index + "].name", {
|
||||
initialValue: data.name
|
||||
@ -595,10 +601,10 @@ class InterfaceEditForm extends Component {
|
||||
/>
|
||||
)}
|
||||
</Col>
|
||||
<Col span="6" className="interface-edit-item-content-col">
|
||||
<Col span="5" className="interface-edit-item-content-col">
|
||||
{getFieldDecorator("req_headers[" + index + "].value", {
|
||||
initialValue: data.value
|
||||
})(<Input placeholder="参数值" />)}
|
||||
})(<TextArea autosize={{minRows:1, maxRows: 1}} placeholder="参数值" />)}
|
||||
</Col>
|
||||
<Col span="5" className="interface-edit-item-content-col">
|
||||
{getFieldDecorator("req_headers[" + index + "].example", {
|
||||
@ -624,10 +630,13 @@ class InterfaceEditForm extends Component {
|
||||
const requestBodyTpl = (data, index) => {
|
||||
return (
|
||||
<Row key={index} className="interface-edit-item-content">
|
||||
<Col span="1" className="interface-edit-item-content-col interface-edit-item-content-col-drag" >
|
||||
<Icon type="bars" />
|
||||
</Col>
|
||||
<Col span="4" className="interface-edit-item-content-col">
|
||||
{getFieldDecorator("req_body_form[" + index + "].name", {
|
||||
initialValue: data.name
|
||||
})(<Input placeholder="name" />)}
|
||||
})(<TextArea autosize={{minRows:1, maxRows: 1}} placeholder="name" />)}
|
||||
</Col>
|
||||
<Col span="3" className="interface-edit-item-content-col">
|
||||
{getFieldDecorator("req_body_form[" + index + "].type", {
|
||||
@ -654,7 +663,7 @@ class InterfaceEditForm extends Component {
|
||||
initialValue: data.example
|
||||
})(<TextArea autosize={true} placeholder="参数示例" />)}
|
||||
</Col>
|
||||
<Col span="8" className="interface-edit-item-content-col">
|
||||
<Col span="7" className="interface-edit-item-content-col">
|
||||
{getFieldDecorator("req_body_form[" + index + "].desc", {
|
||||
initialValue: data.desc
|
||||
})(<TextArea autosize={true} placeholder="备注" />)}
|
||||
|
@ -13,17 +13,11 @@ proxy_set_header Connection "upgrade";
|
||||
* nodejs(7.6+)
|
||||
* mongodb(2.6+)
|
||||
|
||||
示例:
|
||||
|
||||
[mac 环境配置](https://github.com/suxiaoxin/yapi_user_guide/blob/master/mac%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.md)
|
||||
|
||||
|
||||
[centos环境配置](https://github.com/suxiaoxin/yapi_user_guide/blob/master/centos%20%E5%AE%89%E8%A3%85%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.md)
|
||||
|
||||
## 安装
|
||||
### 方式一. 可视化部署[推荐]
|
||||
执行 yapi server 启动可视化部署程序,输入相应的配置和点击开始部署,就能完成整个网站的部署。部署完成之后,可按照提示信息,执行 node/{网站路径/server/app.js} 启动服务器。在浏览器打开指定url, 点击登录输入您刚才设置的管理员邮箱,默认密码(ymfe.org) 登录系统(默认密码可在个人中心修改)。
|
||||
```
|
||||
```bash
|
||||
npm install -g yapi-cli --registry https://registry.npm.taobao.org
|
||||
yapi server
|
||||
```
|
||||
@ -31,7 +25,7 @@ yapi server
|
||||
|
||||
如果 github 压缩文件无法下载,或需要部署到一些特殊的服务器,可尝试此方法
|
||||
|
||||
```
|
||||
```bash
|
||||
mkdir yapi
|
||||
cd yapi
|
||||
git clone https://github.com/YMFE/yapi.git vendors //或者下载 zip 包解压到 vendors 目录
|
||||
@ -42,7 +36,35 @@ npm run install-server //安装程序会初始化数据库索引和管理员账
|
||||
node server/app.js //启动服务器后,请访问 127.0.0.1:{config.json配置的端口},初次运行会有个编译的过程,请耐心等候
|
||||
```
|
||||
|
||||
可以参考插件Wiki里面的<a href="./plugin.html">二次开发文档</a>
|
||||
安装后的目录结构如下:
|
||||
|
||||
```
|
||||
|-- config.json
|
||||
|-- init.lock
|
||||
|-- log
|
||||
`-- vendors
|
||||
|-- CHANGELOG.md
|
||||
|-- LICENSE
|
||||
|-- README.md
|
||||
|-- client
|
||||
|-- common
|
||||
|-- config_example.json
|
||||
|-- doc
|
||||
|-- exts
|
||||
|-- nodemon.json
|
||||
|-- npm-debug.log
|
||||
|-- package.json
|
||||
|-- plugin.json
|
||||
|-- server
|
||||
|-- static
|
||||
|-- test
|
||||
|-- webpack.alias.js
|
||||
|-- yapi-base-flow.jpg
|
||||
|-- ydocfile.js
|
||||
`-- ykit.config.js
|
||||
```
|
||||
|
||||
> 注:可以参考插件Wiki里面的<a href="./plugin.html">二次开发文档</a>
|
||||
|
||||
|
||||
## 服务器管理
|
||||
|
@ -70,7 +70,6 @@ npm run dev
|
||||
|-- config.json
|
||||
|-- init.lock
|
||||
|-- log
|
||||
| `-- 2018-1.log
|
||||
`-- vendors
|
||||
|-- CHANGELOG.md
|
||||
|-- LICENSE
|
||||
|
@ -11,13 +11,13 @@
|
||||
|
||||
### 基本设置
|
||||
|
||||
- 接口路径:可以更改 HTTP 请求方式,并且支持 restful 动态路由,例如 /api/:id/{name}, id和name是动态参数
|
||||
- 接口路径:可以更改 HTTP 请求方式,并且支持 restful 动态路由,例如 /api/{id}/{name}, id和name是动态参数
|
||||
- 选择分类:可以更改接口所在分类
|
||||
- 状态:用于标识接口是否开发完成。
|
||||
|
||||
<img src="./images/baseSet.png" />
|
||||
|
||||
### Request 设置
|
||||
### 请求参数设置
|
||||
|
||||
- Query参数: 接口 url 的查询字符串,点击『添加Query参数』按钮来添加参数,可以通过拖动来交换参数位置
|
||||
- 请求Body:http 请求 body 部分,如果http请求方式是 post, put 等请求方式时会有 req_body 部分。req_body_type 形式有4种,分别是 form, json, file 和 raw 。
|
||||
@ -25,9 +25,9 @@
|
||||
|
||||
<img src="./images/requestSet.png" />
|
||||
|
||||
### Response 设置
|
||||
### 返回数据设置
|
||||
|
||||
- 响应 Body: 模拟返回结果, 分为 `json` & `raw` 两种形式。基于 mockjs (具体使用方法详见<a href="./mock.html">Mock 介绍</a>)和 json5,使用注释方式写参数说明。 为了方便数据编写可以按F9来使用全局编辑
|
||||
- 返回数据分为 `json` & `raw` 两种形式。基于 mockjs (具体使用方法详见<a href="./mock.html">Mock 介绍</a>)和 json5,使用注释方式写参数说明。 为了方便数据编写可以按F9来使用全局编辑
|
||||
|
||||
|
||||
### 备注 & 其他
|
||||
|
@ -5720,7 +5720,7 @@
|
||||
|
||||
<p>
|
||||
<small class="text-muted">源码位置:</small>
|
||||
<a href="./static/server/controllers/interfaceCol.js.html#572" target="_blank">./server/controllers/interfaceCol.js:572</a>
|
||||
<a href="./static/server/controllers/interfaceCol.js.html#574" target="_blank">./server/controllers/interfaceCol.js:574</a>
|
||||
</p>
|
||||
|
||||
|
||||
@ -5794,7 +5794,7 @@
|
||||
|
||||
<p>
|
||||
<small class="text-muted">源码位置:</small>
|
||||
<a href="./static/server/controllers/interfaceCol.js.html#616" target="_blank">./server/controllers/interfaceCol.js:616</a>
|
||||
<a href="./static/server/controllers/interfaceCol.js.html#618" target="_blank">./server/controllers/interfaceCol.js:618</a>
|
||||
</p>
|
||||
|
||||
|
||||
@ -5854,7 +5854,7 @@
|
||||
|
||||
<p>
|
||||
<small class="text-muted">源码位置:</small>
|
||||
<a href="./static/server/controllers/interfaceCol.js.html#649" target="_blank">./server/controllers/interfaceCol.js:649</a>
|
||||
<a href="./static/server/controllers/interfaceCol.js.html#651" target="_blank">./server/controllers/interfaceCol.js:651</a>
|
||||
</p>
|
||||
|
||||
|
||||
@ -5914,7 +5914,7 @@
|
||||
|
||||
<p>
|
||||
<small class="text-muted">源码位置:</small>
|
||||
<a href="./static/server/controllers/interfaceCol.js.html#682" target="_blank">./server/controllers/interfaceCol.js:682</a>
|
||||
<a href="./static/server/controllers/interfaceCol.js.html#684" target="_blank">./server/controllers/interfaceCol.js:684</a>
|
||||
</p>
|
||||
|
||||
|
||||
|
@ -164,22 +164,47 @@ proxy_set_header Upgrade $http_upgrade<span class="token punctuation">;</span>
|
||||
proxy_set_header Connection <span class="token string">"upgrade"</span><span class="token punctuation">;</span>
|
||||
</code></pre><h2 class="subject" id="环境要求">环境要求 <a class="hashlink" href="#环境要求">#</a></h2><ul>
|
||||
<li>nodejs(7.6+)</li><li>mongodb(2.6+)</li></ul>
|
||||
<p>示例:</p>
|
||||
<p><a href="https://github.com/suxiaoxin/yapi_user_guide/blob/master/mac%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.md">mac 环境配置</a></p>
|
||||
<p><a href="https://github.com/suxiaoxin/yapi_user_guide/blob/master/centos%20%E5%AE%89%E8%A3%85%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE.md">centos环境配置</a></p>
|
||||
<h2 class="subject" id="安装">安装 <a class="hashlink" href="#安装">#</a></h2><h3 class="subject" id="方式一._可视化部署[推荐]">方式一. 可视化部署[推荐] <a class="hashlink" href="#方式一._可视化部署[推荐]">#</a></h3><p>执行 yapi server 启动可视化部署程序,输入相应的配置和点击开始部署,就能完成整个网站的部署。部署完成之后,可按照提示信息,执行 node/{网站路径/server/app.js} 启动服务器。在浏览器打开指定url, 点击登录输入您刚才设置的管理员邮箱,默认密码(ymfe.org) 登录系统(默认密码可在个人中心修改)。</p>
|
||||
<pre><code>npm install -g yapi-cli --registry https<span class="token operator">:</span>//registry.npm.taobao.org
|
||||
<pre><code class="lang-bash"><span class="token function">npm</span> <span class="token function">install</span> -g yapi-cli --registry https://registry.npm.taobao.org
|
||||
yapi server
|
||||
</code></pre><h3 class="subject" id="方式二._命令行部署">方式二. 命令行部署 <a class="hashlink" href="#方式二._命令行部署">#</a></h3><p>如果 github 压缩文件无法下载,或需要部署到一些特殊的服务器,可尝试此方法</p>
|
||||
<pre><code>mkdir yapi
|
||||
cd yapi
|
||||
git clone https<span class="token operator">:</span>//github.com/YMFE/yapi.git vendors //或者下载 zip 包解压到 vendors 目录
|
||||
cp vendors/config_example.json ./config.json //复制完成后请修改相关配置
|
||||
cd vendors
|
||||
npm install --production --registry https<span class="token operator">:</span>//registry.npm.taobao.org
|
||||
npm run install-server //安装程序会初始化数据库索引和管理员账号,管理员账号名可在 config.json 配置
|
||||
node server/app.js //启动服务器后,请访问 <span class="token number">127.0</span>.<span class="token number">0.1</span><span class="token operator">:</span><span class="token punctuation">{</span>config.json配置的端口<span class="token punctuation">}</span>,初次运行会有个编译的过程,请耐心等候
|
||||
</code></pre><p>可以参考插件Wiki里面的<a href="./plugin.html">二次开发文档</a></p>
|
||||
</code></pre>
|
||||
<h3 class="subject" id="方式二._命令行部署">方式二. 命令行部署 <a class="hashlink" href="#方式二._命令行部署">#</a></h3><p>如果 github 压缩文件无法下载,或需要部署到一些特殊的服务器,可尝试此方法</p>
|
||||
<pre><code class="lang-bash"><span class="token function">mkdir</span> yapi
|
||||
<span class="token function">cd</span> yapi
|
||||
<span class="token function">git</span> clone https://github.com/YMFE/yapi.git vendors //或者下载 <span class="token function">zip</span> 包解压到 vendors 目录
|
||||
<span class="token function">cp</span> vendors/config_example.json ./config.json //复制完成后请修改相关配置
|
||||
<span class="token function">cd</span> vendors
|
||||
<span class="token function">npm</span> <span class="token function">install</span> --production --registry https://registry.npm.taobao.org
|
||||
<span class="token function">npm</span> run install-server //安装程序会初始化数据库索引和管理员账号,管理员账号名可在 config.json 配置
|
||||
node server/app.js //启动服务器后,请访问 127.0.0.1:<span class="token punctuation">{</span>config.json配置的端口<span class="token punctuation">}</span>,初次运行会有个编译的过程,请耐心等候
|
||||
</code></pre>
|
||||
<p>安装后的目录结构如下:</p>
|
||||
<pre><code>|-- config.json
|
||||
|-- init.lock
|
||||
|-- log
|
||||
`-- vendors
|
||||
|-- CHANGELOG.md
|
||||
|-- LICENSE
|
||||
|-- README.md
|
||||
|-- client
|
||||
|-- common
|
||||
|-- config_example.json
|
||||
|-- doc
|
||||
|-- exts
|
||||
|-- nodemon.json
|
||||
|-- npm-debug.log
|
||||
|-- package.json
|
||||
|-- plugin.json
|
||||
|-- server
|
||||
|-- static
|
||||
|-- test
|
||||
|-- webpack.alias.js
|
||||
|-- yapi-base-flow.jpg
|
||||
|-- ydocfile.js
|
||||
`-- ykit.config.js
|
||||
</code></pre><blockquote>
|
||||
<p>注:可以参考插件Wiki里面的<a href="./plugin.html">二次开发文档</a></p>
|
||||
</blockquote>
|
||||
<h2 class="subject" id="服务器管理">服务器管理 <a class="hashlink" href="#服务器管理">#</a></h2><p>推荐使用 pm2 管理 node 服务器启动,停止,具体使用方法可参考下面的教程:</p>
|
||||
<ul>
|
||||
<li><a href="http://pm2.keymetrics.io/docs/usage/quick-start/">官网文档</a></li><li><a href="http://imweb.io/topic/57c8cbb27f226f687b365636">PM2实用入门指南</a> </li></ul>
|
||||
|
@ -100,7 +100,7 @@
|
||||
|
||||
|
||||
|
||||
<a class="ydoc-banner-button home-btn" href="./usage.html">开始</a>
|
||||
<a class="ydoc-banner-button home-btn" href="http://yapi.demo.qunar.com">产品演示</a>
|
||||
|
||||
<a class="ydoc-banner-button home-btn" href="https://github.com/YMFE/yapi">Github</a>
|
||||
|
||||
|
@ -180,13 +180,13 @@
|
||||
<h2 class="subject" id="接口配置">接口配置 <a class="hashlink" href="#接口配置">#</a></h2><p><a href="./quickstart.html#新建接口">新建接口</a> 后,点击新添加的接口,右侧可以看到接口的预览信息,点击右侧的 <code>编辑</code> Tab项进入编辑面板。</p>
|
||||
<p>在该面板中你可以看到接口的基本信息(接口名称、分类、路径),除此以外,你还可以完善以下接口信息:</p>
|
||||
<h3 class="subject" id="基本设置">基本设置 <a class="hashlink" href="#基本设置">#</a></h3><ul>
|
||||
<li>接口路径:可以更改 HTTP 请求方式,并且支持 restful 动态路由,例如 /api/:id/{name}, id和name是动态参数</li><li>选择分类:可以更改接口所在分类</li><li>状态:用于标识接口是否开发完成。</li></ul>
|
||||
<li>接口路径:可以更改 HTTP 请求方式,并且支持 restful 动态路由,例如 /api/{id}/{name}, id和name是动态参数</li><li>选择分类:可以更改接口所在分类</li><li>状态:用于标识接口是否开发完成。</li></ul>
|
||||
<p><img src="./images/baseSet.png" /></p>
|
||||
<h3 class="subject" id="Request_设置">Request 设置 <a class="hashlink" href="#Request_设置">#</a></h3><ul>
|
||||
<h3 class="subject" id="请求参数设置">请求参数设置 <a class="hashlink" href="#请求参数设置">#</a></h3><ul>
|
||||
<li>Query参数: 接口 url 的查询字符串,点击『添加Query参数』按钮来添加参数,可以通过拖动来交换参数位置</li><li>请求Body:http 请求 body 部分,如果http请求方式是 post, put 等请求方式时会有 req_body 部分。req_body_type 形式有4种,分别是 form, json, file 和 raw 。</li><li>Headers: http 请求头字段,在 req_body 形式是 form 格式下会在 header 中自动生成 'Content-Type application/x-www-form-urlencoded',其他3种格式也会自动生成不同 header</li></ul>
|
||||
<p><img src="./images/requestSet.png" /></p>
|
||||
<h3 class="subject" id="Response_设置">Response 设置 <a class="hashlink" href="#Response_设置">#</a></h3><ul>
|
||||
<li>响应 Body: 模拟返回结果, 分为 <code>json</code> & <code>raw</code> 两种形式。基于 mockjs (具体使用方法详见<a href="./mock.html">Mock 介绍</a>)和 json5,使用注释方式写参数说明。 为了方便数据编写可以按F9来使用全局编辑</li></ul>
|
||||
<h3 class="subject" id="返回数据设置">返回数据设置 <a class="hashlink" href="#返回数据设置">#</a></h3><ul>
|
||||
<li>返回数据分为 <code>json</code> & <code>raw</code> 两种形式。基于 mockjs (具体使用方法详见<a href="./mock.html">Mock 介绍</a>)和 json5,使用注释方式写参数说明。 为了方便数据编写可以按F9来使用全局编辑</li></ul>
|
||||
<h3 class="subject" id="备注_&_其他">备注 & 其他 <a class="hashlink" href="#备注_&_其他">#</a></h3><ul>
|
||||
<li>接口描述: 用简短的文字描述接口的作用。</li><li>邮件通知:开启后将此次接口的改动以邮件的形式发送至项目组所有成员和关注该项目的成员(邮件默认情况下自动开启)</li><li>开放接口:默认为关闭状态,用户可以在 数据导出 时选择只导出公开接口</li></ul>
|
||||
<h2 class="subject" id="接口运行">接口运行 <a class="hashlink" href="#接口运行">#</a></h2><p>接口运行功能,是用来测试真实接口的,类似『Postman』的功能。</p>
|
||||
|
@ -190,7 +190,6 @@
|
||||
<pre><code>|-- config.json
|
||||
|-- init.lock
|
||||
|-- log
|
||||
| `-- <span class="token number">2018</span>-<span class="token number">1</span>.log
|
||||
`-- vendors
|
||||
|-- CHANGELOG.md
|
||||
|-- LICENSE
|
||||
|
@ -210,7 +210,6 @@
|
||||
<pre><code>|-- config.json
|
||||
|-- init.lock
|
||||
|-- log
|
||||
| `-- <span class="token number">2018</span>-<span class="token number">1</span>.log
|
||||
`-- vendors
|
||||
|-- CHANGELOG.md
|
||||
|-- LICENSE
|
||||
|
@ -191,7 +191,7 @@
|
||||
<div class="content-right markdown-body use-sidebar" role="main">
|
||||
|
||||
<h3 class="subject" id="v1.3.7">v1.3.7 <a class="hashlink" href="#v1.3.7">#</a></h3><h4 class="subject" id="Feature">Feature <a class="hashlink" href="#Feature">#</a></h4><ul>
|
||||
<li>增加测试集合列表的拖动功能</li><li>interfaceList页实现数据分页</li><li>新建接口的时候产生一个demo response</li><li>接口列表中增加“开放接口”状态</li><li>接口列表树形组件支持拖动</li></ul>
|
||||
<li>增加测试集合列表的拖动功能</li><li>interfaceList页实现数据分页</li><li>新建接口的时候产生一个demo response</li><li>接口列表中增加“开放接口”状态</li><li>接口列表树形组件支持拖动</li><li>json-schema 导出 table表单</li></ul>
|
||||
<h4 class="subject" id="Bug_Fixed">Bug Fixed <a class="hashlink" href="#Bug_Fixed">#</a></h4><ul>
|
||||
<li>将部分数据拷贝变成使用immer</li><li>修复测试集合table拖动频繁请求的问题</li></ul>
|
||||
<h3 class="subject" id="v1.3.6">v1.3.6 <a class="hashlink" href="#v1.3.6">#</a></h3><h4 class="subject" id="Feature">Feature <a class="hashlink" href="#Feature">#</a></h4><ul>
|
||||
|
@ -1041,7 +1041,13 @@ class interfaceController extends baseController {
|
||||
|
||||
async schema2json(ctx){
|
||||
let schema = ctx.request.body.schema;
|
||||
ctx.body = jsf(schema)
|
||||
let required = ctx.request.body.required;
|
||||
jsf.option({
|
||||
alwaysFakeOptionals: required ? true : false
|
||||
})
|
||||
let res = jsf(schema)
|
||||
return ctx.body = res;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -578,6 +578,7 @@ class interfaceColController extends baseController {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '找不到对应的接口,请联系管理员')
|
||||
}
|
||||
data = data.toObject();
|
||||
|
||||
let projectData = await this.projectModel.getBaseInfo(data.project_id);
|
||||
result.path = projectData.basepath + data.path;
|
||||
result.method = data.method;
|
||||
@ -589,6 +590,7 @@ class interfaceColController extends baseController {
|
||||
result.req_query = yapi.commons.handleParamsValue(data.req_query, result.req_query)
|
||||
result.req_params = yapi.commons.handleParamsValue(data.req_params, result.req_params)
|
||||
result.interface_up_time = data.up_time;
|
||||
result.req_body_is_json_schema = data.req_body_is_json_schema;
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
} catch (e) {
|
||||
ctx.body = yapi.commons.resReturn(null, 400, e.message)
|
||||
|
@ -26,8 +26,8 @@ module.exports = {
|
||||
"homepage": { // 配置首页,样式区别于其他页面
|
||||
"version": "v" + require('./package.json').version, // 版本信息将显示在banner底部
|
||||
"button": [{ // 按钮组将显示在banner底部
|
||||
"name": "开始",
|
||||
"href": "./usage.html"
|
||||
"name": "产品演示",
|
||||
"href": "http://yapi.demo.qunar.com"
|
||||
},{
|
||||
"name": "Github",
|
||||
"href": "https://github.com/YMFE/yapi"
|
||||
|
Loading…
Reference in New Issue
Block a user