1616
1717import { RestOperationData , VersionRestOperation } from './rest.types'
1818import { areDeprecatedOriginsNotEmpty , isOperationRemove , removeComponents } from '../../utils'
19- import { apiDiff , breaking , COMPARE_MODE_OPERATION , Diff , DiffAction , semiBreaking } from '@netcracker/qubership-apihub-api-diff'
19+ import {
20+ apiDiff ,
21+ breaking ,
22+ COMPARE_MODE_OPERATION ,
23+ Diff ,
24+ DiffAction ,
25+ risky ,
26+ } from '@netcracker/qubership-apihub-api-diff'
2027import { MESSAGE_SEVERITY , NORMALIZE_OPTIONS , ORIGINS_SYMBOL } from '../../consts'
21- import { BREAKING_CHANGE_TYPE , CompareOperationsPairContext , SEMI_BREAKING_CHANGE_TYPE } from '../../types'
28+ import {
29+ BREAKING_CHANGE_TYPE ,
30+ CompareOperationsPairContext ,
31+ RISKY_CHANGE_TYPE ,
32+ } from '../../types'
2233import { isObject } from '@netcracker/qubership-apihub-json-crawl'
2334import { areDeclarationPathsEqual } from '../../utils/path'
2435import { JSON_SCHEMA_PROPERTY_DEPRECATED , pathItemToFullPath , resolveOrigins } from '@netcracker/qubership-apihub-api-unifier'
@@ -48,7 +59,7 @@ export const compareRestOperationsData = async (current: VersionRestOperation |
4859 normalizedResult : true ,
4960 beforeSource : previous ?. data ,
5061 afterSource : current ?. data ,
51- }
62+ } ,
5263 )
5364 const olnyBreaking = diffResult . diffs . filter ( ( diff ) => diff . type === breaking )
5465 if ( olnyBreaking . length > 0 && previous ?. operationId ) {
@@ -61,7 +72,7 @@ async function reclassifyBreakingChanges(
6172 operationId : string ,
6273 mergedJso : unknown ,
6374 diffs : Diff [ ] ,
64- ctx : CompareOperationsPairContext
75+ ctx : CompareOperationsPairContext ,
6576) : Promise < void > {
6677 if ( ! ctx . previousVersion || ! ctx . previousPackageId ) {
6778 return
@@ -71,6 +82,7 @@ async function reclassifyBreakingChanges(
7182 return
7283 }
7384 previosVersionDeprecations . operations [ 0 ]
85+
7486 const previousOperation = previosVersionDeprecations . operations [ 0 ]
7587
7688 if ( ! previousOperation ?. deprecatedItems ) { return }
@@ -82,7 +94,7 @@ async function reclassifyBreakingChanges(
8294
8395 const deprecatedInVersionsCount = previousOperation ?. deprecatedInPreviousVersions ?. length ?? 0
8496 if ( isOperationRemove ( diff ) && deprecatedInVersionsCount > 1 ) {
85- diff . type = semiBreaking
97+ diff . type = risky
8698 continue
8799 }
88100
@@ -93,7 +105,7 @@ async function reclassifyBreakingChanges(
93105 if ( ! isObject ( diff . beforeNormalizedValue ) ) {
94106 ctx . notifications . push ( {
95107 severity : MESSAGE_SEVERITY . Error ,
96- message : '[Semi-breaking validation] Something wrong with beforeNormalizedValue from diff' ,
108+ message : '[Risky validation] Something wrong with beforeNormalizedValue from diff' ,
97109 } )
98110 continue
99111 }
@@ -102,7 +114,7 @@ async function reclassifyBreakingChanges(
102114 if ( ! areDeprecatedOriginsNotEmpty ( diff . beforeNormalizedValue ) ) {
103115 ctx . notifications . push ( {
104116 severity : MESSAGE_SEVERITY . Error ,
105- message : '[Semi-breaking validation] Something wrong with origins' ,
117+ message : '[Risky validation] Something wrong with origins' ,
106118 } )
107119 continue
108120 }
@@ -125,16 +137,16 @@ async function reclassifyBreakingChanges(
125137 }
126138
127139 if ( deprecatedItem && deprecatedItem ?. deprecatedInPreviousVersions ?. length > 1 ) {
128- diff . type = semiBreaking
140+ diff . type = risky
129141 }
130142 }
131- // mark removed required status of the property as semi-breaking
143+ // mark removed required status of the property as risky
132144 if ( diffs . length ) {
133145 const requiredProperties = findRequiredRemovedProperties ( mergedJso , diffs )
134146
135147 requiredProperties ?. forEach ( prop => {
136- if ( prop . propDiff . type === SEMI_BREAKING_CHANGE_TYPE && prop . requiredDiff ?. type === BREAKING_CHANGE_TYPE ) {
137- prop . requiredDiff . type = semiBreaking
148+ if ( prop . propDiff . type === RISKY_CHANGE_TYPE && prop . requiredDiff ?. type === BREAKING_CHANGE_TYPE ) {
149+ prop . requiredDiff . type = risky
138150 }
139151 } )
140152 }
0 commit comments