Skip to content

Commit 7bc96e9

Browse files
refactor: rename semi-breaking changes to risky in FE code
1 parent f198dac commit 7bc96e9

File tree

8 files changed

+23
-23
lines changed

8 files changed

+23
-23
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@netcracker/qubership-apihub-api-diff",
3-
"version": "1.1.1-dev.0",
3+
"version": "1.1.1",
44
"module": "./dist/index.es.js",
55
"main": "./dist/index.cjs.js",
66
"types": "./dist/index.d.ts",

src/core/constants.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ export const DiffAction = {
1616
export const ClassifierType = {
1717
breaking: 'breaking',
1818
nonBreaking: 'non-breaking',
19-
semiBreaking: 'semi-breaking',
19+
risky: 'risky',
2020
annotation: 'annotation',
2121
unclassified: 'unclassified',
2222
deprecated: 'deprecated',
2323
} as const
2424

25-
export const { breaking, nonBreaking, semiBreaking, unclassified, annotation, deprecated } = ClassifierType
25+
export const { breaking, nonBreaking, risky, unclassified, annotation, deprecated } = ClassifierType
2626

2727
// predefined classifiers
2828
export const allNonBreaking: ClassifyRule = [nonBreaking, nonBreaking, nonBreaking]

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export { COMPARE_MODE_DEFAULT, COMPARE_MODE_OPERATION } from './types'
22

33
export {
4-
ClassifierType, DiffAction, DIFF_META_KEY, breaking, nonBreaking, unclassified, annotation, deprecated, semiBreaking,
4+
ClassifierType, DiffAction, DIFF_META_KEY, breaking, nonBreaking, unclassified, annotation, deprecated, risky,
55
} from './core'
66

77
export { apiDiff } from './api'

src/jsonSchema/jsonSchema.classify.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
breakingIfAfterTrue,
55
nonBreaking,
66
PARENT_JUMP,
7-
semiBreaking,
7+
risky,
88
strictResolveValueFromContext,
99
unclassified,
1010
} from '../core'
@@ -101,8 +101,8 @@ export const enumClassifyRule: ClassifyRule = [
101101
({ before }) => (isNotEmptyArray(before.parent) ? nonBreaking : breaking),
102102
({ after }) => (isNotEmptyArray(after.parent) ? breaking : nonBreaking),
103103
breaking,
104-
({ before }) => (isNotEmptyArray(before.parent) ? semiBreaking : nonBreaking),
105-
({ after }) => (isNotEmptyArray(after.parent) ? nonBreaking: semiBreaking ),
104+
({ before }) => (isNotEmptyArray(before.parent) ? risky : nonBreaking),
105+
({ after }) => (isNotEmptyArray(after.parent) ? nonBreaking: risky ),
106106
nonBreaking
107107
]
108108

