Skip to content

Commit e4f5fc9

Browse files
committed
fix:
1 parent 3bd1660 commit e4f5fc9

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

command/restful.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const restful = async ({ app, filePath, config }) => {
1010
checkFileExist(filePath, true)
1111
const apiList = getAllAPIPath(filePath);
1212
// 获取本地所有的path,生成本地代理
13+
// TODO: 无法匹配路由变量参数
1314
app.all(apiList, async (req, res) => {
1415
const url = req.path;
1516
checkFileExistsAndRespond(url, filePath, req, res);

command/swaggerRestful.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const resolveRef = (ref, openAPIDoc) => {
2020

2121
// 生成 Mock 值的示例函数
2222
const generateMockValue = (schema, openAPIDoc) => {
23+
if (!schema) return null;
2324
if (schema.$ref) {
2425
// 解析 $ref 并递归处理
2526
const resolvedSchema = resolveRef(schema.$ref, openAPIDoc);
@@ -50,7 +51,6 @@ const generateMockValue = (schema, openAPIDoc) => {
5051
// 生成 Mock 数据
5152
const generateMockData = (api) => {
5253
const mockData = {};
53-
5454
for (const [path, methods] of Object.entries(api.paths)) {
5555
if (!mockData[path]) {
5656
mockData[path] = {}; // 为每个路径初始化一个空对象来存储不同的方法

0 commit comments

Comments
 (0)