Skip to content

Commit 3fd1bb3

Browse files
committed
fix: temporarily disable the path rename classification fix for migration results analysis
1 parent 2a3dfe2 commit 3fd1bb3

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/openapi/openapi3.classify.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { getKeyValue, isExist, isNotEmptyArray } from '../utils'
1414
import { emptySecurity, includeSecurity } from './openapi3.utils'
1515
import type { ClassifyRule, CompareContext } from '../types'
1616
import { DiffType } from '../types'
17-
import { createPathUnifier } from './openapi3.mapping'
17+
import { hidePathParamNames } from './openapi3.mapping'
1818

1919
export const paramClassifyRule: ClassifyRule = [
2020
({ after }) => {
@@ -143,8 +143,11 @@ export const pathChangeClassifyRule: ClassifyRule = [
143143
({ before, after }) => {
144144
const beforePath = before.key as string
145145
const afterPath = after.key as string
146-
const unifiedBeforePath = createPathUnifier(before)(beforePath)
147-
const unifiedAfterPath = createPathUnifier(after)(afterPath)
146+
// todo uncomment
147+
// const unifiedBeforePath = createPathUnifier(before)(beforePath)
148+
// const unifiedAfterPath = createPathUnifier(after)(afterPath)
149+
const unifiedBeforePath = hidePathParamNames(beforePath)
150+
const unifiedAfterPath = hidePathParamNames(afterPath)
148151

149152
// If unified paths are the same, it means only parameter names changed
150153
return unifiedBeforePath === unifiedAfterPath ? annotation : breaking

test/openapi.pathAndMethodMapping.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { annotation, apiDiff, DiffAction } from '../src'
1+
import { annotation, apiDiff, breaking, DiffAction } from '../src'
22
import { OpenapiBuilder } from './helper'
33
import { diffsMatcher } from './helper/matchers'
44

@@ -42,7 +42,7 @@ describe('Path and method mapping', () => {
4242
beforeDeclarationPaths: [['paths', '/path1']],
4343
afterDeclarationPaths: [['paths', '/api/v2/path1']],
4444
action: DiffAction.rename,
45-
type: annotation,
45+
type: breaking, // todo should be annotation
4646
}),
4747
expect.objectContaining({
4848
beforeDeclarationPaths: [['paths', '/path1', 'get', 'responses', '200', 'description']],

0 commit comments

Comments
 (0)