src/jsonSchema/jsonSchema.rules.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import {
77
booleanClassifier,
88
breaking,
99
breakingIf,
10+
deepEqualsUniqueItemsArrayMappingResolver,
1011
diffDescription,
1112
nonBreaking,
1213
onlyAddBreaking,
1314
reverseClassifyRuleTransformer,
15+
risky,
1416
TEMPLATE_PARAM_ACTION,
1517
TEMPLATE_PARAM_PLACE,
1618
TEMPLATE_PARAM_PREPOSITION,
@@ -19,8 +21,6 @@ import {
1921
TEMPLATE_PARAM_SCOPE,
2022
transformCompareRules,
2123
unclassified,
22-
deepEqualsUniqueItemsArrayMappingResolver,
23-
semiBreaking,
2424
} from '../core'
2525
import {
2626
enumClassifyRule,
@@ -123,7 +123,7 @@ export const jsonSchemaRules = ({
123123
'/default': simpleRule([nonBreaking, breaking, breaking], resolveSchemaDescriptionTemplates('default value')),
124124

125125
'/enum': {
126-
$: [breaking, nonBreaking, breaking, nonBreaking, semiBreaking, nonBreaking],
126+
$: [breaking, nonBreaking, breaking, nonBreaking, risky, nonBreaking],
127127
mapping: deepEqualsUniqueItemsArrayMappingResolver,
128128
'/*': ({ key, value }) => {
129129
if (!isNumber(key)) {

src/types/compare.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ export const COMPARE_SCOPE_ROOT: CompareScope = 'root'
1313
/**
1414
* Diff should be unique by [type, beforeDeclarationPaths, afterDeclarationPaths, scope]
1515
*/
16-
interface DiffBase {
17-
type: DiffType
16+
interface DiffBase<T> {
17+
type: T
1818
scope: CompareScope
1919
description?: string
2020
}
2121

22-
export interface DiffAdd extends DiffBase {
22+
export interface DiffAdd<T = DiffType> extends DiffBase<T> {
2323
action: typeof DiffAction.add
2424
/**
2525
* declaration path in after document. Empty array can be if value doesn't exist in 'after' spec or value have synthetic origin
@@ -29,7 +29,7 @@ export interface DiffAdd extends DiffBase {
2929
afterNormalizedValue: unknown
3030
}
3131

32-
export interface DiffRemove extends DiffBase {
32+
export interface DiffRemove<T = DiffType> extends DiffBase<T> {
3333
action: typeof DiffAction.remove
3434
/**
3535
* declaration path in before document. Empty array can be if value doesn't exist in 'before' spec or value have synthetic origin
@@ -39,7 +39,7 @@ export interface DiffRemove extends DiffBase {
3939
beforeNormalizedValue: unknown
4040
}
4141

42-
export interface DiffReplace extends DiffBase {
42+
export interface DiffReplace<T = DiffType> extends DiffBase<T> {
4343
action: typeof DiffAction.replace
4444
/**
4545
* declaration path in before document. Empty array can be if value doesn't exist in 'before' spec or value have synthetic origin
@@ -55,7 +55,7 @@ export interface DiffReplace extends DiffBase {
5555
beforeNormalizedValue: unknown
5656
}
5757

58-
export interface DiffRename extends DiffBase {
58+
export interface DiffRename<T = DiffType> extends DiffBase<T> {
5959
action: typeof DiffAction.rename
6060
/**
6161
* declaration path in before document. Empty array can be if value doesn't exist in 'before' spec or value have synthetic origin
@@ -69,7 +69,7 @@ export interface DiffRename extends DiffBase {
6969
beforeKey: unknown
7070
}
7171

72-
export type Diff = DiffAdd | DiffRemove | DiffReplace | DiffRename
72+
export type Diff<T = DiffType> = DiffAdd<T> | DiffRemove<T> | DiffReplace<T> | DiffRename<T>
7373

7474
export interface CompareResult {
7575
diffs: Diff[]

test/compatibility-suites/openapi/response-body-schema.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { compareFiles, compareFilesWithMerge, TEST_DEFAULTS_DECLARATION_PATHS } from '../utils'
22
import { diffsMatcher } from '../../helper/matchers'
3-
import { annotation, breaking, DiffAction, nonBreaking, semiBreaking } from '../../../src'
3+
import { annotation, breaking, DiffAction, nonBreaking, risky } from '../../../src'
44
import { JSON_SCHEMA_NODE_SYNTHETIC_TYPE_ANY } from '@netcracker/qubership-apihub-api-unifier'
55

66
const SUITE_ID = 'response-body-schema'
@@ -160,7 +160,7 @@ describe('Openapi3 ResponseBody.Schema ', () => {
160160
expect.objectContaining({
161161
action: DiffAction.remove,
162162
beforeDeclarationPaths: [[...RESPONSE_SCHEMA_PATH, 'enum']],
163-
type: semiBreaking,
163+
type: risky,
164164
}),
165165
]))
166166
})
@@ -172,7 +172,7 @@ describe('Openapi3 ResponseBody.Schema ', () => {
172172
expect.objectContaining({
173173
action: DiffAction.add,
174174
afterDeclarationPaths: [[...RESPONSE_SCHEMA_PATH, 'enum', 2]],
175-
type: semiBreaking,
175+
type: risky,
176176
}),
177177
]))
178178
})
@@ -189,7 +189,7 @@ describe('Openapi3 ResponseBody.Schema ', () => {
189189
expect.objectContaining({
190190
action: DiffAction.add,
191191
afterDeclarationPaths: [[...RESPONSE_SCHEMA_PATH, 'enum', 1]],
192-
type: semiBreaking,
192+
type: risky,
193193
}),
194194
],
195195
))

0 commit comments

Comments
 (0)