Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: swagger导入重复接口对比url错误 #901

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/service/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -782,11 +782,13 @@ export default class MigrateService {
// 处理完每个接口请求参数后,如果-遇到第一个存在接口不符合规范就全部返回
if (checkSwaggerResult.length > 0) break

const realUrl = `${host ? `https://${host}` : ''}${url.replace('-test', '')}`

// 判断对应模块是否存在该接口
const index = repository.modules.findIndex(item => {
return (
item.id === mod.id &&
item.interfaces.findIndex(it => (it.url || '') === url) >= 0
item.interfaces.findIndex(it => (it.url || '') === realUrl) >= 0
) // 已经存在接口
})

Expand All @@ -796,7 +798,7 @@ export default class MigrateService {
moduleId: mod.id,
name: `${apiObj.summary}`,
description: apiObj.description,
url: `${host ? `https://${host}` : ''}${url.replace('-test', '')}`,
url: realUrl,
priority: iCounter++,
creatorId: curUserId,
repositoryId: repositoryId,
Expand All @@ -819,7 +821,7 @@ export default class MigrateService {
moduleId: mod.id,
name: `${apiObj.summary}`,
description: apiObj.description,
url: `${host ? `https://${host}` : ''}${url.replace('-test', '')}`,
url: realUrl,
repositoryId: repositoryId,
method: method.toUpperCase(),
},
Expand Down