Skip to content

Commit adc8992

Browse files
committed
fix: use recursive aggregateDiff function function (many-folds perfromance improvement)
1 parent c1b8052 commit adc8992

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/apitypes/graphql/graphql.changes.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import { isEmpty, slugify, takeIf } from '../../utils'
18-
import { apiDiff, Diff, DIFF_META_KEY, DIFFS_AGGREGATED_META_KEY } from '@netcracker/qubership-apihub-api-diff'
18+
import { aggregateDiffsWithRollup, apiDiff, Diff, DIFF_META_KEY, DIFFS_AGGREGATED_META_KEY } from '@netcracker/qubership-apihub-api-diff'
1919
import { NORMALIZE_OPTIONS, ORIGINS_SYMBOL } from '../../consts'
2020
import { GraphApiOperation, GraphApiSchema } from '@netcracker/qubership-apihub-graphapi'
2121
import { buildSchema } from 'graphql/utilities'
@@ -72,7 +72,6 @@ export const compareDocuments = async (
7272
...NORMALIZE_OPTIONS,
7373
metaKey: DIFF_META_KEY,
7474
originsFlag: ORIGINS_SYMBOL,
75-
diffsAggregatedFlag: DIFFS_AGGREGATED_META_KEY,
7675
normalizedResult: true,
7776
},
7877
) as { merged: GraphApiSchema; diffs: Diff[] }
@@ -81,6 +80,8 @@ export const compareDocuments = async (
8180
return { operationChanges: [], tags: new Set() }
8281
}
8382

83+
aggregateDiffsWithRollup(merged, DIFF_META_KEY, DIFFS_AGGREGATED_META_KEY)
84+
8485
const { currentGroup, previousGroup } = ctx
8586

8687
const tags = new Set<string>()

src/apitypes/rest/rest.changes.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import { RestOperationData } from './rest.types'
1818
import {
1919
areDeprecatedOriginsNotEmpty,
20-
convertToSlug,
2120
IGNORE_PATH_PARAM_UNIFIED_PLACEHOLDER,
2221
isEmpty,
2322
isOperationRemove,
@@ -27,7 +26,8 @@ import {
2726
trimSlashes,
2827
} from '../../utils'
2928
import {
30-
apiDiff,
29+
aggregateDiffsWithRollup,
30+
apiDiff,
3131
breaking,
3232
Diff,
3333
DIFF_META_KEY,
@@ -110,7 +110,6 @@ export const compareDocuments = async (
110110
...NORMALIZE_OPTIONS,
111111
metaKey: DIFF_META_KEY,
112112
originsFlag: ORIGINS_SYMBOL,
113-
diffsAggregatedFlag: DIFFS_AGGREGATED_META_KEY,
114113
normalizedResult: true,
115114
},
116115
) as { merged: OpenAPIV3.Document; diffs: Diff[] }
@@ -119,6 +118,8 @@ export const compareDocuments = async (
119118
return { operationChanges: [], tags: new Set() }
120119
}
121120

121+
aggregateDiffsWithRollup(merged, DIFF_META_KEY, DIFFS_AGGREGATED_META_KEY)
122+
122123
const tags = new Set<string>()
123124
const operationChanges: OperationChanges[] = []
124125

0 commit comments

Comments
 (0)